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
;
85 /* Calendar related fields */
86 gchar
*cal_start_time
;
88 gchar
*cal_free_busy_base64
;
90 /* for 2005 systems */
92 time_t user_avail_since
;
93 time_t activity_since
;
94 const char *last_non_cal_status_id
;
95 gchar
*last_non_cal_activity
;
97 struct sipe_cal_working_hours
*cal_working_hours
;
101 /** flag to control sending 'context' element in 2007 subscriptions */
107 SipSecContext gssapi_context
;
122 } sipe_transport_type
;
124 struct sipe_service_data
{
126 const char *transport
;
127 sipe_transport_type type
;
130 /** MS-PRES publication */
131 struct sipe_publication
{
136 /** for 'state' category */
138 /** for 'state:calendarState' category */
139 char *cal_event_hash
;
140 /** for 'note' category */
142 /** for 'calendarData' category; 300(Team) container */
143 char *working_hours_xml_str
;
145 char *free_busy_base64
;
148 /** MS-PRES container */
149 struct sipe_container
{
154 /** MS-PRES container member */
155 struct sipe_container_member
{
156 /** user, domain, sameEnterprise, federated, publicCloud; everyone */
161 struct sipe_account_data
{
162 PurpleConnection
*gc
;
169 gchar
*focus_factory_uri
;
170 /** Allowed server events to subscribe. From register OK response. */
171 GSList
*allow_events
;
172 PurpleDnsQueryData
*query_data
;
173 PurpleSrvQueryData
*srv_query_data
;
174 const struct sipe_service_data
*service_data
;
175 PurpleNetworkListenData
*listen_data
;
178 time_t last_keepalive
;
179 int registerstatus
; /* 0 nothing, 1 first registration send, 2 auth received, 3 registered */
180 struct sip_auth registrar
;
181 struct sip_auth proxy
;
182 struct sip_csta
*csta
; /* For RCC - Remote Call Control */
183 gboolean reregister_set
; /* whether reregister timer set */
184 gboolean reauthenticate_set
; /* whether reauthenticate timer set */
185 gboolean subscribed
; /* whether subscribed to events, except buddies presence */
186 gboolean subscribed_buddies
; /* whether subscribed to buddies presence */
187 gboolean access_level_set
; /* whether basic access level set */
188 gboolean initial_state_published
; /* whether we published our initial state */
189 GSList
*our_publication_keys
; /* [MS-PRES] */
190 GHashTable
*our_publications
; /* [MS-PRES] */
191 GHashTable
*user_state_publications
; /* [MS-PRES] */
192 GHashTable
*subscriptions
;
198 int presence_method_version
;
199 time_t do_not_publish
[SIPE_ACTIVITY_NUM_TYPES
];
205 gchar
*server_version
;
206 gboolean ocs2007
; /*if there is support for batched category subscription [SIP-PRES]*/
207 gboolean batched_support
; /*if there is support for batched subscription*/
208 GSList
*containers
; /* MS-PRES containers */
211 guint keepalive_timeout
;
214 PurpleAccount
*account
;
215 PurpleCircBuffer
*txbuf
;
218 GSList
*transactions
;
222 sipe_transport_type transport
;
223 gboolean auto_transport
;
224 PurpleSslConnection
*gsc
;
225 struct sockaddr
*serveraddr
;
227 int realport
; /* port and hostname from SRV record */
228 gboolean processing_input
;
229 struct sipe_ews
*ews
;
231 /** 2005 Custom XML piece.
232 * Possibly set by other point of presence or just other client at earlier time.
233 * It should be preserved/modified, not overwritten. This implies subscription
235 * This XML keeps OC2005:
243 struct sip_connection
{
251 struct sipe_auth_job
{
253 struct sipe_account_data
* sip
;
258 typedef gboolean (*TransCallback
) (struct sipe_account_data
*, struct sipmsg
*, struct transaction
*);
260 struct transaction_payload
{
261 GDestroyNotify destroy
;
268 int transport
; /* 0 = tcp, 1 = udp */
270 /** Not yet perfect, but surely better then plain CSeq
271 * Format is: <Call-ID><CSeq>
272 * (RFC3261 17.2.3 for matching server transactions: Request-URI, To tag, From tag, Call-ID, CSeq, and top Via)
276 TransCallback callback
;
277 struct transaction_payload
*payload
;
280 typedef void (*Action
) (struct sipe_account_data
*, void *);
283 * Do schedule action for execution in the future.
284 * Non repetitive execution.
286 * @param name of action (will be copied)
287 * @param timeout in seconds
288 * @param action callback function
289 * @param destroy payload destroy function
291 * @param payload callback data (can be NULL, otherwise caller must allocate memory)
294 sipe_schedule_action(const gchar
*name
,
297 GDestroyNotify destroy
,
298 struct sipe_account_data
*sip
,
304 PurpleGroup
*purple_group
;
307 struct group_user_context
{
312 GSList
* slist_insert_unique_sorted(GSList
*list
, gpointer data
, GCompareFunc func
);
314 GList
*sipe_actions(PurplePlugin
*plugin
, gpointer context
);
316 gboolean
purple_init_plugin(PurplePlugin
*plugin
);
319 * Publishes self status
320 * based on own calendar information,
321 * our Calendar information - FreeBusy, WorkingHours,
327 publish_calendar_status_self(struct sipe_account_data
*sip
);
333 send_presence_soap(struct sipe_account_data
*sip
,
334 gboolean do_publish_calendar
);
337 * THE BIG SPLIT - temporary interfaces
339 * Previously private functions in sipe.c that are
340 * - waiting to be factored out to an appropriate module
341 * - are needed by the already created new modules
346 * Since SIP (RFC3261) is extensible by its design,
347 * and MS specs prove just that (they all are defined as SIP extensions),
348 * it make sense to split functionality by extension (or close extension group).
349 * For example: conference, presence (MS-PRES), etc.
351 * This way our code will not be monolithic, but potentially _reusable_. May be
352 * a top of other SIP core, and/or other front-end (Telepathy framework?).
354 /* Forward declarations */
358 /* SIP send module? */
360 send_sip_request(PurpleConnection
*gc
, const gchar
*method
,
361 const gchar
*url
, const gchar
*to
, const gchar
*addheaders
,
362 const gchar
*body
, struct sip_dialog
*dialog
, TransCallback tc
);
364 send_sip_response(PurpleConnection
*gc
, struct sipmsg
*msg
, int code
,
365 const char *text
, const char *body
);
367 sipe_invite(struct sipe_account_data
*sip
, struct sip_session
*session
,
368 const gchar
*who
, const gchar
*msg_body
,
369 const gchar
*referred_by
, const gboolean is_triggered
);
371 gboolean
process_subscribe_response(struct sipe_account_data
*sip
,
373 struct transaction
*tc
);
376 sipe_invite_to_chat(struct sipe_account_data
*sip
,
377 struct sip_session
*session
,
379 /* Session module? */
381 sipe_present_message_undelivered_err(struct sipe_account_data
*sip
,
382 struct sip_session
*session
,
385 const gchar
*message
);
388 sipe_present_info(struct sipe_account_data
*sip
,
389 struct sip_session
*session
,
390 const gchar
*message
);
394 sipe_process_pending_invite_queue(struct sipe_account_data
*sip
,
395 struct sip_session
*session
);
397 /*** THE BIG SPLIT END ***/
399 #define SIPE_XML_DATE_PATTERN "%Y-%m-%dT%H:%M:%SZ"
401 #define SIPE_INVITE_TEXT "ms-text-format: text/plain; charset=UTF-8%s;ms-body=%s\r\n"
403 #define SIPE_SEND_TYPING \
404 "<?xml version=\"1.0\"?>"\
405 "<KeyboardActivity>"\
406 "<status status=\"type\" />"\
407 "</KeyboardActivity>"
410 * Publishes categories.
411 * @param uri (%s) Self URI. Ex.: sip:alice7@boston.local
412 * @param publications (%s) XML publications
414 #define SIPE_SEND_PRESENCE \
415 "<publish xmlns=\"http://schemas.microsoft.com/2006/09/sip/rich-presence\">"\
416 "<publications uri=\"%s\">"\
422 * Publishes 'device' category.
423 * @param instance (%u) Ex.: 1938468728
424 * @param version (%u) Ex.: 1
425 * @param endpointId (%s) Ex.: C707E38E-1E10-5413-94D9-ECAC260A0269
426 * @param uri (%s) Self URI. Ex.: sip:alice7@boston.local
427 * @param timezone (%s) Ex.: 00:00:00+01:00
428 * @param machineName (%s) Ex.: BOSTON-OCS07
430 #define SIPE_PUB_XML_DEVICE \
431 "<publication categoryName=\"device\" instance=\"%u\" container=\"2\" version=\"%u\" expireType=\"endpoint\">"\
432 "<device xmlns=\"http://schemas.microsoft.com/2006/09/sip/device\" endpointId=\"%s\">"\
433 "<capabilities preferred=\"false\" uri=\"%s\">"\
434 "<text capture=\"true\" render=\"true\" publish=\"false\"/>"\
435 "<gifInk capture=\"false\" render=\"true\" publish=\"false\"/>"\
436 "<isfInk capture=\"false\" render=\"true\" publish=\"false\"/>"\
438 "<timezone>%s</timezone>"\
439 "<machineName>%s</machineName>"\
444 * Publishes 'machineState' category.
445 * @param instance (%u) Ex.: 926460663
446 * @param version (%u) Ex.: 22
447 * @param availability (%d) Ex.: 3500
448 * @param instance (%u) Ex.: 926460663
449 * @param version (%u) Ex.: 22
450 * @param availability (%d) Ex.: 3500
452 #define SIPE_PUB_XML_STATE_MACHINE \
453 "<publication categoryName=\"state\" instance=\"%u\" container=\"2\" version=\"%u\" expireType=\"endpoint\">"\
454 "<state xmlns=\"http://schemas.microsoft.com/2006/09/sip/state\" manual=\"false\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"machineState\">"\
455 "<availability>%d</availability>"\
456 "<endpointLocation/>"\
459 "<publication categoryName=\"state\" instance=\"%u\" container=\"3\" version=\"%u\" expireType=\"endpoint\">"\
460 "<state xmlns=\"http://schemas.microsoft.com/2006/09/sip/state\" manual=\"false\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"machineState\">"\
461 "<availability>%d</availability>"\
462 "<endpointLocation/>"\
467 * Publishes 'userState' category.
468 * @param instance (%u) User. Ex.: 536870912
469 * @param version (%u) User Container 2. Ex.: 22
470 * @param availability (%d) User Container 2. Ex.: 15500
471 * @param instance (%u) User. Ex.: 536870912
472 * @param version (%u) User Container 3.Ex.: 22
473 * @param availability (%d) User Container 3. Ex.: 15500
475 #define SIPE_PUB_XML_STATE_USER \
476 "<publication categoryName=\"state\" instance=\"%u\" container=\"2\" version=\"%u\" expireType=\"static\">"\
477 "<state xmlns=\"http://schemas.microsoft.com/2006/09/sip/state\" manual=\"true\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"userState\">"\
478 "<availability>%d</availability>"\
479 "<endpointLocation/>"\
482 "<publication categoryName=\"state\" instance=\"%u\" container=\"3\" version=\"%u\" expireType=\"static\">"\
483 "<state xmlns=\"http://schemas.microsoft.com/2006/09/sip/state\" manual=\"true\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"userState\">"\
484 "<availability>%d</availability>"\
485 "<endpointLocation/>"\
490 * An availability XML entry for SIPE_PUB_XML_STATE_CALENDAR
491 * @param availability (%d) Ex.: 6500
493 #define SIPE_PUB_XML_STATE_CALENDAR_AVAIL \
494 "<availability>%d</availability>"
496 * An activity XML entry for SIPE_PUB_XML_STATE_CALENDAR
497 * @param token (%s) Ex.: in-a-meeting
498 * @param minAvailability_attr (%s) Ex.: minAvailability="6500"
499 * @param maxAvailability_attr (%s) Ex.: maxAvailability="8999" or none
501 #define SIPE_PUB_XML_STATE_CALENDAR_ACTIVITY \
502 "<activity token=\"%s\" %s %s></activity>"
504 * Publishes 'calendarState' category.
505 * @param instance (%u) Ex.: 1339299275
506 * @param version (%u) Ex.: 1
507 * @param uri (%s) Ex.: john@contoso.com
508 * @param start_time_str (%s) Ex.: 2008-01-11T19:00:00Z
509 * @param availability (%s) XML string as SIPE_PUB_XML_STATE_CALENDAR_AVAIL
510 * @param activity (%s) XML string as SIPE_PUB_XML_STATE_CALENDAR_ACTIVITY
511 * @param meeting_subject (%s) Ex.: Customer Meeting
512 * @param meeting_location (%s) Ex.: Conf Room 100
514 * @param instance (%u) Ex.: 1339299275
515 * @param version (%u) Ex.: 1
516 * @param uri (%s) Ex.: john@contoso.com
517 * @param start_time_str (%s) Ex.: 2008-01-11T19:00:00Z
518 * @param availability (%s) XML string as SIPE_PUB_XML_STATE_CALENDAR_AVAIL
519 * @param activity (%s) XML string as SIPE_PUB_XML_STATE_CALENDAR_ACTIVITY
520 * @param meeting_subject (%s) Ex.: Customer Meeting
521 * @param meeting_location (%s) Ex.: Conf Room 100
523 #define SIPE_PUB_XML_STATE_CALENDAR \
524 "<publication categoryName=\"state\" instance=\"%u\" container=\"2\" version=\"%u\" expireType=\"endpoint\">"\
525 "<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\">"\
528 "<endpointLocation/>"\
529 "<meetingSubject>%s</meetingSubject>"\
530 "<meetingLocation>%s</meetingLocation>"\
533 "<publication categoryName=\"state\" instance=\"%u\" container=\"3\" version=\"%u\" expireType=\"endpoint\">"\
534 "<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\">"\
537 "<endpointLocation/>"\
538 "<meetingSubject>%s</meetingSubject>"\
539 "<meetingLocation>%s</meetingLocation>"\
544 * Publishes to clear 'calendarState' category
545 * @param instance (%u) Ex.: 1251210982
546 * @param version (%u) Ex.: 1
548 #define SIPE_PUB_XML_STATE_CALENDAR_CLEAR \
549 "<publication categoryName=\"state\" instance=\"%u\" container=\"2\" version=\"%u\" expireType=\"endpoint\" expires=\"0\"/>"\
550 "<publication categoryName=\"state\" instance=\"%u\" container=\"3\" version=\"%u\" expireType=\"endpoint\" expires=\"0\"/>"
553 * Publishes to clear any category
554 * @param category_name (%s) Ex.: state
555 * @param instance (%u) Ex.: 536870912
556 * @param container (%u) Ex.: 3
557 * @param version (%u) Ex.: 1
558 * @param expireType (%s) Ex.: static
560 #define SIPE_PUB_XML_PUBLICATION_CLEAR \
561 "<publication categoryName=\"%s\" instance=\"%u\" container=\"%u\" version=\"%u\" expireType=\"%s\" expires=\"0\"/>"
564 * Publishes 'note' category.
565 * @param instance (%u) Ex.: 2135971629; 0 for personal
566 * @param version (%u) Ex.: 2
567 * @param type (%s) Ex.: personal or OOF
568 * @param body (%s) Ex.: In the office
570 * @param instance (%u) Ex.: 2135971629; 0 for personal
571 * @param version (%u) Ex.: 2
572 * @param type (%s) Ex.: personal or OOF
573 * @param body (%s) Ex.: In the office
575 * @param instance (%u) Ex.: 2135971629; 0 for personal
576 * @param version (%u) Ex.: 2
577 * @param type (%s) Ex.: personal or OOF
578 * @param body (%s) Ex.: In the office
580 #define SIPE_PUB_XML_NOTE \
581 "<publication categoryName=\"note\" instance=\"%u\" container=\"200\" version=\"%d\" expireType=\"static\">"\
582 "<note xmlns=\"http://schemas.microsoft.com/2006/09/sip/note\">"\
583 "<body type=\"%s\" uri=\"\">%s</body>"\
586 "<publication categoryName=\"note\" instance=\"%u\" container=\"300\" version=\"%d\" expireType=\"static\">"\
587 "<note xmlns=\"http://schemas.microsoft.com/2006/09/sip/note\">"\
588 "<body type=\"%s\" uri=\"\">%s</body>"\
591 "<publication categoryName=\"note\" instance=\"%u\" container=\"400\" version=\"%d\" expireType=\"static\">"\
592 "<note xmlns=\"http://schemas.microsoft.com/2006/09/sip/note\">"\
593 "<body type=\"%s\" uri=\"\">%s</body>"\
598 * Publishes 'calendarData' category's WorkingHours.
600 * @param version (%u) Ex.: 1
601 * @param email (%s) Ex.: alice@cosmo.local
602 * @param working_hours_xml_str (%s) Ex.: <WorkingHours xmlns=.....
604 * @param version (%u)
606 * @param version (%u)
608 * @param working_hours_xml_str (%s)
610 * @param version (%u)
612 * @param working_hours_xml_str (%s)
614 * @param version (%u)
616 * @param working_hours_xml_str (%s)
618 * @param version (%u)
620 #define SIPE_PUB_XML_WORKING_HOURS \
621 "<publication categoryName=\"calendarData\" instance=\"0\" container=\"1\" version=\"%d\" expireType=\"static\">"\
622 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\" mailboxID=\"%s\">%s"\
625 "<publication categoryName=\"calendarData\" instance=\"0\" container=\"100\" version=\"%d\" expireType=\"static\">"\
626 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\"/>"\
628 "<publication categoryName=\"calendarData\" instance=\"0\" container=\"200\" version=\"%d\" expireType=\"static\">"\
629 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\" mailboxID=\"%s\">%s"\
632 "<publication categoryName=\"calendarData\" instance=\"0\" container=\"300\" version=\"%d\" expireType=\"static\">"\
633 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\" mailboxID=\"%s\">%s"\
636 "<publication categoryName=\"calendarData\" instance=\"0\" container=\"400\" version=\"%d\" expireType=\"static\">"\
637 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\" mailboxID=\"%s\">%s"\
640 "<publication categoryName=\"calendarData\" instance=\"0\" container=\"32000\" version=\"%d\" expireType=\"static\">"\
641 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\"/>"\
645 * Publishes 'calendarData' category's FreeBusy.
647 * @param instance (%u) Ex.: 1300372959
648 * @param version (%u) Ex.: 1
650 * @param instance (%u) Ex.: 1300372959
651 * @param version (%u) Ex.: 1
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
661 * @param email (%s) Ex.: alice@cosmo.local
662 * @param fb_start_time_str (%s) Ex.: 2009-12-03T00:00:00Z
663 * @param free_busy_base64 (%s) Ex.: AAAAAAAAAAAAAAAAAAAAA.....
665 * @param instance (%u) Ex.: 1300372959
666 * @param version (%u) Ex.: 1
667 * @param email (%s) Ex.: alice@cosmo.local
668 * @param fb_start_time_str (%s) Ex.: 2009-12-03T00:00:00Z
669 * @param free_busy_base64 (%s) Ex.: AAAAAAAAAAAAAAAAAAAAA.....
671 * @param instance (%u) Ex.: 1300372959
672 * @param version (%u) Ex.: 1
674 #define SIPE_PUB_XML_FREE_BUSY \
675 "<publication categoryName=\"calendarData\" instance=\"%u\" container=\"1\" version=\"%d\" expireType=\"endpoint\">"\
676 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\"/>"\
678 "<publication categoryName=\"calendarData\" instance=\"%u\" container=\"100\" version=\"%d\" expireType=\"endpoint\">"\
679 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\"/>"\
681 "<publication categoryName=\"calendarData\" instance=\"%u\" container=\"200\" version=\"%d\" expireType=\"endpoint\">"\
682 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\" mailboxID=\"%s\">"\
683 "<freeBusy startTime=\"%s\" granularity=\"PT15M\" encodingVersion=\"1\">%s</freeBusy>"\
686 "<publication categoryName=\"calendarData\" instance=\"%u\" container=\"300\" version=\"%d\" expireType=\"endpoint\">"\
687 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\" mailboxID=\"%s\">"\
688 "<freeBusy startTime=\"%s\" granularity=\"PT15M\" encodingVersion=\"1\">%s</freeBusy>"\
691 "<publication categoryName=\"calendarData\" instance=\"%u\" container=\"400\" version=\"%d\" expireType=\"endpoint\">"\
692 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\" mailboxID=\"%s\">"\
693 "<freeBusy startTime=\"%s\" granularity=\"PT15M\" encodingVersion=\"1\">%s</freeBusy>"\
696 "<publication categoryName=\"calendarData\" instance=\"%u\" container=\"32000\" version=\"%d\" expireType=\"endpoint\">"\
697 "<calendarData xmlns=\"http://schemas.microsoft.com/2006/09/sip/calendarData\"/>"\
701 #define sipe_soap(method, body) \
702 "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
704 "<m:" method " xmlns:m=\"http://schemas.microsoft.com/winrtc/2002/11/sip\">" \
708 "</SOAP-ENV:Envelope>"
710 #define SIPE_SOAP_SET_CONTACT sipe_soap("setContact", \
711 "<m:displayName>%s</m:displayName>"\
712 "<m:groups>%s</m:groups>"\
713 "<m:subscribed>%s</m:subscribed>"\
716 "<m:deltaNum>%d</m:deltaNum>")
718 #define SIPE_SOAP_DEL_CONTACT sipe_soap("deleteContact", \
720 "<m:deltaNum>%d</m:deltaNum>")
722 #define SIPE_SOAP_ADD_GROUP sipe_soap("addGroup", \
723 "<m:name>%s</m:name>"\
725 "<m:deltaNum>%d</m:deltaNum>")
727 #define SIPE_SOAP_MOD_GROUP sipe_soap("modifyGroup", \
728 "<m:groupID>%d</m:groupID>"\
729 "<m:name>%s</m:name>"\
731 "<m:deltaNum>%d</m:deltaNum>")
733 #define SIPE_SOAP_DEL_GROUP sipe_soap("deleteGroup", \
734 "<m:groupID>%d</m:groupID>"\
735 "<m:deltaNum>%d</m:deltaNum>")
737 // first/mask arg is sip:user@domain.com
738 // second/rights arg is AA for allow, BD for deny
739 #define SIPE_SOAP_ALLOW_DENY sipe_soap("setACE", \
740 "<m:type>USER</m:type>"\
741 "<m:mask>%s</m:mask>"\
742 "<m:rights>%s</m:rights>"\
743 "<m:deltaNum>%d</m:deltaNum>")
746 * Calendar publication entry. 2005 systems.
748 * @param legacy_dn (%s) Ex.: /o=EXCHANGE/ou=BTUK02/cn=Recipients/cn=AHHBTT
749 * @param fb_start_time_str (%s) Ex.: 2009-12-06T17:15:00Z
750 * @param free_busy_base64 (%s) Ex.: AAAAAAAAAAAAAAAAA......
752 #define SIPE_SOAP_SET_PRESENCE_CALENDAR \
753 "<calendarInfo xmlns=\"http://schemas.microsoft.com/2002/09/sip/presence\" mailboxId=\"%s\" startTime=\"%s\" granularity=\"PT15M\">%s</calendarInfo>"
755 * Note publication entry. 2005 systems.
757 * @param note (%s) Ex.: Working from home
759 #define SIPE_SOAP_SET_PRESENCE_NOTE_XML "<note>%s</note>"
761 * Note's OOF publication entry. 2005 systems.
763 #define SIPE_SOAP_SET_PRESENCE_OOF_XML "<oof></oof>"
765 * States publication entry for User State. 2005 systems.
767 * @param avail (%d) Availability 2007-style. Ex.: 9500
768 * @param since_time_str (%s) Ex.: 2010-01-13T10:30:05Z
769 * @param device_id (%s) epid. Ex.: 4c77e6ec72
770 * @param activity_token (%s) Ex.: do-not-disturb
772 #define SIPE_SOAP_SET_PRESENCE_STATES \
774 "<state avail=\"%d\" since=\"%s\" validWith=\"any-device\" deviceId=\"%s\" set=\"manual\" xsi:type=\"userState\">%s</state>"\
777 * Presentity publication entry. 2005 systems.
779 * @param uri (%s) SIP URI without 'sip:' prefix. Ex.: fox@atlanta.local
780 * @param aggr_availability (%d) Ex.: 300
781 * @param aggr_activity (%d) Ex.: 600
782 * @param host_name (%s) Uppercased. Ex.: ATLANTA
783 * @param note_xml_str (%s) XML string as SIPE_SOAP_SET_PRESENCE_NOTE_XML
784 * @param oof_xml_str (%s) XML string as SIPE_SOAP_SET_PRESENCE_OOF_XML
785 * @param states_xml_str (%s) XML string as SIPE_SOAP_SET_PRESENCE_STATES
786 * @param calendar_info_xml_str (%s) XML string as SIPE_SOAP_SET_PRESENCE_CALENDAR
787 * @param device_id (%s) epid. Ex.: 4c77e6ec72
788 * @param since_time_str (%s) Ex.: 2010-01-13T10:30:05Z
789 * @param since_time_str (%s) Ex.: 2010-01-13T10:30:05Z
790 * @param user_input (%s) active, idle
792 #define SIPE_SOAP_SET_PRESENCE sipe_soap("setPresence", \
793 "<m:presentity xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" m:uri=\"sip:%s\">"\
794 "<m:availability m:aggregate=\"%d\"/>"\
795 "<m:activity m:aggregate=\"%d\"/>"\
796 "<deviceName xmlns=\"http://schemas.microsoft.com/2002/09/sip/presence\" name=\"%s\"/>"\
797 "<rtc:devicedata xmlns:rtc=\"http://schemas.microsoft.com/winrtc/2002/11/sip\" namespace=\"rtcService\">"\
798 "<![CDATA[<caps><renders_gif/><renders_isf/></caps>]]></rtc:devicedata>"\
799 "<userInfo xmlns=\"http://schemas.microsoft.com/2002/09/sip/presence\">"\
804 "<device xmlns=\"http://schemas.microsoft.com/2002/09/sip/presence\" deviceId=\"%s\" since=\"%s\" >"\
805 "<userInput since=\"%s\" >%s</userInput>"\
809 #define SIPE_SOAP_SEARCH_CONTACT \
810 "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
812 "<m:directorySearch xmlns:m=\"http://schemas.microsoft.com/winrtc/2002/11/sip\">" \
813 "<m:filter m:href=\"#searchArray\"/>"\
814 "<m:maxResults>%d</m:maxResults>"\
815 "</m:directorySearch>"\
816 "<m:Array xmlns:m=\"http://schemas.microsoft.com/winrtc/2002/11/sip\" m:id=\"searchArray\">"\
820 "</SOAP-ENV:Envelope>"
822 #define SIPE_SOAP_SEARCH_ROW "<m:row m:attrib=\"%s\" m:value=\"%s\"/>"
824 #endif /* _PIDGIN_SIPE_H */