Updated to release 1.7.1
[siplcs.git] / src / sipe-session.h
blobd35b976a0b1d5827f59ac02126a3c4317159e033
1 /**
2 * @file sipe-sesion.h
4 * pidgin-sipe
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; \
26 while (entry) { \
27 struct sip_session *session = entry->data; \
28 entry = entry->next;
29 #define SIPE_SESSION_FOREACH_END }}
31 /** Correspond to multy-party conversation */
32 struct sip_session {
33 gchar *with; /* For IM sessions only (not multi-party) . A URI.*/
34 /** key is user (URI) */
35 GSList *dialogs;
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;
46 /** purple chat id */
47 int chat_id;
48 /** purple indexes chats by names */
49 //gchar *chat_name;
50 /** Human readable chat name */
51 gchar *chat_title;
52 /** Call-Id identifying the conversation */
53 gchar *callid; /* For multiparty conversations */
54 /** Roster Manager URI */
55 gchar *roster_manager;
56 int bid;
57 gboolean is_voting_in_progress;
58 GSList *pending_invite_queue;
61 * Conference related fields
63 gchar *focus_uri;
64 gchar *im_mcu_uri;
65 gchar *subject;
66 gboolean locked;
67 guint request_id;
68 struct sip_dialog *focus_dialog;
69 /** Key is Message-Id */
70 GHashTable *conf_unconfirmed_messages;
73 /**
74 * Add a new chat session
76 * @param sip (in) SIP account data. May be NULL
78 * @return pointer to new session
80 struct sip_session *
81 sipe_session_add_chat(struct sipe_account_data *sip);
83 /**
84 * Find chat session by Call ID
86 * @param sip (in) SIP account data. May be NULL
87 * @param callid (in) Call ID. May be NULL
89 * @return pointer to session or NULL
91 struct sip_session *
92 sipe_session_find_chat_by_callid(struct sipe_account_data *sip,
93 const gchar *callid);
95 /**
96 * Find or add new chat session by Call ID
98 * @param sip (in) SIP account data
99 * @param callid (in) Call ID
101 * @return pointer to session
103 struct sip_session *
104 sipe_session_find_or_add_chat_by_callid(struct sipe_account_data *sip,
105 const gchar *callid);
108 * Find chat session by ID
110 * @param sip (in) SIP account data. May be NULL
111 * @param id (in) Chat ID
113 * @return pointer to session or NULL
115 struct sip_session *
116 sipe_session_find_chat_by_id(struct sipe_account_data *sip, int id);
119 * Find chat session by name
121 * @param sip (in) SIP account data. May be NULL
122 * @param name (in) Chat name. May be NULL
124 * @return pointer to session or NULL
126 struct sip_session *
127 sipe_session_find_chat_by_title(struct sipe_account_data *sip,
128 const gchar *name);
131 * Find Conference session
133 * @param sip (in) SIP account data. May be NULL
134 * @param focus_uri (in) URI of conference focus. May be NULL
136 * @return pointer to session or NULL
138 struct sip_session *
139 sipe_session_find_conference(struct sipe_account_data *sip,
140 const gchar *focus_uri);
143 * Find IM session
145 * @param sip (in) SIP account data. May be NULL
146 * @param who (in) remote partner. May be NULL
148 * @return pointer to session or NULL
150 struct sip_session *
151 sipe_session_find_im(struct sipe_account_data *sip, const gchar *who);
154 * Find or add new IM session
156 * @param sip (in) SIP account data
157 * @param who (in) remote partner
159 * @return pointer to session
161 struct sip_session *
162 sipe_session_find_or_add_im(struct sipe_account_data *sip,
163 const gchar *who);
166 * Remove a session from a SIP account
168 * @param sip (in) SIP account data
169 * @param session (in) pointer to session
171 void
172 sipe_session_remove(struct sipe_account_data *sip,
173 struct sip_session *session);
176 * Remove all sessions from a SIP account
178 * @param sip (in) SIP account data
180 void
181 sipe_session_remove_all(struct sipe_account_data *sip);