6 * Copyright (C) 2009-11 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:
29 /* Forward declarations */
30 struct sipe_core_private
;
31 struct sipe_chat_session
;
33 /* Helper macros to iterate over session list in a SIP account */
34 #define SIPE_SESSION_FOREACH { \
35 GSList *entry = sipe_private->sessions; \
37 struct sip_session *session = entry->data; \
39 #define SIPE_SESSION_FOREACH_END }}
41 /** Correspond to multi-party conversation */
44 struct sipe_chat_session
*chat_session
;
46 gchar
*with
; /* For IM or call sessions only (not multi-party) . A URI.*/
47 /** key is user (URI) */
49 /** Key is <Call-ID><CSeq><METHOD><To> */
50 GHashTable
*unconfirmed_messages
;
51 GSList
*outgoing_message_queue
;
54 * Multiparty conversation related fields
56 /** Call-Id identifying the conversation */
57 gchar
*callid
; /* For multiparty conversations */
59 gboolean is_voting_in_progress
;
60 GSList
*pending_invite_queue
;
63 * Conference related fields
68 struct sip_dialog
*focus_dialog
;
69 /** Key is Message-Id */
70 GHashTable
*conf_unconfirmed_messages
;
71 gchar
*audio_video_entity
;
75 * Media call related fields
80 * Group Chat related fields
82 gboolean is_groupchat
;
86 * An item in outgoing message queue.
88 * Messages are put in the queue until a response to initial INVITE is received
89 * from remote dialog participant.
91 struct queued_message
{
92 /** Body of the message. */
95 * Content type of message body, e.g. text/plain for chat messages,
96 * text/x-msmsgsinvite for filetransfer initialization. Setting this to NULL
97 * means default value text/plain.
104 * Add a new chat session
106 * @param sipe_private (in) SIPE core data. May be NULL
107 * @param chat_session (in) non-NULL to rejoin existing chat
108 * @param multiparty (in) multiparty or conference
109 * @param id (in) new chat session identifier (ignored for rejoin).
111 * @return pointer to new session
114 sipe_session_add_chat(struct sipe_core_private
*sipe_private
,
115 struct sipe_chat_session
*chat_session
,
122 * Add a new media call session
124 * @param sipe_private (in) SIPE core data.
125 * @param who (in) remote partner.
127 * @return pointer to new session
130 sipe_session_add_call(struct sipe_core_private
*sipe_private
,
138 * @param sipe_private (in) SIPE core data. May be NULL
139 * @param chat_session (in) chat session data. May be NULL
141 * @return pointer to session or NULL
144 sipe_session_find_chat(struct sipe_core_private
*sipe_private
,
145 struct sipe_chat_session
*chat_session
);
148 * Find chat session by Call ID
150 * @param sipe_private (in) SIPE core data. May be NULL
151 * @param callid (in) Call ID. May be NULL
153 * @return pointer to session or NULL
156 sipe_session_find_chat_by_callid(struct sipe_core_private
*sipe_private
,
157 const gchar
*callid
);
160 * Find Conference session
162 * @param sipe_private (in) SIPE core data. May be NULL
163 * @param focus_uri (in) URI of conference focus. May be NULL
165 * @return pointer to session or NULL
168 sipe_session_find_conference(struct sipe_core_private
*sipe_private
,
169 const gchar
*focus_uri
);
174 * @param sipe_private (in) SIPE core data. May be NULL
175 * @param who (in) remote partner. May be NULL
177 * @return pointer to session or NULL
180 sipe_session_find_im(struct sipe_core_private
*sipe_private
,
184 * Find or add new IM session
186 * @param sipe_private (in) SIPE core data
187 * @param who (in) remote partner
189 * @return pointer to session
192 sipe_session_find_or_add_im(struct sipe_core_private
*sipe_private
,
196 * Find Chat by Call ID or IM session
198 * @param sipe_private (in) SIPE core data. May be NULL
199 * @param callid (in) Call ID. May be NULL
200 * @param who (in) remote partner. May be NULL
202 * @return pointer to session or NULL
205 sipe_session_find_chat_or_im(struct sipe_core_private
*sipe_private
,
212 * @param sipe_private (in) SIPE core data
213 * @param session (in) pointer to session
216 sipe_session_close(struct sipe_core_private
*sipe_private
,
217 struct sip_session
*session
);
220 * Remove a session from a SIP account
222 * @param sipe_private (in) SIPE core data
223 * @param session (in) pointer to session
226 sipe_session_remove(struct sipe_core_private
*sipe_private
,
227 struct sip_session
*session
);
230 * Add a message to outgoing queue.
232 * @param session (in) SIP session
233 * @param body (in) message to send
234 * @param content_type (in) content type of the message body
237 sipe_session_enqueue_message(struct sip_session
*session
,
238 const gchar
*body
, const gchar
*content_type
);
241 * Removes and deallocates the first item in outgoing message queue.
243 * @param session (in) SIP session
245 * @return pointer to new message queue head
248 sipe_session_dequeue_message(struct sip_session
*session
);