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
23 /* Helper macros to iterate over session list in a SIP account */
24 #define SIPE_SESSION_FOREACH { \
25 GSList *entry = sip->sessions; \
27 struct sip_session *session = entry->data; \
29 #define SIPE_SESSION_FOREACH_END }}
31 /** Correspond to multy-party conversation */
33 gchar
*with
; /* For IM sessions only (not multi-party) . A URI.*/
34 /** key is user (URI) */
36 /** Link to purple chat or IM */
37 PurpleConversation
*conv
;
38 GSList
*outgoing_message_queue
;
39 /** Key is <Call-ID><CSeq><METHOD><To> */
40 GHashTable
*unconfirmed_messages
;
43 * Miltiparty conversation related fields
45 gboolean is_multiparty
;
48 /** purple indexes chats by names */
50 /** Human readable chat name */
52 /** Call-Id identifying the conversation */
53 gchar
*callid
; /* For multiparty conversations */
54 /** Roster Manager URI */
55 gchar
*roster_manager
;
57 gboolean is_voting_in_progress
;
58 GSList
*pending_invite_queue
;
61 * Conference related fields
68 struct sip_dialog
*focus_dialog
;
69 /** Key is Message-Id */
70 GHashTable
*conf_unconfirmed_messages
;
74 * An item in outgoing message queue.
76 * Messages are put in the queue until a response to initial INVITE is received
77 * from remote dialog participant.
79 struct queued_message
{
80 /** Body of the message. */
83 * Content type of message body, e.g. text/plain for chat messages,
84 * text/x-msmsgsinvite for filetransfer initialization. Setting this to NULL
85 * means default value text/plain.
91 * Add a new chat session
93 * @param sip (in) SIP account data. May be NULL
95 * @return pointer to new session
98 sipe_session_add_chat(struct sipe_account_data
*sip
);
101 * Find chat session by Call ID
103 * @param sip (in) SIP account data. May be NULL
104 * @param callid (in) Call ID. May be NULL
106 * @return pointer to session or NULL
109 sipe_session_find_chat_by_callid(struct sipe_account_data
*sip
,
110 const gchar
*callid
);
113 * Find or add new chat session by Call ID
115 * @param sip (in) SIP account data
116 * @param callid (in) Call ID
118 * @return pointer to session
121 sipe_session_find_or_add_chat_by_callid(struct sipe_account_data
*sip
,
122 const gchar
*callid
);
125 * Find chat session by ID
127 * @param sip (in) SIP account data. May be NULL
128 * @param id (in) Chat ID
130 * @return pointer to session or NULL
133 sipe_session_find_chat_by_id(struct sipe_account_data
*sip
, int id
);
136 * Find chat session by name
138 * @param sip (in) SIP account data. May be NULL
139 * @param name (in) Chat name. May be NULL
141 * @return pointer to session or NULL
144 sipe_session_find_chat_by_title(struct sipe_account_data
*sip
,
148 * Find Conference session
150 * @param sip (in) SIP account data. May be NULL
151 * @param focus_uri (in) URI of conference focus. May be NULL
153 * @return pointer to session or NULL
156 sipe_session_find_conference(struct sipe_account_data
*sip
,
157 const gchar
*focus_uri
);
162 * @param sip (in) SIP account data. May be NULL
163 * @param who (in) remote partner. May be NULL
165 * @return pointer to session or NULL
168 sipe_session_find_im(struct sipe_account_data
*sip
, const gchar
*who
);
171 * Find or add new IM session
173 * @param sip (in) SIP account data
174 * @param who (in) remote partner
176 * @return pointer to session
179 sipe_session_find_or_add_im(struct sipe_account_data
*sip
,
183 * Remove a session from a SIP account
185 * @param sip (in) SIP account data
186 * @param session (in) pointer to session
189 sipe_session_remove(struct sipe_account_data
*sip
,
190 struct sip_session
*session
);
193 * Remove all sessions from a SIP account
195 * @param sip (in) SIP account data
198 sipe_session_remove_all(struct sipe_account_data
*sip
);
201 * Add a message to outgoing queue.
203 * @param session (in) SIP session
204 * @param body (in) message to send
205 * @param content_type (in) content type of the message body
208 sipe_session_enqueue_message(struct sip_session
*session
,
209 const gchar
*body
, const gchar
*content_type
);
212 * Removes and deallocates the first item in outgoing message queue.
214 * @param session (in) SIP session
216 * @return pointer to new message queue head
219 sipe_session_dequeue_message(struct sip_session
*session
);