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
32 #include "circbuffer.h"
43 #define SIMPLE_BUF_INC 4096
45 #define SIPE_TYPING_RECV_TIMEOUT 6
46 #define SIPE_TYPING_SEND_TIMEOUT 4
48 struct sip_im_session
{
50 struct sip_dialog
* dialog
;
51 struct transaction
* outgoing_invite
;
53 GSList
*outgoing_message_queue
;
56 // dialog is the new term for call-leg
70 struct sip_dialog dialog
;
81 int type
; /* 1 = Digest / 2 = NTLM / 3 = Kerberos */
90 gchar
*digest_session_key
;
96 struct sipe_service_data
{
98 const char *transport
;
102 struct sipe_account_data
{
103 PurpleConnection
*gc
;
107 PurpleDnsQueryData
*query_data
;
108 PurpleSrvQueryData
*srv_query_data
;
109 const struct sipe_service_data
*service_data
;
110 PurpleNetworkListenData
*listen_data
;
115 int registerstatus
; /* 0 nothing, 1 first registration send, 2 auth received, 3 registered */
116 struct sip_auth registrar
;
117 struct sip_auth proxy
;
122 int presence_method_version
;
127 guint registertimeout
;
130 PurpleAccount
*account
;
131 PurpleCircBuffer
*txbuf
;
134 GSList
*transactions
;
141 PurpleSslConnection
*gsc
;
142 struct sockaddr_in serveraddr
;
145 int realport
; /* port and hostname from SRV record */
148 struct sip_connection
{
158 typedef gboolean (*TransCallback
) (struct sipe_account_data
*, struct sipmsg
*, struct transaction
*);
163 int transport
; /* 0 = tcp, 1 = udp */
167 TransCallback callback
;
174 PurpleGroup
*purple_group
;
177 struct group_user_context
{
182 #define SIPE_SEND_TYPING \
183 "<?xml version=\"1.0\"?>"\
184 "<KeyboardActivity>"\
185 "<status status=\"type\" />"\
186 "</KeyboardActivity>"
188 #define SIPE_SEND_PRESENCE \
189 "<publish xmlns=\"http://schemas.microsoft.com/2006/09/sip/rich-presence\">"\
190 "<publications uri=\"%s\">"\
191 "<publication categoryName=\"state\" instance=\"906391354\" container=\"2\" version=\"%d\" expireType=\"endpoint\">"\
192 "<state xmlns=\"http://schemas.microsoft.com/2006/09/sip/state\" manual=\"false\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"machineState\">"\
193 "<availability>%d</availability>"\
194 "<endpointLocation></endpointLocation>"\
197 "<publication categoryName=\"state\" instance=\"906391356\" container=\"0\" version=\"%d\" expireType=\"endpoint\">"\
198 "<state xmlns=\"http://schemas.microsoft.com/2006/09/sip/state\" manual=\"true\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"userState\">"\
199 "<availability>%d</availability>"\
200 "<endpointLocation></endpointLocation>"\
203 "<publication categoryName=\"note\" instance=\"0\" container=\"400\" version=\"%d\" expireType=\"static\">"\
204 "<note xmlns=\"http://schemas.microsoft.com/2006/09/sip/note\">"\
205 "<body type=\"personal\" uri=\"\">%s</body>"\
208 "<publication categoryName=\"note\" instance=\"0\" container=\"200\" version=\"%d\" expireType=\"static\">"\
209 "<note xmlns=\"http://schemas.microsoft.com/2006/09/sip/note\">"\
210 "<body type=\"personal\" uri=\"\">%s</body>"\
213 "<publication categoryName=\"note\" instance=\"0\" container=\"300\" version=\"%d\" expireType=\"static\">"\
214 "<note xmlns=\"http://schemas.microsoft.com/2006/09/sip/note\">"\
215 "<body type=\"personal\" uri=\"\">%s</body>"\
222 #define SIPE_SEND_CLEAR_PRESENCE \
223 "<publish xmlns=\"http://schemas.microsoft.com/2006/09/sip/rich-presence\">"\
224 "<publications uri=\"%s\">"\
225 "<publication categoryName=\"state\" instance=\"906391354\" container=\"2\" version=\"1\" expireType=\"static\" expires=\"0\" />"\
226 "<publication categoryName=\"state\" instance=\"906391356\" container=\"0\" version=\"1\" expireType=\"static\" expires=\"0\" />"\
227 "<publication categoryName=\"note\" instance=\"0\" container=\"300\" version=\"1\" expireType=\"static\" expires=\"0\" />"\
228 "<publication categoryName=\"note\" instance=\"0\" container=\"200\" version=\"1\" expireType=\"static\" expires=\"0\" />"\
229 "<publication categoryName=\"note\" instance=\"0\" container=\"400\" version=\"1\" expireType=\"static\" expires=\"0\" />"\
234 #define sipe_soap(method, body) \
235 "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
237 "<m:" method " xmlns:m=\"http://schemas.microsoft.com/winrtc/2002/11/sip\">" \
241 "</SOAP-ENV:Envelope>"
243 #define SIPE_SOAP_SET_CONTACT sipe_soap("setContact", \
244 "<m:displayName>%s</m:displayName>"\
245 "<m:groups>%d</m:groups>"\
246 "<m:subscribed>%s</m:subscribed>"\
249 "<m:deltaNum>%d</m:deltaNum>")
251 #define SIPE_SOAP_DEL_CONTACT sipe_soap("deleteContact", \
253 "<m:deltaNum>%d</m:deltaNum>")
255 #define SIPE_SOAP_ADD_GROUP sipe_soap("addGroup", \
256 "<m:name>%s</m:name>"\
258 "<m:deltaNum>%d</m:deltaNum>")
260 #define SIPE_SOAP_MOD_GROUP sipe_soap("modifyGroup", \
261 "<m:groupID>%d</m:groupID>"\
262 "<m:name>%s</m:name>"\
264 "<m:deltaNum>%d</m:deltaNum>")
266 #define SIPE_SOAP_DEL_GROUP sipe_soap("deleteGroup", \
267 "<m:groupID>%d</m:groupID>"\
268 "<m:deltaNum>%d</m:deltaNum>")
270 #define SIPE_SOAP_SET_PRESENCE sipe_soap("setPresence", \
271 "<m:presentity m:uri=\"%s\">"\
272 "<m:availability m:aggregate=\"%d\"/>"\
273 "<m:activity m:aggregate=\"%d\" m:note=\"%s\"/>"\
274 "<deviceName xmlns=\"http://schemas.microsoft.com/2002/09/sip/client/presence\" name=\"USER-DESKTOP\"/>"\
275 "<rtc:devicedata xmlns:rtc=\"http://schemas.microsoft.com/2002/09/sip/client/presence\" namespace=\"rtcService\">"\
276 "<![CDATA[<caps><renders_gif/><renders_isf/></caps>]]></rtc:devicedata>"\
279 #endif /* _PIDGIN_SIPE_H */