core cleanup: rip & tear at sipe.c and out comes sip-transport.c
[siplcs.git] / src / core / sipe.h
blob808f254764a714fe6addb6cf6e2b0d2f4bb84d4b
1 /**
2 * @file sipe.h
4 * pidgin-sipe
6 * Copyright (C) 2010 SIPE Project <http://sipe.sourceforge.net/>
7 * Copyright (C) 2008 Novell, Inc.
8 * Copyright (C) 2007 Anibal Avelar <avelar@gmail.com>
9 * Copyright (C) 2005 Thomas Butter <butter@uni-mannheim.de>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 * Interface dependencies:
29 * <time.h>
30 * <glib.h>
33 /* Forward declarations */
34 struct sipmsg;
35 struct _PurpleAccount;
36 struct _PurpleConnection;
37 struct _PurpleGroup;
38 struct sip_sec_context;
39 struct sipe_core_private;
41 #define SIPE_TYPING_RECV_TIMEOUT 6
42 #define SIPE_TYPING_SEND_TIMEOUT 4
44 struct sip_auth {
45 guint type;
46 struct sip_sec_context *gssapi_context;
47 gchar *gssapi_data;
48 gchar *opaque;
49 gchar *realm;
50 gchar *target;
51 int version;
52 int nc;
53 int retries;
54 int ntlm_num;
55 int expires;
58 /** MS-PRES publication */
59 struct sipe_publication {
60 gchar *category;
61 guint instance;
62 guint container;
63 guint version;
64 /** for 'state' category */
65 int availability;
66 /** for 'state:calendarState' category */
67 char *cal_event_hash;
68 /** for 'note' category */
69 gchar *note;
70 /** for 'calendarData' category; 300(Team) container */
71 char *working_hours_xml_str;
72 char *fb_start_str;
73 char *free_busy_base64;
76 /** MS-PRES container */
77 struct sipe_container {
78 guint id;
79 guint version;
80 GSList *members;
82 /** MS-PRES container member */
83 struct sipe_container_member {
84 /** user, domain, sameEnterprise, federated, publicCloud; everyone */
85 gchar *type;
86 gchar *value;
89 struct sipe_account_data {
90 /* back pointer to new data structure */
91 struct sipe_core_public *public;
92 /* same, but reduces need for casting and increases type safety */
93 struct sipe_core_private *private;
95 struct _PurpleConnection *gc;
96 gchar *username;
97 gchar *authdomain;
98 gchar *authuser;
99 gchar *password;
100 gchar *epid;
101 gchar *focus_factory_uri;
102 /** Allowed server events to subscribe. From register OK response. */
103 GSList *allow_events;
104 int cseq;
105 int registerstatus; /* 0 nothing, 1 first registration send, 2 auth received, 3 registered */
106 struct sip_auth registrar;
107 struct sip_auth proxy;
108 struct sip_csta *csta; /* For RCC - Remote Call Control */
109 gboolean reregister_set; /* whether reregister timer set */
110 gboolean reauthenticate_set; /* whether reauthenticate timer set */
111 gboolean subscribed; /* whether subscribed to events, except buddies presence */
112 gboolean subscribed_buddies; /* whether subscribed to buddies presence */
113 gboolean access_level_set; /* whether basic access level set */
114 gboolean initial_state_published; /* whether we published our initial state */
115 GSList *our_publication_keys; /* [MS-PRES] */
116 GHashTable *our_publications; /* [MS-PRES] */
117 GHashTable *user_state_publications; /* [MS-PRES] */
118 GHashTable *subscriptions;
119 int contacts_delta;
120 int acl_delta;
121 int presence_method_version;
122 time_t do_not_publish[SIPE_ACTIVITY_NUM_TYPES];
123 gchar *status;
124 gboolean is_oof_note;
125 gchar *note;
126 time_t note_since;
127 time_t idle_switch;
128 gchar *contact;
129 gchar *server_version;
130 gboolean ocs2007; /*if there is support for batched category subscription [SIP-PRES]*/
131 gboolean batched_support; /*if there is support for batched subscription*/
132 GSList *containers; /* MS-PRES containers */
133 struct _PurpleAccount *account;
134 gchar *regcallid;
135 GSList *transactions;
136 GSList *sessions;
137 GSList *groups;
138 GHashTable *filetransfers;
139 gboolean processing_input;
140 struct sipe_calendar *cal;
141 gchar *email;
142 /** 2005 Custom XML piece.
143 * Possibly set by other point of presence or just other client at earlier time.
144 * It should be preserved/modified, not overwritten. This implies subscription
145 * to self-contasct.
146 * This XML keeps OC2005:
147 * - User note
148 * - OOF flag
149 * - User status
151 gchar *user_states;
154 struct sipe_auth_job {
155 gchar * who;
156 struct sipe_account_data * sip;
159 typedef void (*Action) (struct sipe_core_private *, void *);
162 * Do schedule action for execution in the future.
163 * Non repetitive execution.
165 * @param name of action (will be copied)
166 * @param timeout in seconds
167 * @param action callback function
168 * @param destroy payload destroy function
169 * @param sipe_core_private
170 * @param payload callback data (can be NULL, otherwise caller must allocate memory)
172 void
173 sipe_schedule_action(const gchar *name,
174 int timeout,
175 Action action,
176 GDestroyNotify destroy,
177 struct sipe_core_private *sipe_private,
178 void *payload);
180 struct sipe_group {
181 gchar *name;
182 int id;
183 struct _PurpleGroup *purple_group;
186 struct group_user_context {
187 gchar * group_name;
188 gchar * user_name;
191 GSList * slist_insert_unique_sorted(GSList *list, gpointer data, GCompareFunc func);
194 * Publishes self status
195 * based on own calendar information,
196 * our Calendar information - FreeBusy, WorkingHours,
197 * OOF note.
199 * For 2007+
201 void
202 publish_calendar_status_self(struct sipe_core_private *sipe_private,
203 void *unused);
206 * For 2005-
208 void
209 send_presence_soap(struct sipe_account_data *sip,
210 gboolean do_publish_calendar);
213 * THE BIG SPLIT - temporary interfaces
215 * Previously private functions in sipe.c that are
216 * - waiting to be factored out to an appropriate module
217 * - are needed by the already created new modules
220 /* pier11:
222 * Since SIP (RFC3261) is extensible by its design,
223 * and MS specs prove just that (they all are defined as SIP extensions),
224 * it make sense to split functionality by extension (or close extension group).
225 * For example: conference, presence (MS-PRES), etc.
227 * This way our code will not be monolithic, but potentially _reusable_. May be
228 * a top of other SIP core, and/or other front-end (Telepathy framework?).
230 /* Forward declarations */
231 struct sip_session;
232 struct sip_dialog;
233 struct transaction;
235 void
236 sipe_invite(struct sipe_account_data *sip, struct sip_session *session,
237 const gchar *who, const gchar *msg_body, const gchar *msg_content_type,
238 const gchar *referred_by, const gboolean is_triggered);
239 /* ??? module */
240 void sipe_make_signature(struct sipe_account_data *sip,
241 struct sipmsg *msg);
242 gchar *auth_header(struct sipe_account_data *sip,
243 struct sip_auth *auth, struct sipmsg * msg);
244 const char*sipe_get_useragent(struct sipe_account_data *sip);
245 void process_input_message(struct sipe_account_data *sip,
246 struct sipmsg *msg);
247 gboolean process_register_response(struct sipe_account_data *sip,
248 struct sipmsg *msg,
249 struct transaction *trans);
250 gboolean process_subscribe_response(struct sipe_account_data *sip,
251 struct sipmsg *msg,
252 struct transaction *trans);
253 /* Chat module */
254 void
255 sipe_invite_to_chat(struct sipe_account_data *sip,
256 struct sip_session *session,
257 const gchar *who);
258 /* Session module? */
259 void
260 sipe_present_message_undelivered_err(struct sipe_account_data *sip,
261 struct sip_session *session,
262 int sip_error,
263 int sip_warning,
264 const gchar *who,
265 const gchar *message);
267 void
268 sipe_present_info(struct sipe_account_data *sip,
269 struct sip_session *session,
270 const gchar *message);
273 void
274 sipe_process_pending_invite_queue(struct sipe_account_data *sip,
275 struct sip_session *session);
277 void
278 sipe_im_process_queue (struct sipe_account_data * sip, struct sip_session * session);
281 /*** THE BIG SPLIT END ***/
283 #define SIPE_INVITE_TEXT "ms-text-format: %s; charset=UTF-8%s;ms-body=%s\r\n"
285 #define SIPE_SEND_TYPING \
286 "<?xml version=\"1.0\"?>"\
287 "<KeyboardActivity>"\
288 "<status status=\"type\" />"\
289 "</KeyboardActivity>"
292 * Publishes categories.
293 * @param uri (%s) Self URI. Ex.: sip:alice7@boston.local
294 * @param publications (%s) XML publications
296 #define SIPE_SEND_PRESENCE \
297 "<publish xmlns=\"http://schemas.microsoft.com/2006/09/sip/rich-presence\">"\
298 "<publications uri=\"%s\">"\
299 "%s"\
300 "</publications>"\
301 "</publish>"
304 * Publishes 'device' category.
305 * @param instance (%u) Ex.: 1938468728
306 * @param version (%u) Ex.: 1
307 * @param endpointId (%s) Ex.: C707E38E-1E10-5413-94D9-ECAC260A0269
308 * @param uri (%s) Self URI. Ex.: sip:alice7@boston.local
309 * @param timezone (%s) Ex.: 00:00:00+01:00
310 * @param machineName (%s) Ex.: BOSTON-OCS07
312 #define SIPE_PUB_XML_DEVICE \
313 "<publication categoryName=\"device\" instance=\"%u\" container=\"2\" version=\"%u\" expireType=\"endpoint\">"\
314 "<device xmlns=\"http://schemas.microsoft.com/2006/09/sip/device\" endpointId=\"%s\">"\
315 "<capabilities preferred=\"false\" uri=\"%s\">"\
316 "<text capture=\"true\" render=\"true\" publish=\"false\"/>"\
317 "<gifInk capture=\"false\" render=\"true\" publish=\"false\"/>"\
318 "<isfInk capture=\"false\" render=\"true\" publish=\"false\"/>"\
319 "</capabilities>"\
320 "<timezone>%s</timezone>"\
321 "<machineName>%s</machineName>"\
322 "</device>"\
323 "</publication>"
326 * Publishes 'machineState' category.
327 * @param instance (%u) Ex.: 926460663
328 * @param version (%u) Ex.: 22
329 * @param availability (%d) Ex.: 3500
330 * @param instance (%u) Ex.: 926460663
331 * @param version (%u) Ex.: 22
332 * @param availability (%d) Ex.: 3500
334 #define SIPE_PUB_XML_STATE_MACHINE \
335 "<publication categoryName=\"state\" instance=\"%u\" container=\"2\" version=\"%u\" expireType=\"endpoint\">"\
336 "<state xmlns=\"http://schemas.microsoft.com/2006/09/sip/state\" manual=\"false\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"machineState\">"\
337 "<availability>%d</availability>"\
338 "<endpointLocation/>"\
339 "</state>"\
340 "</publication>"\
341 "<publication categoryName=\"state\" instance=\"%u\" container=\"3\" version=\"%u\" expireType=\"endpoint\">"\
342 "<state xmlns=\"http://schemas.microsoft.com/2006/09/sip/state\" manual=\"false\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"machineState\">"\
343 "<availability>%d</availability>"\
344 "<endpointLocation/>"\
345 "</state>"\
346 "</publication>"
349 * Publishes 'userState' category.
350 * @param instance (%u) User. Ex.: 536870912
351 * @param version (%u) User Container 2. Ex.: 22
352 * @param availability (%d) User Container 2. Ex.: 15500
353 * @param instance (%u) User. Ex.: 536870912
354 * @param version (%u) User Container 3.Ex.: 22
355 * @param availability (%d) User Container 3. Ex.: 15500
357 #define SIPE_PUB_XML_STATE_USER \
358 "<publication categoryName=\"state\" instance=\"%u\" container=\"2\" version=\"%u\" expireType=\"static\">"\
359 "<state xmlns=\"http://schemas.microsoft.com/2006/09/sip/state\" manual=\"true\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"userState\">"\
360 "<availability>%d</availability>"\
361 "<endpointLocation/>"\
362 "</state>"\
363 "</publication>"\
364 "<publication categoryName=\"state\" instance=\"%u\" container=\"3\" version=\"%u\" expireType=\"static\">"\
365 "<state xmlns=\"http://schemas.microsoft.com/2006/09/sip/state\" manual=\"true\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"userState\">"\
366 "<availability>%d</availability>"\
367 "<endpointLocation/>"\
368 "</state>"\
369 "</publication>"
372 * An availability XML entry for SIPE_PUB_XML_STATE_CALENDAR
373 * @param availability (%d) Ex.: 6500
375 #define SIPE_PUB_XML_STATE_CALENDAR_AVAIL \
376 "<availability>%d</availability>"
378 * An activity XML entry for SIPE_PUB_XML_STATE_CALENDAR
379 * @param token (%s) Ex.: in-a-meeting
380 * @param minAvailability_attr (%s) Ex.: minAvailability="6500"
381 * @param maxAvailability_attr (%s) Ex.: maxAvailability="8999" or none
383 #define SIPE_PUB_XML_STATE_CALENDAR_ACTIVITY \
384 "<activity token=\"%s\" %s %s></activity>"
386 * Publishes 'calendarState' category.
387 * @param instance (%u) Ex.: 1339299275
388 * @param version (%u) Ex.: 1
389 * @param uri (%s) Ex.: john@contoso.com
390 * @param start_time_str (%s) Ex.: 2008-01-11T19:00:00Z
391 * @param availability (%s) XML string as SIPE_PUB_XML_STATE_CALENDAR_AVAIL
392 * @param activity (%s) XML string as SIPE_PUB_XML_STATE_CALENDAR_ACTIVITY
393 * @param meeting_subject (%s) Ex.: Customer Meeting
394 * @param meeting_location (%s) Ex.: Conf Room 100
396 * @param instance (%u) Ex.: 1339299275
397 * @param version (%u) Ex.: 1
398 * @param uri (%s) Ex.: john@contoso.com
399 * @param start_time_str (%s) Ex.: 2008-01-11T19:00:00Z
400 * @param availability (%s) XML string as SIPE_PUB_XML_STATE_CALENDAR_AVAIL
401 * @param activity (%s) XML string as SIPE_PUB_XML_STATE_CALENDAR_ACTIVITY
402 * @param meeting_subject (%s) Ex.: Customer Meeting
403 * @param meeting_location (%s) Ex.: Conf Room 100
405 #define SIPE_PUB_XML_STATE_CALENDAR \
406 "<publication categoryName=\"state\" instance=\"%u\" container=\"2\" version=\"%u\" expireType=\"endpoint\">"\
407 "<state xmlns=\"http://schemas.microsoft.com/2006/09/sip/state\" manual=\"false\" uri=\"%s\" startTime=\"%s\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"calendarState\">"\
408 "%s"\
409 "%s"\
410 "<endpointLocation/>"\
411 "<meetingSubject>%s</meetingSubject>"\
412 "<meetingLocation>%s</meetingLocation>"\
413 "</state>"\
414 "</publication>"\
415 "<publication categoryName=\"state\" instance=\"%u\" container=\"3\" version=\"%u\" expireType=\"endpoint\">"\
416 "<state xmlns=\"http://schemas.microsoft.com/2006/09/sip/state\" manual=\"false\" uri=\"%s\" startTime=\"%s\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"calendarState\">"\
417 "%s"\
418 "%s"\
419 "<endpointLocation/>"\
420 "<meetingSubject>%s</meetingSubject>"\
421 "<meetingLocation>%s</meetingLocation>"\
422 "</state>"\
423 "</publication>"
426 * Publishes to clear 'calendarState' category
427 * @param instance (%u) Ex.: 1251210982
428 * @param version (%u) Ex.: 1
430 #define SIPE_PUB_XML_STATE_CALENDAR_CLEAR \
431 "<publication categoryName=\"state\" instance=\"%u\" container=\"2\" version=\"%u\" expireType=\"endpoint\" expires=\"0\"/>"\
432 "<publication categoryName=\"state\" instance=\"%u\" container=\"3\" version=\"%u\" expireType=\"endpoint\" expires=\"0\"/>"
435 * Publishes to clear any category
436 * @param category_name (%s) Ex.: state
437 * @param instance (%u) Ex.: 536870912
438 * @param container (%u) Ex.: 3
439 * @param version (%u) Ex.: 1
440 * @param expireType (%s) Ex.: static
442 #define SIPE_PUB_XML_PUBLICATION_CLEAR \
443 "<publication categoryName=\"%s\" instance=\"%u\" container=\"%u\" version=\"%u\" expireType=\"%s\" expires=\"0\"/>"
446 * Publishes 'note' category.
447 * @param instance (%u) Ex.: 2135971629; 0 for personal
448 * @param container (%u) Ex.: 200
449 * @param version (%u) Ex.: 2
450 * @param type (%s) Ex.: personal or OOF
451 * @param startTime_attr (%s) Ex.: startTime="2008-01-11T19:00:00Z"
452 * @param endTime_attr (%s) Ex.: endTime="2008-01-15T19:00:00Z"
453 * @param body (%s) Ex.: In the office
455 #define SIPE_PUB_XML_NOTE \
456 "<publication categoryName=\"note\" instance=\"%u\" container=\"%u\" version=\"%d\" expireType=\"static\">"\
457 "<note xmlns=\"http://schemas.microsoft.com/2006/09/sip/note\">"\
458 "<body type=\"%s\" uri=\"\"%s%s>%s</body>"\
459 "</note>"\
460 "</publication>"
463 * Publishes 'calendarData' category's WorkingHours.
465 * @param version (%u) Ex.: 1
466 * @param email (%s) Ex.: alice@cosmo.local
467 * @param working_hours_xml_str (%s) Ex.: <WorkingHours xmlns=.....
469 * @param version (%u)
471 * @param version (%u)
472 * @param email (%s)
473 * @param working_hours_xml_str (%s)
475 * @param version (%u)
476 * @param email (%s)
477 * @param working_hours_xml_str (%s)
479 * @param version (%u)
480 * @param email (%s)
481 * @param working_hours_xml_str (%s)
483 * @param version (%u)
485 #define SIPE_PUB_XML_WORKING_HOURS \
486 "<publication categoryName=\"calendarData\" instance=\"0\" container=\"1\" version=\"%d\" expireType=\"static\">"\
487 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\" mailboxID=\"%s\">%s"\
488 "</calendarData>"\
489 "</publication>"\
490 "<publication categoryName=\"calendarData\" instance=\"0\" container=\"100\" version=\"%d\" expireType=\"static\">"\
491 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\"/>"\
492 "</publication>"\
493 "<publication categoryName=\"calendarData\" instance=\"0\" container=\"200\" version=\"%d\" expireType=\"static\">"\
494 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\" mailboxID=\"%s\">%s"\
495 "</calendarData>"\
496 "</publication>"\
497 "<publication categoryName=\"calendarData\" instance=\"0\" container=\"300\" version=\"%d\" expireType=\"static\">"\
498 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\" mailboxID=\"%s\">%s"\
499 "</calendarData>"\
500 "</publication>"\
501 "<publication categoryName=\"calendarData\" instance=\"0\" container=\"400\" version=\"%d\" expireType=\"static\">"\
502 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\" mailboxID=\"%s\">%s"\
503 "</calendarData>"\
504 "</publication>"\
505 "<publication categoryName=\"calendarData\" instance=\"0\" container=\"32000\" version=\"%d\" expireType=\"static\">"\
506 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\"/>"\
507 "</publication>"
510 * Publishes 'calendarData' category's FreeBusy.
512 * @param instance (%u) Ex.: 1300372959
513 * @param version (%u) Ex.: 1
515 * @param instance (%u) Ex.: 1300372959
516 * @param version (%u) Ex.: 1
518 * @param instance (%u) Ex.: 1300372959
519 * @param version (%u) Ex.: 1
520 * @param email (%s) Ex.: alice@cosmo.local
521 * @param fb_start_time_str (%s) Ex.: 2009-12-03T00:00:00Z
522 * @param free_busy_base64 (%s) Ex.: AAAAAAAAAAAAAAAAAAAAA.....
524 * @param instance (%u) Ex.: 1300372959
525 * @param version (%u) Ex.: 1
526 * @param email (%s) Ex.: alice@cosmo.local
527 * @param fb_start_time_str (%s) Ex.: 2009-12-03T00:00:00Z
528 * @param free_busy_base64 (%s) Ex.: AAAAAAAAAAAAAAAAAAAAA.....
530 * @param instance (%u) Ex.: 1300372959
531 * @param version (%u) Ex.: 1
532 * @param email (%s) Ex.: alice@cosmo.local
533 * @param fb_start_time_str (%s) Ex.: 2009-12-03T00:00:00Z
534 * @param free_busy_base64 (%s) Ex.: AAAAAAAAAAAAAAAAAAAAA.....
536 * @param instance (%u) Ex.: 1300372959
537 * @param version (%u) Ex.: 1
539 #define SIPE_PUB_XML_FREE_BUSY \
540 "<publication categoryName=\"calendarData\" instance=\"%u\" container=\"1\" version=\"%d\" expireType=\"endpoint\">"\
541 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\"/>"\
542 "</publication>"\
543 "<publication categoryName=\"calendarData\" instance=\"%u\" container=\"100\" version=\"%d\" expireType=\"endpoint\">"\
544 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\"/>"\
545 "</publication>"\
546 "<publication categoryName=\"calendarData\" instance=\"%u\" container=\"200\" version=\"%d\" expireType=\"endpoint\">"\
547 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\" mailboxID=\"%s\">"\
548 "<freeBusy startTime=\"%s\" granularity=\"PT15M\" encodingVersion=\"1\">%s</freeBusy>"\
549 "</calendarData>"\
550 "</publication>"\
551 "<publication categoryName=\"calendarData\" instance=\"%u\" container=\"300\" version=\"%d\" expireType=\"endpoint\">"\
552 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\" mailboxID=\"%s\">"\
553 "<freeBusy startTime=\"%s\" granularity=\"PT15M\" encodingVersion=\"1\">%s</freeBusy>"\
554 "</calendarData>"\
555 "</publication>"\
556 "<publication categoryName=\"calendarData\" instance=\"%u\" container=\"400\" version=\"%d\" expireType=\"endpoint\">"\
557 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\" mailboxID=\"%s\">"\
558 "<freeBusy startTime=\"%s\" granularity=\"PT15M\" encodingVersion=\"1\">%s</freeBusy>"\
559 "</calendarData>"\
560 "</publication>"\
561 "<publication categoryName=\"calendarData\" instance=\"%u\" container=\"32000\" version=\"%d\" expireType=\"endpoint\">"\
562 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\"/>"\
563 "</publication>"
566 #define sipe_soap(method, body) \
567 "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
568 "<SOAP-ENV:Body>" \
569 "<m:" method " xmlns:m=\"http://schemas.microsoft.com/winrtc/2002/11/sip\">" \
570 body \
571 "</m:" method ">" \
572 "</SOAP-ENV:Body>" \
573 "</SOAP-ENV:Envelope>"
575 #define SIPE_SOAP_SET_CONTACT sipe_soap("setContact", \
576 "<m:displayName>%s</m:displayName>"\
577 "<m:groups>%s</m:groups>"\
578 "<m:subscribed>%s</m:subscribed>"\
579 "<m:URI>%s</m:URI>"\
580 "<m:externalURI />"\
581 "<m:deltaNum>%d</m:deltaNum>")
583 #define SIPE_SOAP_DEL_CONTACT sipe_soap("deleteContact", \
584 "<m:URI>%s</m:URI>"\
585 "<m:deltaNum>%d</m:deltaNum>")
587 #define SIPE_SOAP_ADD_GROUP sipe_soap("addGroup", \
588 "<m:name>%s</m:name>"\
589 "<m:externalURI />"\
590 "<m:deltaNum>%d</m:deltaNum>")
592 #define SIPE_SOAP_MOD_GROUP sipe_soap("modifyGroup", \
593 "<m:groupID>%d</m:groupID>"\
594 "<m:name>%s</m:name>"\
595 "<m:externalURI />"\
596 "<m:deltaNum>%d</m:deltaNum>")
598 #define SIPE_SOAP_DEL_GROUP sipe_soap("deleteGroup", \
599 "<m:groupID>%d</m:groupID>"\
600 "<m:deltaNum>%d</m:deltaNum>")
602 // first/mask arg is sip:user@domain.com
603 // second/rights arg is AA for allow, BD for deny
604 #define SIPE_SOAP_ALLOW_DENY sipe_soap("setACE", \
605 "<m:type>USER</m:type>"\
606 "<m:mask>%s</m:mask>"\
607 "<m:rights>%s</m:rights>"\
608 "<m:deltaNum>%d</m:deltaNum>")
611 * Calendar publication entry. 2005 systems.
613 * @param legacy_dn (%s) Ex.: /o=EXCHANGE/ou=BTUK02/cn=Recipients/cn=AHHBTT
614 * @param fb_start_time_str (%s) Ex.: 2009-12-06T17:15:00Z
615 * @param free_busy_base64 (%s) Ex.: AAAAAAAAAAAAAAAAA......
617 #define SIPE_SOAP_SET_PRESENCE_CALENDAR \
618 "<calendarInfo xmlns=\"http://schemas.microsoft.com/2002/09/sip/presence\" mailboxId=\"%s\" startTime=\"%s\" granularity=\"PT15M\">%s</calendarInfo>"
620 * Note publication entry. 2005 systems.
622 * @param note (%s) Ex.: Working from home
624 #define SIPE_SOAP_SET_PRESENCE_NOTE_XML "<note>%s</note>"
626 * Note's OOF publication entry. 2005 systems.
628 #define SIPE_SOAP_SET_PRESENCE_OOF_XML "<oof></oof>"
630 * States publication entry for User State. 2005 systems.
632 * @param avail (%d) Availability 2007-style. Ex.: 9500
633 * @param since_time_str (%s) Ex.: 2010-01-13T10:30:05Z
634 * @param device_id (%s) epid. Ex.: 4c77e6ec72
635 * @param activity_token (%s) Ex.: do-not-disturb
637 #define SIPE_SOAP_SET_PRESENCE_STATES \
638 "<states>"\
639 "<state avail=\"%d\" since=\"%s\" validWith=\"any-device\" deviceId=\"%s\" set=\"manual\" xsi:type=\"userState\">%s</state>"\
640 "</states>"
642 * Presentity publication entry. 2005 systems.
644 * @param uri (%s) SIP URI without 'sip:' prefix. Ex.: fox@atlanta.local
645 * @param aggr_availability (%d) Ex.: 300
646 * @param aggr_activity (%d) Ex.: 600
647 * @param host_name (%s) Uppercased. Ex.: ATLANTA
648 * @param note_xml_str (%s) XML string as SIPE_SOAP_SET_PRESENCE_NOTE_XML
649 * @param oof_xml_str (%s) XML string as SIPE_SOAP_SET_PRESENCE_OOF_XML
650 * @param states_xml_str (%s) XML string as SIPE_SOAP_SET_PRESENCE_STATES
651 * @param calendar_info_xml_str (%s) XML string as SIPE_SOAP_SET_PRESENCE_CALENDAR
652 * @param device_id (%s) epid. Ex.: 4c77e6ec72
653 * @param since_time_str (%s) Ex.: 2010-01-13T10:30:05Z
654 * @param since_time_str (%s) Ex.: 2010-01-13T10:30:05Z
655 * @param user_input (%s) active, idle
657 #define SIPE_SOAP_SET_PRESENCE sipe_soap("setPresence", \
658 "<m:presentity xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" m:uri=\"sip:%s\">"\
659 "<m:availability m:aggregate=\"%d\"/>"\
660 "<m:activity m:aggregate=\"%d\"/>"\
661 "<deviceName xmlns=\"http://schemas.microsoft.com/2002/09/sip/presence\" name=\"%s\"/>"\
662 "<rtc:devicedata xmlns:rtc=\"http://schemas.microsoft.com/winrtc/2002/11/sip\" namespace=\"rtcService\">"\
663 "<![CDATA[<caps><renders_gif/><renders_isf/></caps>]]></rtc:devicedata>"\
664 "<userInfo xmlns=\"http://schemas.microsoft.com/2002/09/sip/presence\">"\
665 "%s%s" \
666 "%s" \
667 "</userInfo>"\
668 "%s" \
669 "<device xmlns=\"http://schemas.microsoft.com/2002/09/sip/presence\" deviceId=\"%s\" since=\"%s\" >"\
670 "<userInput since=\"%s\" >%s</userInput>"\
671 "</device>"\
672 "</m:presentity>")
674 #define SIPE_SOAP_SEARCH_CONTACT \
675 "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
676 "<SOAP-ENV:Body>" \
677 "<m:directorySearch xmlns:m=\"http://schemas.microsoft.com/winrtc/2002/11/sip\">" \
678 "<m:filter m:href=\"#searchArray\"/>"\
679 "<m:maxResults>%d</m:maxResults>"\
680 "</m:directorySearch>"\
681 "<m:Array xmlns:m=\"http://schemas.microsoft.com/winrtc/2002/11/sip\" m:id=\"searchArray\">"\
682 "%s"\
683 "</m:Array>"\
684 "</SOAP-ENV:Body>"\
685 "</SOAP-ENV:Envelope>"
687 #define SIPE_SOAP_SEARCH_ROW "<m:row m:attrib=\"%s\" m:value=\"%s\"/>"