core cleanup: compilation fixes with enabled voice support
[siplcs.git] / src / core / sipe.h
blob38df87c25b5f9c524279d57ee6557630505c28c1
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 sipe_core_private;
40 /** MS-PRES publication */
41 struct sipe_publication {
42 gchar *category;
43 guint instance;
44 guint container;
45 guint version;
46 /** for 'state' category */
47 int availability;
48 /** for 'state:calendarState' category */
49 char *cal_event_hash;
50 /** for 'note' category */
51 gchar *note;
52 /** for 'calendarData' category; 300(Team) container */
53 char *working_hours_xml_str;
54 char *fb_start_str;
55 char *free_busy_base64;
58 /** MS-PRES container */
59 struct sipe_container {
60 guint id;
61 guint version;
62 GSList *members;
64 /** MS-PRES container member */
65 struct sipe_container_member {
66 /** user, domain, sameEnterprise, federated, publicCloud; everyone */
67 gchar *type;
68 gchar *value;
71 struct sipe_account_data {
72 struct _PurpleConnection *gc;
73 gchar *authdomain;
74 gchar *authuser;
75 gchar *password;
76 /** Allowed server events to subscribe. From register OK response. */
77 GSList *allow_events;
78 struct sip_csta *csta; /* For RCC - Remote Call Control */
79 gboolean subscribed_buddies; /* whether subscribed to buddies presence */
80 gboolean access_level_set; /* whether basic access level set */
81 gboolean initial_state_published; /* whether we published our initial state */
82 GSList *our_publication_keys; /* [MS-PRES] */
83 GHashTable *our_publications; /* [MS-PRES] */
84 GHashTable *user_state_publications; /* [MS-PRES] */
85 int contacts_delta;
86 int acl_delta;
87 int presence_method_version;
88 time_t do_not_publish[SIPE_ACTIVITY_NUM_TYPES];
89 gchar *status;
90 gboolean is_oof_note;
91 gchar *note;
92 time_t note_since;
93 time_t idle_switch;
94 gboolean batched_support; /*if there is support for batched subscription*/
95 GSList *containers; /* MS-PRES containers */
96 struct _PurpleAccount *account;
97 gchar *regcallid;
98 GSList *groups;
99 struct sipe_calendar *cal;
100 gchar *email;
101 /** 2005 Custom XML piece.
102 * Possibly set by other point of presence or just other client at earlier time.
103 * It should be preserved/modified, not overwritten. This implies subscription
104 * to self-contasct.
105 * This XML keeps OC2005:
106 * - User note
107 * - OOF flag
108 * - User status
110 gchar *user_states;
113 struct sipe_auth_job {
114 gchar *who;
115 struct sipe_core_private *sipe_private;
118 struct sipe_group {
119 gchar *name;
120 int id;
121 struct _PurpleGroup *purple_group;
124 struct group_user_context {
125 gchar * group_name;
126 gchar * user_name;
129 GSList * slist_insert_unique_sorted(GSList *list, gpointer data, GCompareFunc func);
132 * Publishes self status
133 * based on own calendar information,
134 * our Calendar information - FreeBusy, WorkingHours,
135 * OOF note.
137 * For 2007+
139 void
140 publish_calendar_status_self(struct sipe_core_private *sipe_private,
141 void *unused);
144 * For 2005-
146 void
147 send_presence_soap(struct sipe_core_private *sipe_private,
148 gboolean do_publish_calendar);
151 * THE BIG SPLIT - temporary interfaces
153 * Previously private functions in sipe.c that are
154 * - waiting to be factored out to an appropriate module
155 * - are needed by the already created new modules
158 /* pier11:
160 * Since SIP (RFC3261) is extensible by its design,
161 * and MS specs prove just that (they all are defined as SIP extensions),
162 * it make sense to split functionality by extension (or close extension group).
163 * For example: conference, presence (MS-PRES), etc.
165 * This way our code will not be monolithic, but potentially _reusable_. May be
166 * a top of other SIP core, and/or other front-end (Telepathy framework?).
168 /* Forward declarations */
169 struct sip_session;
170 struct sip_dialog;
171 struct transaction;
173 void
174 sipe_invite(struct sipe_core_private *sipe_private, struct sip_session *session,
175 const gchar *who, const gchar *msg_body, const gchar *msg_content_type,
176 const gchar *referred_by, const gboolean is_triggered);
177 /* ??? module */
178 void sipe_connection_cleanup(struct sipe_core_private *sipe_private);
179 /* Session module? */
180 void
181 sipe_present_message_undelivered_err(struct sipe_core_private *sipe_private,
182 struct sip_session *session,
183 int sip_error,
184 int sip_warning,
185 const gchar *who,
186 const gchar *message);
188 void
189 sipe_present_info(struct sipe_core_private *sipe_private,
190 struct sip_session *session,
191 const gchar *message);
192 void
193 sipe_present_err(struct sipe_core_private *sipe_private,
194 struct sip_session *session,
195 const gchar *message);
197 void
198 sipe_im_process_queue(struct sipe_core_private *sipe_private,
199 struct sip_session *session);
201 void
202 sipe_session_close(struct sipe_core_private *sipe_private,
203 struct sip_session * session);
205 /* sipe-notify? */
206 void process_incoming_notify(struct sipe_core_private *sipe_private,
207 struct sipmsg *msg,
208 gboolean request,
209 gboolean benotify);
211 /*** THE BIG SPLIT END ***/
213 #ifdef HAVE_GMIME
214 /* pls. don't add multipart/related - it's not used in IM modality */
215 #define SDP_ACCEPT_TYPES "text/plain text/html image/gif multipart/alternative application/im-iscomposing+xml application/ms-imdn+xml text/x-msmsgsinvite"
216 #else
217 /* this is a rediculous hack as Pidgin's MIME implementastion doesn't support (or have bug) in multipart/alternative */
218 /* OCS/OC won't use multipart/related so we don't advertase it */
219 #define SDP_ACCEPT_TYPES "text/plain text/html image/gif application/im-iscomposing+xml application/ms-imdn+xml text/x-msmsgsinvite"
220 #endif
222 #define SIPE_INVITE_TEXT "ms-text-format: %s; charset=UTF-8%s;ms-body=%s\r\n"
225 * Publishes categories.
226 * @param uri (%s) Self URI. Ex.: sip:alice7@boston.local
227 * @param publications (%s) XML publications
229 #define SIPE_SEND_PRESENCE \
230 "<publish xmlns=\"http://schemas.microsoft.com/2006/09/sip/rich-presence\">"\
231 "<publications uri=\"%s\">"\
232 "%s"\
233 "</publications>"\
234 "</publish>"
237 * Publishes 'device' category.
238 * @param instance (%u) Ex.: 1938468728
239 * @param version (%u) Ex.: 1
240 * @param endpointId (%s) Ex.: C707E38E-1E10-5413-94D9-ECAC260A0269
241 * @param uri (%s) Self URI. Ex.: sip:alice7@boston.local
242 * @param timezone (%s) Ex.: 00:00:00+01:00
243 * @param machineName (%s) Ex.: BOSTON-OCS07
245 #define SIPE_PUB_XML_DEVICE \
246 "<publication categoryName=\"device\" instance=\"%u\" container=\"2\" version=\"%u\" expireType=\"endpoint\">"\
247 "<device xmlns=\"http://schemas.microsoft.com/2006/09/sip/device\" endpointId=\"%s\">"\
248 "<capabilities preferred=\"false\" uri=\"%s\">"\
249 "<text capture=\"true\" render=\"true\" publish=\"false\"/>"\
250 "<gifInk capture=\"false\" render=\"true\" publish=\"false\"/>"\
251 "<isfInk capture=\"false\" render=\"true\" publish=\"false\"/>"\
252 "</capabilities>"\
253 "<timezone>%s</timezone>"\
254 "<machineName>%s</machineName>"\
255 "</device>"\
256 "</publication>"
259 * Publishes 'machineState' category.
260 * @param instance (%u) Ex.: 926460663
261 * @param version (%u) Ex.: 22
262 * @param availability (%d) Ex.: 3500
263 * @param instance (%u) Ex.: 926460663
264 * @param version (%u) Ex.: 22
265 * @param availability (%d) Ex.: 3500
267 #define SIPE_PUB_XML_STATE_MACHINE \
268 "<publication categoryName=\"state\" instance=\"%u\" container=\"2\" version=\"%u\" expireType=\"endpoint\">"\
269 "<state xmlns=\"http://schemas.microsoft.com/2006/09/sip/state\" manual=\"false\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"machineState\">"\
270 "<availability>%d</availability>"\
271 "<endpointLocation/>"\
272 "</state>"\
273 "</publication>"\
274 "<publication categoryName=\"state\" instance=\"%u\" container=\"3\" version=\"%u\" expireType=\"endpoint\">"\
275 "<state xmlns=\"http://schemas.microsoft.com/2006/09/sip/state\" manual=\"false\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"machineState\">"\
276 "<availability>%d</availability>"\
277 "<endpointLocation/>"\
278 "</state>"\
279 "</publication>"
282 * Publishes 'userState' category.
283 * @param instance (%u) User. Ex.: 536870912
284 * @param version (%u) User Container 2. Ex.: 22
285 * @param availability (%d) User Container 2. Ex.: 15500
286 * @param instance (%u) User. Ex.: 536870912
287 * @param version (%u) User Container 3.Ex.: 22
288 * @param availability (%d) User Container 3. Ex.: 15500
290 #define SIPE_PUB_XML_STATE_USER \
291 "<publication categoryName=\"state\" instance=\"%u\" container=\"2\" version=\"%u\" expireType=\"static\">"\
292 "<state xmlns=\"http://schemas.microsoft.com/2006/09/sip/state\" manual=\"true\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"userState\">"\
293 "<availability>%d</availability>"\
294 "<endpointLocation/>"\
295 "</state>"\
296 "</publication>"\
297 "<publication categoryName=\"state\" instance=\"%u\" container=\"3\" version=\"%u\" expireType=\"static\">"\
298 "<state xmlns=\"http://schemas.microsoft.com/2006/09/sip/state\" manual=\"true\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"userState\">"\
299 "<availability>%d</availability>"\
300 "<endpointLocation/>"\
301 "</state>"\
302 "</publication>"
305 * An availability XML entry for SIPE_PUB_XML_STATE_CALENDAR
306 * @param availability (%d) Ex.: 6500
308 #define SIPE_PUB_XML_STATE_CALENDAR_AVAIL \
309 "<availability>%d</availability>"
311 * An activity XML entry for SIPE_PUB_XML_STATE_CALENDAR
312 * @param token (%s) Ex.: in-a-meeting
313 * @param minAvailability_attr (%s) Ex.: minAvailability="6500"
314 * @param maxAvailability_attr (%s) Ex.: maxAvailability="8999" or none
316 #define SIPE_PUB_XML_STATE_CALENDAR_ACTIVITY \
317 "<activity token=\"%s\" %s %s></activity>"
319 * Publishes 'calendarState' category.
320 * @param instance (%u) Ex.: 1339299275
321 * @param version (%u) Ex.: 1
322 * @param uri (%s) Ex.: john@contoso.com
323 * @param start_time_str (%s) Ex.: 2008-01-11T19:00:00Z
324 * @param availability (%s) XML string as SIPE_PUB_XML_STATE_CALENDAR_AVAIL
325 * @param activity (%s) XML string as SIPE_PUB_XML_STATE_CALENDAR_ACTIVITY
326 * @param meeting_subject (%s) Ex.: Customer Meeting
327 * @param meeting_location (%s) Ex.: Conf Room 100
329 * @param instance (%u) Ex.: 1339299275
330 * @param version (%u) Ex.: 1
331 * @param uri (%s) Ex.: john@contoso.com
332 * @param start_time_str (%s) Ex.: 2008-01-11T19:00:00Z
333 * @param availability (%s) XML string as SIPE_PUB_XML_STATE_CALENDAR_AVAIL
334 * @param activity (%s) XML string as SIPE_PUB_XML_STATE_CALENDAR_ACTIVITY
335 * @param meeting_subject (%s) Ex.: Customer Meeting
336 * @param meeting_location (%s) Ex.: Conf Room 100
338 #define SIPE_PUB_XML_STATE_CALENDAR \
339 "<publication categoryName=\"state\" instance=\"%u\" container=\"2\" version=\"%u\" expireType=\"endpoint\">"\
340 "<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\">"\
341 "%s"\
342 "%s"\
343 "<endpointLocation/>"\
344 "<meetingSubject>%s</meetingSubject>"\
345 "<meetingLocation>%s</meetingLocation>"\
346 "</state>"\
347 "</publication>"\
348 "<publication categoryName=\"state\" instance=\"%u\" container=\"3\" version=\"%u\" expireType=\"endpoint\">"\
349 "<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\">"\
350 "%s"\
351 "%s"\
352 "<endpointLocation/>"\
353 "<meetingSubject>%s</meetingSubject>"\
354 "<meetingLocation>%s</meetingLocation>"\
355 "</state>"\
356 "</publication>"
359 * Publishes to clear 'calendarState' category
360 * @param instance (%u) Ex.: 1251210982
361 * @param version (%u) Ex.: 1
363 #define SIPE_PUB_XML_STATE_CALENDAR_CLEAR \
364 "<publication categoryName=\"state\" instance=\"%u\" container=\"2\" version=\"%u\" expireType=\"endpoint\" expires=\"0\"/>"\
365 "<publication categoryName=\"state\" instance=\"%u\" container=\"3\" version=\"%u\" expireType=\"endpoint\" expires=\"0\"/>"
368 * Publishes to clear any category
369 * @param category_name (%s) Ex.: state
370 * @param instance (%u) Ex.: 536870912
371 * @param container (%u) Ex.: 3
372 * @param version (%u) Ex.: 1
373 * @param expireType (%s) Ex.: static
375 #define SIPE_PUB_XML_PUBLICATION_CLEAR \
376 "<publication categoryName=\"%s\" instance=\"%u\" container=\"%u\" version=\"%u\" expireType=\"%s\" expires=\"0\"/>"
379 * Publishes 'note' category.
380 * @param instance (%u) Ex.: 2135971629; 0 for personal
381 * @param container (%u) Ex.: 200
382 * @param version (%u) Ex.: 2
383 * @param type (%s) Ex.: personal or OOF
384 * @param startTime_attr (%s) Ex.: startTime="2008-01-11T19:00:00Z"
385 * @param endTime_attr (%s) Ex.: endTime="2008-01-15T19:00:00Z"
386 * @param body (%s) Ex.: In the office
388 #define SIPE_PUB_XML_NOTE \
389 "<publication categoryName=\"note\" instance=\"%u\" container=\"%u\" version=\"%d\" expireType=\"static\">"\
390 "<note xmlns=\"http://schemas.microsoft.com/2006/09/sip/note\">"\
391 "<body type=\"%s\" uri=\"\"%s%s>%s</body>"\
392 "</note>"\
393 "</publication>"
396 * Publishes 'calendarData' category's WorkingHours.
398 * @param version (%u) Ex.: 1
399 * @param email (%s) Ex.: alice@cosmo.local
400 * @param working_hours_xml_str (%s) Ex.: <WorkingHours xmlns=.....
402 * @param version (%u)
404 * @param version (%u)
405 * @param email (%s)
406 * @param working_hours_xml_str (%s)
408 * @param version (%u)
409 * @param email (%s)
410 * @param working_hours_xml_str (%s)
412 * @param version (%u)
413 * @param email (%s)
414 * @param working_hours_xml_str (%s)
416 * @param version (%u)
418 #define SIPE_PUB_XML_WORKING_HOURS \
419 "<publication categoryName=\"calendarData\" instance=\"0\" container=\"1\" version=\"%d\" expireType=\"static\">"\
420 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\" mailboxID=\"%s\">%s"\
421 "</calendarData>"\
422 "</publication>"\
423 "<publication categoryName=\"calendarData\" instance=\"0\" container=\"100\" version=\"%d\" expireType=\"static\">"\
424 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\"/>"\
425 "</publication>"\
426 "<publication categoryName=\"calendarData\" instance=\"0\" container=\"200\" version=\"%d\" expireType=\"static\">"\
427 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\" mailboxID=\"%s\">%s"\
428 "</calendarData>"\
429 "</publication>"\
430 "<publication categoryName=\"calendarData\" instance=\"0\" container=\"300\" version=\"%d\" expireType=\"static\">"\
431 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\" mailboxID=\"%s\">%s"\
432 "</calendarData>"\
433 "</publication>"\
434 "<publication categoryName=\"calendarData\" instance=\"0\" container=\"400\" version=\"%d\" expireType=\"static\">"\
435 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\" mailboxID=\"%s\">%s"\
436 "</calendarData>"\
437 "</publication>"\
438 "<publication categoryName=\"calendarData\" instance=\"0\" container=\"32000\" version=\"%d\" expireType=\"static\">"\
439 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\"/>"\
440 "</publication>"
443 * Publishes 'calendarData' category's FreeBusy.
445 * @param instance (%u) Ex.: 1300372959
446 * @param version (%u) Ex.: 1
448 * @param instance (%u) Ex.: 1300372959
449 * @param version (%u) Ex.: 1
451 * @param instance (%u) Ex.: 1300372959
452 * @param version (%u) Ex.: 1
453 * @param email (%s) Ex.: alice@cosmo.local
454 * @param fb_start_time_str (%s) Ex.: 2009-12-03T00:00:00Z
455 * @param free_busy_base64 (%s) Ex.: AAAAAAAAAAAAAAAAAAAAA.....
457 * @param instance (%u) Ex.: 1300372959
458 * @param version (%u) Ex.: 1
459 * @param email (%s) Ex.: alice@cosmo.local
460 * @param fb_start_time_str (%s) Ex.: 2009-12-03T00:00:00Z
461 * @param free_busy_base64 (%s) Ex.: AAAAAAAAAAAAAAAAAAAAA.....
463 * @param instance (%u) Ex.: 1300372959
464 * @param version (%u) Ex.: 1
465 * @param email (%s) Ex.: alice@cosmo.local
466 * @param fb_start_time_str (%s) Ex.: 2009-12-03T00:00:00Z
467 * @param free_busy_base64 (%s) Ex.: AAAAAAAAAAAAAAAAAAAAA.....
469 * @param instance (%u) Ex.: 1300372959
470 * @param version (%u) Ex.: 1
472 #define SIPE_PUB_XML_FREE_BUSY \
473 "<publication categoryName=\"calendarData\" instance=\"%u\" container=\"1\" version=\"%d\" expireType=\"endpoint\">"\
474 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\"/>"\
475 "</publication>"\
476 "<publication categoryName=\"calendarData\" instance=\"%u\" container=\"100\" version=\"%d\" expireType=\"endpoint\">"\
477 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\"/>"\
478 "</publication>"\
479 "<publication categoryName=\"calendarData\" instance=\"%u\" container=\"200\" version=\"%d\" expireType=\"endpoint\">"\
480 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\" mailboxID=\"%s\">"\
481 "<freeBusy startTime=\"%s\" granularity=\"PT15M\" encodingVersion=\"1\">%s</freeBusy>"\
482 "</calendarData>"\
483 "</publication>"\
484 "<publication categoryName=\"calendarData\" instance=\"%u\" container=\"300\" version=\"%d\" expireType=\"endpoint\">"\
485 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\" mailboxID=\"%s\">"\
486 "<freeBusy startTime=\"%s\" granularity=\"PT15M\" encodingVersion=\"1\">%s</freeBusy>"\
487 "</calendarData>"\
488 "</publication>"\
489 "<publication categoryName=\"calendarData\" instance=\"%u\" container=\"400\" version=\"%d\" expireType=\"endpoint\">"\
490 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\" mailboxID=\"%s\">"\
491 "<freeBusy startTime=\"%s\" granularity=\"PT15M\" encodingVersion=\"1\">%s</freeBusy>"\
492 "</calendarData>"\
493 "</publication>"\
494 "<publication categoryName=\"calendarData\" instance=\"%u\" container=\"32000\" version=\"%d\" expireType=\"endpoint\">"\
495 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\"/>"\
496 "</publication>"
499 #define sipe_soap(method, body) \
500 "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
501 "<SOAP-ENV:Body>" \
502 "<m:" method " xmlns:m=\"http://schemas.microsoft.com/winrtc/2002/11/sip\">" \
503 body \
504 "</m:" method ">" \
505 "</SOAP-ENV:Body>" \
506 "</SOAP-ENV:Envelope>"
508 #define SIPE_SOAP_SET_CONTACT sipe_soap("setContact", \
509 "<m:displayName>%s</m:displayName>"\
510 "<m:groups>%s</m:groups>"\
511 "<m:subscribed>%s</m:subscribed>"\
512 "<m:URI>%s</m:URI>"\
513 "<m:externalURI />"\
514 "<m:deltaNum>%d</m:deltaNum>")
516 #define SIPE_SOAP_DEL_CONTACT sipe_soap("deleteContact", \
517 "<m:URI>%s</m:URI>"\
518 "<m:deltaNum>%d</m:deltaNum>")
520 #define SIPE_SOAP_ADD_GROUP sipe_soap("addGroup", \
521 "<m:name>%s</m:name>"\
522 "<m:externalURI />"\
523 "<m:deltaNum>%d</m:deltaNum>")
525 #define SIPE_SOAP_MOD_GROUP sipe_soap("modifyGroup", \
526 "<m:groupID>%d</m:groupID>"\
527 "<m:name>%s</m:name>"\
528 "<m:externalURI />"\
529 "<m:deltaNum>%d</m:deltaNum>")
531 #define SIPE_SOAP_DEL_GROUP sipe_soap("deleteGroup", \
532 "<m:groupID>%d</m:groupID>"\
533 "<m:deltaNum>%d</m:deltaNum>")
535 // first/mask arg is sip:user@domain.com
536 // second/rights arg is AA for allow, BD for deny
537 #define SIPE_SOAP_ALLOW_DENY sipe_soap("setACE", \
538 "<m:type>USER</m:type>"\
539 "<m:mask>%s</m:mask>"\
540 "<m:rights>%s</m:rights>"\
541 "<m:deltaNum>%d</m:deltaNum>")
544 * Calendar publication entry. 2005 systems.
546 * @param legacy_dn (%s) Ex.: /o=EXCHANGE/ou=BTUK02/cn=Recipients/cn=AHHBTT
547 * @param fb_start_time_str (%s) Ex.: 2009-12-06T17:15:00Z
548 * @param free_busy_base64 (%s) Ex.: AAAAAAAAAAAAAAAAA......
550 #define SIPE_SOAP_SET_PRESENCE_CALENDAR \
551 "<calendarInfo xmlns=\"http://schemas.microsoft.com/2002/09/sip/presence\" mailboxId=\"%s\" startTime=\"%s\" granularity=\"PT15M\">%s</calendarInfo>"
553 * Note publication entry. 2005 systems.
555 * @param note (%s) Ex.: Working from home
557 #define SIPE_SOAP_SET_PRESENCE_NOTE_XML "<note>%s</note>"
559 * Note's OOF publication entry. 2005 systems.
561 #define SIPE_SOAP_SET_PRESENCE_OOF_XML "<oof></oof>"
563 * States publication entry for User State. 2005 systems.
565 * @param avail (%d) Availability 2007-style. Ex.: 9500
566 * @param since_time_str (%s) Ex.: 2010-01-13T10:30:05Z
567 * @param device_id (%s) epid. Ex.: 4c77e6ec72
568 * @param activity_token (%s) Ex.: do-not-disturb
570 #define SIPE_SOAP_SET_PRESENCE_STATES \
571 "<states>"\
572 "<state avail=\"%d\" since=\"%s\" validWith=\"any-device\" deviceId=\"%s\" set=\"manual\" xsi:type=\"userState\">%s</state>"\
573 "</states>"
575 * Presentity publication entry. 2005 systems.
577 * @param uri (%s) SIP URI without 'sip:' prefix. Ex.: fox@atlanta.local
578 * @param aggr_availability (%d) Ex.: 300
579 * @param aggr_activity (%d) Ex.: 600
580 * @param host_name (%s) Uppercased. Ex.: ATLANTA
581 * @param note_xml_str (%s) XML string as SIPE_SOAP_SET_PRESENCE_NOTE_XML
582 * @param oof_xml_str (%s) XML string as SIPE_SOAP_SET_PRESENCE_OOF_XML
583 * @param states_xml_str (%s) XML string as SIPE_SOAP_SET_PRESENCE_STATES
584 * @param calendar_info_xml_str (%s) XML string as SIPE_SOAP_SET_PRESENCE_CALENDAR
585 * @param device_id (%s) epid. Ex.: 4c77e6ec72
586 * @param since_time_str (%s) Ex.: 2010-01-13T10:30:05Z
587 * @param since_time_str (%s) Ex.: 2010-01-13T10:30:05Z
588 * @param user_input (%s) active, idle
590 #define SIPE_SOAP_SET_PRESENCE sipe_soap("setPresence", \
591 "<m:presentity xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" m:uri=\"sip:%s\">"\
592 "<m:availability m:aggregate=\"%d\"/>"\
593 "<m:activity m:aggregate=\"%d\"/>"\
594 "<deviceName xmlns=\"http://schemas.microsoft.com/2002/09/sip/presence\" name=\"%s\"/>"\
595 "<rtc:devicedata xmlns:rtc=\"http://schemas.microsoft.com/winrtc/2002/11/sip\" namespace=\"rtcService\">"\
596 "<![CDATA[<caps><renders_gif/><renders_isf/></caps>]]></rtc:devicedata>"\
597 "<userInfo xmlns=\"http://schemas.microsoft.com/2002/09/sip/presence\">"\
598 "%s%s" \
599 "%s" \
600 "</userInfo>"\
601 "%s" \
602 "<device xmlns=\"http://schemas.microsoft.com/2002/09/sip/presence\" deviceId=\"%s\" since=\"%s\" >"\
603 "<userInput since=\"%s\" >%s</userInput>"\
604 "</device>"\
605 "</m:presentity>")
607 #define SIPE_SOAP_SEARCH_CONTACT \
608 "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
609 "<SOAP-ENV:Body>" \
610 "<m:directorySearch xmlns:m=\"http://schemas.microsoft.com/winrtc/2002/11/sip\">" \
611 "<m:filter m:href=\"#searchArray\"/>"\
612 "<m:maxResults>%d</m:maxResults>"\
613 "</m:directorySearch>"\
614 "<m:Array xmlns:m=\"http://schemas.microsoft.com/winrtc/2002/11/sip\" m:id=\"searchArray\">"\
615 "%s"\
616 "</m:Array>"\
617 "</SOAP-ENV:Body>"\
618 "</SOAP-ENV:Envelope>"
620 #define SIPE_SOAP_SEARCH_ROW "<m:row m:attrib=\"%s\" m:value=\"%s\"/>"