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 multi-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 * Multiparty 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.
90 /** Frees queued_message
93 sipe_free_queued_message(struct queued_message
*message
);
96 * Add a new chat session
98 * @param sip (in) SIP account data. May be NULL
100 * @return pointer to new session
103 sipe_session_add_chat(struct sipe_account_data
*sip
);
106 * Find chat session by Call ID
108 * @param sip (in) SIP account data. May be NULL
109 * @param callid (in) Call ID. May be NULL
111 * @return pointer to session or NULL
114 sipe_session_find_chat_by_callid(struct sipe_account_data
*sip
,
115 const gchar
*callid
);
118 * Find or add new chat session by Call ID
120 * @param sip (in) SIP account data
121 * @param callid (in) Call ID
123 * @return pointer to session
126 sipe_session_find_or_add_chat_by_callid(struct sipe_account_data
*sip
,
127 const gchar
*callid
);
130 * Find chat session by ID
132 * @param sip (in) SIP account data. May be NULL
133 * @param id (in) Chat ID
135 * @return pointer to session or NULL
138 sipe_session_find_chat_by_id(struct sipe_account_data
*sip
, int id
);
141 * Find chat session by name
143 * @param sip (in) SIP account data. May be NULL
144 * @param name (in) Chat name. May be NULL
146 * @return pointer to session or NULL
149 sipe_session_find_chat_by_title(struct sipe_account_data
*sip
,
153 * Find Conference session
155 * @param sip (in) SIP account data. May be NULL
156 * @param focus_uri (in) URI of conference focus. May be NULL
158 * @return pointer to session or NULL
161 sipe_session_find_conference(struct sipe_account_data
*sip
,
162 const gchar
*focus_uri
);
167 * @param sip (in) SIP account data. May be NULL
168 * @param who (in) remote partner. May be NULL
170 * @return pointer to session or NULL
173 sipe_session_find_im(struct sipe_account_data
*sip
, const gchar
*who
);
176 * Find or add new IM session
178 * @param sip (in) SIP account data
179 * @param who (in) remote partner
181 * @return pointer to session
184 sipe_session_find_or_add_im(struct sipe_account_data
*sip
,
188 * Remove a session from a SIP account
190 * @param sip (in) SIP account data
191 * @param session (in) pointer to session
194 sipe_session_remove(struct sipe_account_data
*sip
,
195 struct sip_session
*session
);
198 * Remove all sessions from a SIP account
200 * @param sip (in) SIP account data
203 sipe_session_remove_all(struct sipe_account_data
*sip
);
206 * Add a message to outgoing queue.
208 * @param session (in) SIP session
209 * @param body (in) message to send
210 * @param content_type (in) content type of the message body
213 sipe_session_enqueue_message(struct sip_session
*session
,
214 const gchar
*body
, const gchar
*content_type
);
217 * Removes and deallocates the first item in outgoing message queue.
219 * @param session (in) SIP session
221 * @return pointer to new message queue head
224 sipe_session_dequeue_message(struct sip_session
*session
);