6 * Copyright (C) 2008 Novell, Inc.
7 * Copyright (C) 2007 Anibal Avelar <avelar@gmail.com>
8 * Copyright (C) 2005 Thomas Butter <butter@uni-mannheim.de>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #ifndef _PIDGIN_SIPE_H
26 #define _PIDGIN_SIPE_H
36 #include "circbuffer.h"
48 #define SIPE_UNUSED_PARAMETER __attribute__((unused))
50 #define SIMPLE_BUF_INC 4096
52 #define SIPE_TYPING_RECV_TIMEOUT 6
53 #define SIPE_TYPING_SEND_TIMEOUT 4
56 /** Activity (token and description) 2007 */
59 SIPE_ACTIVITY_UNSET
= 0,
61 SIPE_ACTIVITY_INACTIVE
,
63 SIPE_ACTIVITY_BUSYIDLE
,
68 SIPE_ACTIVITY_OFFLINE
,
69 SIPE_ACTIVITY_ON_PHONE
,
70 SIPE_ACTIVITY_IN_CONF
,
71 SIPE_ACTIVITY_IN_MEETING
,
73 SIPE_ACTIVITY_URGENT_ONLY
,
74 SIPE_ACTIVITY_NUM_TYPES
80 gchar
*meeting_subject
;
81 gchar
*meeting_location
;
82 /* Sipe internal format for Note is HTML.
83 * All incoming plain text should be html-escaped
84 * for example by g_markup_escape_text()
89 /* Calendar related fields */
90 gchar
*cal_start_time
;
92 gchar
*cal_free_busy_base64
;
94 /* for 2005 systems */
96 time_t user_avail_since
;
97 time_t activity_since
;
98 const char *last_non_cal_status_id
;
99 gchar
*last_non_cal_activity
;
101 struct sipe_cal_working_hours
*cal_working_hours
;
105 /** flag to control sending 'context' element in 2007 subscriptions */
111 SipSecContext gssapi_context
;
126 } sipe_transport_type
;
128 struct sipe_service_data
{
130 const char *transport
;
131 sipe_transport_type type
;
134 /** MS-PRES publication */
135 struct sipe_publication
{
140 /** for 'state' category */
142 /** for 'state:calendarState' category */
143 char *cal_event_hash
;
144 /** for 'note' category */
146 /** for 'calendarData' category; 300(Team) container */
147 char *working_hours_xml_str
;
149 char *free_busy_base64
;
152 /** MS-PRES container */
153 struct sipe_container
{
158 /** MS-PRES container member */
159 struct sipe_container_member
{
160 /** user, domain, sameEnterprise, federated, publicCloud; everyone */
165 struct sipe_account_data
{
166 PurpleConnection
*gc
;
173 gchar
*focus_factory_uri
;
174 /** Allowed server events to subscribe. From register OK response. */
175 GSList
*allow_events
;
176 PurpleDnsQueryData
*query_data
;
177 PurpleSrvQueryData
*srv_query_data
;
178 const struct sipe_service_data
*service_data
;
179 PurpleNetworkListenData
*listen_data
;
182 time_t last_keepalive
;
183 int registerstatus
; /* 0 nothing, 1 first registration send, 2 auth received, 3 registered */
184 struct sip_auth registrar
;
185 struct sip_auth proxy
;
186 struct sip_csta
*csta
; /* For RCC - Remote Call Control */
187 gboolean reregister_set
; /* whether reregister timer set */
188 gboolean reauthenticate_set
; /* whether reauthenticate timer set */
189 gboolean subscribed
; /* whether subscribed to events, except buddies presence */
190 gboolean subscribed_buddies
; /* whether subscribed to buddies presence */
191 gboolean access_level_set
; /* whether basic access level set */
192 gboolean initial_state_published
; /* whether we published our initial state */
193 GSList
*our_publication_keys
; /* [MS-PRES] */
194 GHashTable
*our_publications
; /* [MS-PRES] */
195 GHashTable
*user_state_publications
; /* [MS-PRES] */
196 GHashTable
*subscriptions
;
202 int presence_method_version
;
203 time_t do_not_publish
[SIPE_ACTIVITY_NUM_TYPES
];
205 gboolean is_oof_note
;
210 gchar
*server_version
;
211 gboolean ocs2007
; /*if there is support for batched category subscription [SIP-PRES]*/
212 gboolean batched_support
; /*if there is support for batched subscription*/
213 GSList
*containers
; /* MS-PRES containers */
216 guint keepalive_timeout
;
219 PurpleAccount
*account
;
220 PurpleCircBuffer
*txbuf
;
223 GSList
*transactions
;
227 sipe_transport_type transport
;
228 gboolean auto_transport
;
229 PurpleSslConnection
*gsc
;
230 struct sockaddr
*serveraddr
;
232 int realport
; /* port and hostname from SRV record */
233 gboolean processing_input
;
234 struct sipe_ews
*ews
;
236 /** 2005 Custom XML piece.
237 * Possibly set by other point of presence or just other client at earlier time.
238 * It should be preserved/modified, not overwritten. This implies subscription
240 * This XML keeps OC2005:
248 struct sip_connection
{
256 struct sipe_auth_job
{
258 struct sipe_account_data
* sip
;
263 typedef gboolean (*TransCallback
) (struct sipe_account_data
*, struct sipmsg
*, struct transaction
*);
265 struct transaction_payload
{
266 GDestroyNotify destroy
;
273 int transport
; /* 0 = tcp, 1 = udp */
275 /** Not yet perfect, but surely better then plain CSeq
276 * Format is: <Call-ID><CSeq>
277 * (RFC3261 17.2.3 for matching server transactions: Request-URI, To tag, From tag, Call-ID, CSeq, and top Via)
281 TransCallback callback
;
282 struct transaction_payload
*payload
;
285 typedef void (*Action
) (struct sipe_account_data
*, void *);
288 * Do schedule action for execution in the future.
289 * Non repetitive execution.
291 * @param name of action (will be copied)
292 * @param timeout in seconds
293 * @param action callback function
294 * @param destroy payload destroy function
296 * @param payload callback data (can be NULL, otherwise caller must allocate memory)
299 sipe_schedule_action(const gchar
*name
,
302 GDestroyNotify destroy
,
303 struct sipe_account_data
*sip
,
309 PurpleGroup
*purple_group
;
312 struct group_user_context
{
317 GSList
* slist_insert_unique_sorted(GSList
*list
, gpointer data
, GCompareFunc func
);
319 GList
*sipe_actions(PurplePlugin
*plugin
, gpointer context
);
321 gboolean
purple_init_plugin(PurplePlugin
*plugin
);
324 * Publishes self status
325 * based on own calendar information,
326 * our Calendar information - FreeBusy, WorkingHours,
332 publish_calendar_status_self(struct sipe_account_data
*sip
);
338 send_presence_soap(struct sipe_account_data
*sip
,
339 gboolean do_publish_calendar
);
342 * THE BIG SPLIT - temporary interfaces
344 * Previously private functions in sipe.c that are
345 * - waiting to be factored out to an appropriate module
346 * - are needed by the already created new modules
351 * Since SIP (RFC3261) is extensible by its design,
352 * and MS specs prove just that (they all are defined as SIP extensions),
353 * it make sense to split functionality by extension (or close extension group).
354 * For example: conference, presence (MS-PRES), etc.
356 * This way our code will not be monolithic, but potentially _reusable_. May be
357 * a top of other SIP core, and/or other front-end (Telepathy framework?).
359 /* Forward declarations */
363 /* SIP send module? */
365 send_sip_request(PurpleConnection
*gc
, const gchar
*method
,
366 const gchar
*url
, const gchar
*to
, const gchar
*addheaders
,
367 const gchar
*body
, struct sip_dialog
*dialog
, TransCallback tc
);
369 send_sip_response(PurpleConnection
*gc
, struct sipmsg
*msg
, int code
,
370 const char *text
, const char *body
);
372 sipe_invite(struct sipe_account_data
*sip
, struct sip_session
*session
,
373 const gchar
*who
, const gchar
*msg_body
,
374 const gchar
*referred_by
, const gboolean is_triggered
);
376 gboolean
process_subscribe_response(struct sipe_account_data
*sip
,
378 struct transaction
*tc
);
381 sipe_invite_to_chat(struct sipe_account_data
*sip
,
382 struct sip_session
*session
,
384 /* Session module? */
386 sipe_present_message_undelivered_err(struct sipe_account_data
*sip
,
387 struct sip_session
*session
,
390 const gchar
*message
);
393 sipe_present_info(struct sipe_account_data
*sip
,
394 struct sip_session
*session
,
395 const gchar
*message
);
399 sipe_process_pending_invite_queue(struct sipe_account_data
*sip
,
400 struct sip_session
*session
);
402 /*** THE BIG SPLIT END ***/
404 #define SIPE_XML_DATE_PATTERN "%Y-%m-%dT%H:%M:%SZ"
406 #define SIPE_INVITE_TEXT "ms-text-format: text/plain; charset=UTF-8%s;ms-body=%s\r\n"
408 #define SIPE_SEND_TYPING \
409 "<?xml version=\"1.0\"?>"\
410 "<KeyboardActivity>"\
411 "<status status=\"type\" />"\
412 "</KeyboardActivity>"
415 * Publishes categories.
416 * @param uri (%s) Self URI. Ex.: sip:alice7@boston.local
417 * @param publications (%s) XML publications
419 #define SIPE_SEND_PRESENCE \
420 "<publish xmlns=\"http://schemas.microsoft.com/2006/09/sip/rich-presence\">"\
421 "<publications uri=\"%s\">"\
427 * Publishes 'device' category.
428 * @param instance (%u) Ex.: 1938468728
429 * @param version (%u) Ex.: 1
430 * @param endpointId (%s) Ex.: C707E38E-1E10-5413-94D9-ECAC260A0269
431 * @param uri (%s) Self URI. Ex.: sip:alice7@boston.local
432 * @param timezone (%s) Ex.: 00:00:00+01:00
433 * @param machineName (%s) Ex.: BOSTON-OCS07
435 #define SIPE_PUB_XML_DEVICE \
436 "<publication categoryName=\"device\" instance=\"%u\" container=\"2\" version=\"%u\" expireType=\"endpoint\">"\
437 "<device xmlns=\"http://schemas.microsoft.com/2006/09/sip/device\" endpointId=\"%s\">"\
438 "<capabilities preferred=\"false\" uri=\"%s\">"\
439 "<text capture=\"true\" render=\"true\" publish=\"false\"/>"\
440 "<gifInk capture=\"false\" render=\"true\" publish=\"false\"/>"\
441 "<isfInk capture=\"false\" render=\"true\" publish=\"false\"/>"\
443 "<timezone>%s</timezone>"\
444 "<machineName>%s</machineName>"\
449 * Publishes 'machineState' category.
450 * @param instance (%u) Ex.: 926460663
451 * @param version (%u) Ex.: 22
452 * @param availability (%d) Ex.: 3500
453 * @param instance (%u) Ex.: 926460663
454 * @param version (%u) Ex.: 22
455 * @param availability (%d) Ex.: 3500
457 #define SIPE_PUB_XML_STATE_MACHINE \
458 "<publication categoryName=\"state\" instance=\"%u\" container=\"2\" version=\"%u\" expireType=\"endpoint\">"\
459 "<state xmlns=\"http://schemas.microsoft.com/2006/09/sip/state\" manual=\"false\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"machineState\">"\
460 "<availability>%d</availability>"\
461 "<endpointLocation/>"\
464 "<publication categoryName=\"state\" instance=\"%u\" container=\"3\" version=\"%u\" expireType=\"endpoint\">"\
465 "<state xmlns=\"http://schemas.microsoft.com/2006/09/sip/state\" manual=\"false\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"machineState\">"\
466 "<availability>%d</availability>"\
467 "<endpointLocation/>"\
472 * Publishes 'userState' category.
473 * @param instance (%u) User. Ex.: 536870912
474 * @param version (%u) User Container 2. Ex.: 22
475 * @param availability (%d) User Container 2. Ex.: 15500
476 * @param instance (%u) User. Ex.: 536870912
477 * @param version (%u) User Container 3.Ex.: 22
478 * @param availability (%d) User Container 3. Ex.: 15500
480 #define SIPE_PUB_XML_STATE_USER \
481 "<publication categoryName=\"state\" instance=\"%u\" container=\"2\" version=\"%u\" expireType=\"static\">"\
482 "<state xmlns=\"http://schemas.microsoft.com/2006/09/sip/state\" manual=\"true\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"userState\">"\
483 "<availability>%d</availability>"\
484 "<endpointLocation/>"\
487 "<publication categoryName=\"state\" instance=\"%u\" container=\"3\" version=\"%u\" expireType=\"static\">"\
488 "<state xmlns=\"http://schemas.microsoft.com/2006/09/sip/state\" manual=\"true\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"userState\">"\
489 "<availability>%d</availability>"\
490 "<endpointLocation/>"\
495 * An availability XML entry for SIPE_PUB_XML_STATE_CALENDAR
496 * @param availability (%d) Ex.: 6500
498 #define SIPE_PUB_XML_STATE_CALENDAR_AVAIL \
499 "<availability>%d</availability>"
501 * An activity XML entry for SIPE_PUB_XML_STATE_CALENDAR
502 * @param token (%s) Ex.: in-a-meeting
503 * @param minAvailability_attr (%s) Ex.: minAvailability="6500"
504 * @param maxAvailability_attr (%s) Ex.: maxAvailability="8999" or none
506 #define SIPE_PUB_XML_STATE_CALENDAR_ACTIVITY \
507 "<activity token=\"%s\" %s %s></activity>"
509 * Publishes 'calendarState' category.
510 * @param instance (%u) Ex.: 1339299275
511 * @param version (%u) Ex.: 1
512 * @param uri (%s) Ex.: john@contoso.com
513 * @param start_time_str (%s) Ex.: 2008-01-11T19:00:00Z
514 * @param availability (%s) XML string as SIPE_PUB_XML_STATE_CALENDAR_AVAIL
515 * @param activity (%s) XML string as SIPE_PUB_XML_STATE_CALENDAR_ACTIVITY
516 * @param meeting_subject (%s) Ex.: Customer Meeting
517 * @param meeting_location (%s) Ex.: Conf Room 100
519 * @param instance (%u) Ex.: 1339299275
520 * @param version (%u) Ex.: 1
521 * @param uri (%s) Ex.: john@contoso.com
522 * @param start_time_str (%s) Ex.: 2008-01-11T19:00:00Z
523 * @param availability (%s) XML string as SIPE_PUB_XML_STATE_CALENDAR_AVAIL
524 * @param activity (%s) XML string as SIPE_PUB_XML_STATE_CALENDAR_ACTIVITY
525 * @param meeting_subject (%s) Ex.: Customer Meeting
526 * @param meeting_location (%s) Ex.: Conf Room 100
528 #define SIPE_PUB_XML_STATE_CALENDAR \
529 "<publication categoryName=\"state\" instance=\"%u\" container=\"2\" version=\"%u\" expireType=\"endpoint\">"\
530 "<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\">"\
533 "<endpointLocation/>"\
534 "<meetingSubject>%s</meetingSubject>"\
535 "<meetingLocation>%s</meetingLocation>"\
538 "<publication categoryName=\"state\" instance=\"%u\" container=\"3\" version=\"%u\" expireType=\"endpoint\">"\
539 "<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\">"\
542 "<endpointLocation/>"\
543 "<meetingSubject>%s</meetingSubject>"\
544 "<meetingLocation>%s</meetingLocation>"\
549 * Publishes to clear 'calendarState' category
550 * @param instance (%u) Ex.: 1251210982
551 * @param version (%u) Ex.: 1
553 #define SIPE_PUB_XML_STATE_CALENDAR_CLEAR \
554 "<publication categoryName=\"state\" instance=\"%u\" container=\"2\" version=\"%u\" expireType=\"endpoint\" expires=\"0\"/>"\
555 "<publication categoryName=\"state\" instance=\"%u\" container=\"3\" version=\"%u\" expireType=\"endpoint\" expires=\"0\"/>"
558 * Publishes to clear any category
559 * @param category_name (%s) Ex.: state
560 * @param instance (%u) Ex.: 536870912
561 * @param container (%u) Ex.: 3
562 * @param version (%u) Ex.: 1
563 * @param expireType (%s) Ex.: static
565 #define SIPE_PUB_XML_PUBLICATION_CLEAR \
566 "<publication categoryName=\"%s\" instance=\"%u\" container=\"%u\" version=\"%u\" expireType=\"%s\" expires=\"0\"/>"
569 * Publishes 'note' category.
570 * @param instance (%u) Ex.: 2135971629; 0 for personal
571 * @param container (%u) Ex.: 200
572 * @param version (%u) Ex.: 2
573 * @param type (%s) Ex.: personal or OOF
574 * @param startTime_attr (%s) Ex.: startTime="2008-01-11T19:00:00Z"
575 * @param endTime_attr (%s) Ex.: endTime="2008-01-15T19:00:00Z"
576 * @param body (%s) Ex.: In the office
578 #define SIPE_PUB_XML_NOTE \
579 "<publication categoryName=\"note\" instance=\"%u\" container=\"%u\" version=\"%d\" expireType=\"static\">"\
580 "<note xmlns=\"http://schemas.microsoft.com/2006/09/sip/note\">"\
581 "<body type=\"%s\" uri=\"\"%s%s>%s</body>"\
586 * Publishes 'calendarData' category's WorkingHours.
588 * @param version (%u) Ex.: 1
589 * @param email (%s) Ex.: alice@cosmo.local
590 * @param working_hours_xml_str (%s) Ex.: <WorkingHours xmlns=.....
592 * @param version (%u)
594 * @param version (%u)
596 * @param working_hours_xml_str (%s)
598 * @param version (%u)
600 * @param working_hours_xml_str (%s)
602 * @param version (%u)
604 * @param working_hours_xml_str (%s)
606 * @param version (%u)
608 #define SIPE_PUB_XML_WORKING_HOURS \
609 "<publication categoryName=\"calendarData\" instance=\"0\" container=\"1\" version=\"%d\" expireType=\"static\">"\
610 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\" mailboxID=\"%s\">%s"\
613 "<publication categoryName=\"calendarData\" instance=\"0\" container=\"100\" version=\"%d\" expireType=\"static\">"\
614 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\"/>"\
616 "<publication categoryName=\"calendarData\" instance=\"0\" container=\"200\" version=\"%d\" expireType=\"static\">"\
617 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\" mailboxID=\"%s\">%s"\
620 "<publication categoryName=\"calendarData\" instance=\"0\" container=\"300\" version=\"%d\" expireType=\"static\">"\
621 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\" mailboxID=\"%s\">%s"\
624 "<publication categoryName=\"calendarData\" instance=\"0\" container=\"400\" version=\"%d\" expireType=\"static\">"\
625 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\" mailboxID=\"%s\">%s"\
628 "<publication categoryName=\"calendarData\" instance=\"0\" container=\"32000\" version=\"%d\" expireType=\"static\">"\
629 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\"/>"\
633 * Publishes 'calendarData' category's FreeBusy.
635 * @param instance (%u) Ex.: 1300372959
636 * @param version (%u) Ex.: 1
638 * @param instance (%u) Ex.: 1300372959
639 * @param version (%u) Ex.: 1
641 * @param instance (%u) Ex.: 1300372959
642 * @param version (%u) Ex.: 1
643 * @param email (%s) Ex.: alice@cosmo.local
644 * @param fb_start_time_str (%s) Ex.: 2009-12-03T00:00:00Z
645 * @param free_busy_base64 (%s) Ex.: AAAAAAAAAAAAAAAAAAAAA.....
647 * @param instance (%u) Ex.: 1300372959
648 * @param version (%u) Ex.: 1
649 * @param email (%s) Ex.: alice@cosmo.local
650 * @param fb_start_time_str (%s) Ex.: 2009-12-03T00:00:00Z
651 * @param free_busy_base64 (%s) Ex.: AAAAAAAAAAAAAAAAAAAAA.....
653 * @param instance (%u) Ex.: 1300372959
654 * @param version (%u) Ex.: 1
655 * @param email (%s) Ex.: alice@cosmo.local
656 * @param fb_start_time_str (%s) Ex.: 2009-12-03T00:00:00Z
657 * @param free_busy_base64 (%s) Ex.: AAAAAAAAAAAAAAAAAAAAA.....
659 * @param instance (%u) Ex.: 1300372959
660 * @param version (%u) Ex.: 1
662 #define SIPE_PUB_XML_FREE_BUSY \
663 "<publication categoryName=\"calendarData\" instance=\"%u\" container=\"1\" version=\"%d\" expireType=\"endpoint\">"\
664 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\"/>"\
666 "<publication categoryName=\"calendarData\" instance=\"%u\" container=\"100\" version=\"%d\" expireType=\"endpoint\">"\
667 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\"/>"\
669 "<publication categoryName=\"calendarData\" instance=\"%u\" container=\"200\" version=\"%d\" expireType=\"endpoint\">"\
670 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\" mailboxID=\"%s\">"\
671 "<freeBusy startTime=\"%s\" granularity=\"PT15M\" encodingVersion=\"1\">%s</freeBusy>"\
674 "<publication categoryName=\"calendarData\" instance=\"%u\" container=\"300\" version=\"%d\" expireType=\"endpoint\">"\
675 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\" mailboxID=\"%s\">"\
676 "<freeBusy startTime=\"%s\" granularity=\"PT15M\" encodingVersion=\"1\">%s</freeBusy>"\
679 "<publication categoryName=\"calendarData\" instance=\"%u\" container=\"400\" version=\"%d\" expireType=\"endpoint\">"\
680 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\" mailboxID=\"%s\">"\
681 "<freeBusy startTime=\"%s\" granularity=\"PT15M\" encodingVersion=\"1\">%s</freeBusy>"\
684 "<publication categoryName=\"calendarData\" instance=\"%u\" container=\"32000\" version=\"%d\" expireType=\"endpoint\">"\
685 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\"/>"\
689 #define sipe_soap(method, body) \
690 "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
692 "<m:" method " xmlns:m=\"http://schemas.microsoft.com/winrtc/2002/11/sip\">" \
696 "</SOAP-ENV:Envelope>"
698 #define SIPE_SOAP_SET_CONTACT sipe_soap("setContact", \
699 "<m:displayName>%s</m:displayName>"\
700 "<m:groups>%s</m:groups>"\
701 "<m:subscribed>%s</m:subscribed>"\
704 "<m:deltaNum>%d</m:deltaNum>")
706 #define SIPE_SOAP_DEL_CONTACT sipe_soap("deleteContact", \
708 "<m:deltaNum>%d</m:deltaNum>")
710 #define SIPE_SOAP_ADD_GROUP sipe_soap("addGroup", \
711 "<m:name>%s</m:name>"\
713 "<m:deltaNum>%d</m:deltaNum>")
715 #define SIPE_SOAP_MOD_GROUP sipe_soap("modifyGroup", \
716 "<m:groupID>%d</m:groupID>"\
717 "<m:name>%s</m:name>"\
719 "<m:deltaNum>%d</m:deltaNum>")
721 #define SIPE_SOAP_DEL_GROUP sipe_soap("deleteGroup", \
722 "<m:groupID>%d</m:groupID>"\
723 "<m:deltaNum>%d</m:deltaNum>")
725 // first/mask arg is sip:user@domain.com
726 // second/rights arg is AA for allow, BD for deny
727 #define SIPE_SOAP_ALLOW_DENY sipe_soap("setACE", \
728 "<m:type>USER</m:type>"\
729 "<m:mask>%s</m:mask>"\
730 "<m:rights>%s</m:rights>"\
731 "<m:deltaNum>%d</m:deltaNum>")
734 * Calendar publication entry. 2005 systems.
736 * @param legacy_dn (%s) Ex.: /o=EXCHANGE/ou=BTUK02/cn=Recipients/cn=AHHBTT
737 * @param fb_start_time_str (%s) Ex.: 2009-12-06T17:15:00Z
738 * @param free_busy_base64 (%s) Ex.: AAAAAAAAAAAAAAAAA......
740 #define SIPE_SOAP_SET_PRESENCE_CALENDAR \
741 "<calendarInfo xmlns=\"http://schemas.microsoft.com/2002/09/sip/presence\" mailboxId=\"%s\" startTime=\"%s\" granularity=\"PT15M\">%s</calendarInfo>"
743 * Note publication entry. 2005 systems.
745 * @param note (%s) Ex.: Working from home
747 #define SIPE_SOAP_SET_PRESENCE_NOTE_XML "<note>%s</note>"
749 * Note's OOF publication entry. 2005 systems.
751 #define SIPE_SOAP_SET_PRESENCE_OOF_XML "<oof></oof>"
753 * States publication entry for User State. 2005 systems.
755 * @param avail (%d) Availability 2007-style. Ex.: 9500
756 * @param since_time_str (%s) Ex.: 2010-01-13T10:30:05Z
757 * @param device_id (%s) epid. Ex.: 4c77e6ec72
758 * @param activity_token (%s) Ex.: do-not-disturb
760 #define SIPE_SOAP_SET_PRESENCE_STATES \
762 "<state avail=\"%d\" since=\"%s\" validWith=\"any-device\" deviceId=\"%s\" set=\"manual\" xsi:type=\"userState\">%s</state>"\
765 * Presentity publication entry. 2005 systems.
767 * @param uri (%s) SIP URI without 'sip:' prefix. Ex.: fox@atlanta.local
768 * @param aggr_availability (%d) Ex.: 300
769 * @param aggr_activity (%d) Ex.: 600
770 * @param host_name (%s) Uppercased. Ex.: ATLANTA
771 * @param note_xml_str (%s) XML string as SIPE_SOAP_SET_PRESENCE_NOTE_XML
772 * @param oof_xml_str (%s) XML string as SIPE_SOAP_SET_PRESENCE_OOF_XML
773 * @param states_xml_str (%s) XML string as SIPE_SOAP_SET_PRESENCE_STATES
774 * @param calendar_info_xml_str (%s) XML string as SIPE_SOAP_SET_PRESENCE_CALENDAR
775 * @param device_id (%s) epid. Ex.: 4c77e6ec72
776 * @param since_time_str (%s) Ex.: 2010-01-13T10:30:05Z
777 * @param since_time_str (%s) Ex.: 2010-01-13T10:30:05Z
778 * @param user_input (%s) active, idle
780 #define SIPE_SOAP_SET_PRESENCE sipe_soap("setPresence", \
781 "<m:presentity xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" m:uri=\"sip:%s\">"\
782 "<m:availability m:aggregate=\"%d\"/>"\
783 "<m:activity m:aggregate=\"%d\"/>"\
784 "<deviceName xmlns=\"http://schemas.microsoft.com/2002/09/sip/presence\" name=\"%s\"/>"\
785 "<rtc:devicedata xmlns:rtc=\"http://schemas.microsoft.com/winrtc/2002/11/sip\" namespace=\"rtcService\">"\
786 "<![CDATA[<caps><renders_gif/><renders_isf/></caps>]]></rtc:devicedata>"\
787 "<userInfo xmlns=\"http://schemas.microsoft.com/2002/09/sip/presence\">"\
792 "<device xmlns=\"http://schemas.microsoft.com/2002/09/sip/presence\" deviceId=\"%s\" since=\"%s\" >"\
793 "<userInput since=\"%s\" >%s</userInput>"\
797 #define SIPE_SOAP_SEARCH_CONTACT \
798 "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
800 "<m:directorySearch xmlns:m=\"http://schemas.microsoft.com/winrtc/2002/11/sip\">" \
801 "<m:filter m:href=\"#searchArray\"/>"\
802 "<m:maxResults>%d</m:maxResults>"\
803 "</m:directorySearch>"\
804 "<m:Array xmlns:m=\"http://schemas.microsoft.com/winrtc/2002/11/sip\" m:id=\"searchArray\">"\
808 "</SOAP-ENV:Envelope>"
810 #define SIPE_SOAP_SEARCH_ROW "<m:row m:attrib=\"%s\" m:value=\"%s\"/>"
812 #endif /* _PIDGIN_SIPE_H */