6 * Copyright (C) 2009 SIPE Project <http://sipe.sourceforge.net/>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 * Interface dependencies:
30 /* Forward declarations */
31 struct sipe_account_data
;
33 /* Helper macros to iterate over session list in a SIP account */
34 #define SIPE_SESSION_FOREACH { \
35 GSList *entry = sip->sessions; \
37 struct sip_session *session = entry->data; \
39 #define SIPE_SESSION_FOREACH_END }}
41 /** Correspond to multi-party conversation */
43 gchar
*with
; /* For IM sessions only (not multi-party) . A URI.*/
44 /** key is user (URI) */
46 /** Link to purple chat or IM */
47 PurpleConversation
*conv
;
48 GSList
*outgoing_message_queue
;
49 /** Key is <Call-ID><CSeq><METHOD><To> */
50 GHashTable
*unconfirmed_messages
;
53 * Multiparty conversation related fields
55 gboolean is_multiparty
;
58 /** purple indexes chats by names */
60 /** Human readable chat name */
62 /** Call-Id identifying the conversation */
63 gchar
*callid
; /* For multiparty conversations */
64 /** Roster Manager URI */
65 gchar
*roster_manager
;
67 gboolean is_voting_in_progress
;
68 GSList
*pending_invite_queue
;
71 * Conference related fields
78 struct sip_dialog
*focus_dialog
;
79 /** Key is Message-Id */
80 GHashTable
*conf_unconfirmed_messages
;
84 * An item in outgoing message queue.
86 * Messages are put in the queue until a response to initial INVITE is received
87 * from remote dialog participant.
89 struct queued_message
{
90 /** Body of the message. */
93 * Content type of message body, e.g. text/plain for chat messages,
94 * text/x-msmsgsinvite for filetransfer initialization. Setting this to NULL
95 * means default value text/plain.
100 /** Frees queued_message
103 sipe_free_queued_message(struct queued_message
*message
);
106 * Add a new chat session
108 * @param sip (in) SIP account data. May be NULL
110 * @return pointer to new session
113 sipe_session_add_chat(struct sipe_account_data
*sip
);
116 * Find chat session by Call ID
118 * @param sip (in) SIP account data. May be NULL
119 * @param callid (in) Call ID. May be NULL
121 * @return pointer to session or NULL
124 sipe_session_find_chat_by_callid(struct sipe_account_data
*sip
,
125 const gchar
*callid
);
128 * Find or add new chat session by Call ID
130 * @param sip (in) SIP account data
131 * @param callid (in) Call ID
133 * @return pointer to session
136 sipe_session_find_or_add_chat_by_callid(struct sipe_account_data
*sip
,
137 const gchar
*callid
);
140 * Find chat session by ID
142 * @param sip (in) SIP account data. May be NULL
143 * @param id (in) Chat ID
145 * @return pointer to session or NULL
148 sipe_session_find_chat_by_id(struct sipe_account_data
*sip
, int id
);
151 * Find chat session by name
153 * @param sip (in) SIP account data. May be NULL
154 * @param name (in) Chat name. May be NULL
156 * @return pointer to session or NULL
159 sipe_session_find_chat_by_title(struct sipe_account_data
*sip
,
163 * Find Conference session
165 * @param sip (in) SIP account data. May be NULL
166 * @param focus_uri (in) URI of conference focus. May be NULL
168 * @return pointer to session or NULL
171 sipe_session_find_conference(struct sipe_account_data
*sip
,
172 const gchar
*focus_uri
);
177 * @param sip (in) SIP account data. May be NULL
178 * @param who (in) remote partner. May be NULL
180 * @return pointer to session or NULL
183 sipe_session_find_im(struct sipe_account_data
*sip
, const gchar
*who
);
186 * Find or add new IM session
188 * @param sip (in) SIP account data
189 * @param who (in) remote partner
191 * @return pointer to session
194 sipe_session_find_or_add_im(struct sipe_account_data
*sip
,
198 * Remove a session from a SIP account
200 * @param sip (in) SIP account data
201 * @param session (in) pointer to session
204 sipe_session_remove(struct sipe_account_data
*sip
,
205 struct sip_session
*session
);
208 * Remove all sessions from a SIP account
210 * @param sip (in) SIP account data
213 sipe_session_remove_all(struct sipe_account_data
*sip
);
216 * Add a message to outgoing queue.
218 * @param session (in) SIP session
219 * @param body (in) message to send
220 * @param content_type (in) content type of the message body
223 sipe_session_enqueue_message(struct sip_session
*session
,
224 const gchar
*body
, const gchar
*content_type
);
227 * Removes and deallocates the first item in outgoing message queue.
229 * @param session (in) SIP session
231 * @return pointer to new message queue head
234 sipe_session_dequeue_message(struct sip_session
*session
);