comparison libpurple/protocols/jabber/jabber.h @ 19695:1d2002a5735e

propagate from branch 'im.pidgin.pidgin' (head 996cf0c57149ba6e1c714ebb1f11d5d4bac8fb68) to branch 'im.pidgin.soc.2007.xmpp' (head cdf63b6603891b8cd3e7f629ef5a9a927a153550)
author Andreas Monitzer <pidgin@monitzer.com>
date Wed, 05 Sep 2007 22:32:14 +0000
parents 67cb28c0ec89 2a9d60d7af82
children 481749fc0b6b
comparison
equal deleted inserted replaced
19653:e21002d106ab 19695:1d2002a5735e
10 * the Free Software Foundation; either version 2 of the License, or 10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version. 11 * (at your option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License 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 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 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 21 */
22 #ifndef _PURPLE_JABBER_H_ 22 #ifndef _PURPLE_JABBER_H_
23 #define _PURPLE_JABBER_H_ 23 #define _PURPLE_JABBER_H_
24
25 typedef enum {
26 JABBER_CAP_NONE = 0,
27 JABBER_CAP_XHTML = 1 << 0,
28 JABBER_CAP_COMPOSING = 1 << 1,
29 JABBER_CAP_SI = 1 << 2,
30 JABBER_CAP_SI_FILE_XFER = 1 << 3,
31 JABBER_CAP_BYTESTREAMS = 1 << 4,
32 JABBER_CAP_IBB = 1 << 5,
33 JABBER_CAP_CHAT_STATES = 1 << 6,
34 JABBER_CAP_IQ_SEARCH = 1 << 7,
35 JABBER_CAP_IQ_REGISTER = 1 << 8,
36
37 /* Google Talk extensions:
38 * http://code.google.com/apis/talk/jep_extensions/extensions.html
39 */
40 JABBER_CAP_GMAIL_NOTIFY = 1 << 9,
41 JABBER_CAP_GOOGLE_ROSTER = 1 << 10,
42
43 JABBER_CAP_PING = 1 << 11,
44 JABBER_CAP_ADHOC = 1 << 12,
45
46 JABBER_CAP_RETRIEVED = 1 << 31
47 } JabberCapabilities;
48
49 typedef struct _JabberStream JabberStream;
24 50
25 #include <libxml/parser.h> 51 #include <libxml/parser.h>
26 #include <glib.h> 52 #include <glib.h>
27 #include "circbuffer.h" 53 #include "circbuffer.h"
28 #include "connection.h" 54 #include "connection.h"
30 #include "roomlist.h" 56 #include "roomlist.h"
31 #include "sslconn.h" 57 #include "sslconn.h"
32 58
33 #include "jutil.h" 59 #include "jutil.h"
34 #include "xmlnode.h" 60 #include "xmlnode.h"
61 #include "buddy.h"
35 62
36 #ifdef HAVE_CYRUS_SASL 63 #ifdef HAVE_CYRUS_SASL
37 #include <sasl/sasl.h> 64 #include <sasl/sasl.h>
38 #endif 65 #endif
39 66
40 #define CAPS0115_NODE "http://pidgin.im/caps" 67 #define CAPS0115_NODE "http://pidgin.im/caps"
41
42 typedef enum {
43 JABBER_CAP_NONE = 0,
44 JABBER_CAP_XHTML = 1 << 0,
45 JABBER_CAP_COMPOSING = 1 << 1,
46 JABBER_CAP_SI = 1 << 2,
47 JABBER_CAP_SI_FILE_XFER = 1 << 3,
48 JABBER_CAP_BYTESTREAMS = 1 << 4,
49 JABBER_CAP_IBB = 1 << 5,
50 JABBER_CAP_CHAT_STATES = 1 << 6,
51 JABBER_CAP_IQ_SEARCH = 1 << 7,
52 JABBER_CAP_IQ_REGISTER = 1 << 8,
53
54 /* Google Talk extensions:
55 * http://code.google.com/apis/talk/jep_extensions/extensions.html
56 */
57 JABBER_CAP_GMAIL_NOTIFY = 1 << 9,
58 JABBER_CAP_GOOGLE_ROSTER = 1 << 10,
59
60 JABBER_CAP_RETRIEVED = 1 << 31
61 } JabberCapabilities;
62 68
63 typedef enum { 69 typedef enum {
64 JABBER_STREAM_OFFLINE, 70 JABBER_STREAM_OFFLINE,
65 JABBER_STREAM_CONNECTING, 71 JABBER_STREAM_CONNECTING,
66 JABBER_STREAM_INITIALIZING, 72 JABBER_STREAM_INITIALIZING,
73 JABBER_STREAM_INITIALIZING_ENCRYPTION,
67 JABBER_STREAM_AUTHENTICATING, 74 JABBER_STREAM_AUTHENTICATING,
68 JABBER_STREAM_REINITIALIZING, 75 JABBER_STREAM_REINITIALIZING,
69 JABBER_STREAM_CONNECTED 76 JABBER_STREAM_CONNECTED
70 } JabberStreamState; 77 } JabberStreamState;
71 78
72 typedef struct _JabberStream 79 struct _JabberStream
73 { 80 {
74 int fd; 81 int fd;
75 82
76 PurpleSrvQueryData *srv_query_data; 83 PurpleSrvQueryData *srv_query_data;
77 84
150 #endif 157 #endif
151 158
152 int sasl_state; 159 int sasl_state;
153 int sasl_maxbuf; 160 int sasl_maxbuf;
154 GString *sasl_mechs; 161 GString *sasl_mechs;
155 162
163 gboolean unregistration;
164 PurpleAccountUnregistrationCb unregistration_cb;
165 void *unregistration_user_data;
166
156 gboolean vcard_fetched; 167 gboolean vcard_fetched;
157 168
158 } JabberStream; 169 /* does the local server support PEP? */
159 170 gboolean pep;
160 void jabber_process_packet(JabberStream *js, xmlnode *packet); 171
172 /* Is Buzz enabled? */
173 gboolean allowBuzz;
174
175 /* A list of JabberAdHocCommands supported by the server */
176 GList *commands;
177
178 /* last presence update to check for differences */
179 JabberBuddyState old_state;
180 char *old_msg;
181 int old_priority;
182 char *old_avatarhash;
183
184 /* same for user tune */
185 char *old_artist;
186 char *old_title;
187 char *old_source;
188 char *old_uri;
189 int old_length;
190 char *old_track;
191 };
192
193 typedef gboolean (JabberFeatureEnabled)(JabberStream *js, const gchar *shortname, const gchar *namespace);
194
195 typedef struct _JabberFeature
196 {
197 gchar *shortname;
198 gchar *namespace;
199 JabberFeatureEnabled *is_enabled;
200 } JabberFeature;
201
202 /* what kind of additional features as returned from disco#info are supported? */
203 extern GList *jabber_features;
204
205 void jabber_process_packet(JabberStream *js, xmlnode **packet);
161 void jabber_send(JabberStream *js, xmlnode *data); 206 void jabber_send(JabberStream *js, xmlnode *data);
162 void jabber_send_raw(JabberStream *js, const char *data, int len); 207 void jabber_send_raw(JabberStream *js, const char *data, int len);
163 208
164 void jabber_stream_set_state(JabberStream *js, JabberStreamState state); 209 void jabber_stream_set_state(JabberStream *js, JabberStreamState state);
165 210
167 void jabber_register_start(JabberStream *js); 212 void jabber_register_start(JabberStream *js);
168 213
169 char *jabber_get_next_id(JabberStream *js); 214 char *jabber_get_next_id(JabberStream *js);
170 215
171 char *jabber_parse_error(JabberStream *js, xmlnode *packet); 216 char *jabber_parse_error(JabberStream *js, xmlnode *packet);
217
218 void jabber_add_feature(const gchar *shortname, const gchar *namespace, JabberFeatureEnabled cb); /* cb may be NULL */
219 void jabber_remove_feature(const gchar *shortname);
172 220
173 /** PRPL functions */ 221 /** PRPL functions */
174 const char *jabber_list_icon(PurpleAccount *a, PurpleBuddy *b); 222 const char *jabber_list_icon(PurpleAccount *a, PurpleBuddy *b);
175 const char* jabber_list_emblem(PurpleBuddy *b); 223 const char* jabber_list_emblem(PurpleBuddy *b);
176 char *jabber_status_text(PurpleBuddy *b); 224 char *jabber_status_text(PurpleBuddy *b);
178 GList *jabber_status_types(PurpleAccount *account); 226 GList *jabber_status_types(PurpleAccount *account);
179 void jabber_login(PurpleAccount *account); 227 void jabber_login(PurpleAccount *account);
180 void jabber_close(PurpleConnection *gc); 228 void jabber_close(PurpleConnection *gc);
181 void jabber_idle_set(PurpleConnection *gc, int idle); 229 void jabber_idle_set(PurpleConnection *gc, int idle);
182 void jabber_keepalive(PurpleConnection *gc); 230 void jabber_keepalive(PurpleConnection *gc);
231 void jabber_register_gateway(JabberStream *js, const char *gateway);
183 void jabber_register_account(PurpleAccount *account); 232 void jabber_register_account(PurpleAccount *account);
233 void jabber_unregister_account(PurpleAccount *account, PurpleAccountUnregistrationCb cb, void *user_data);
184 void jabber_convo_closed(PurpleConnection *gc, const char *who); 234 void jabber_convo_closed(PurpleConnection *gc, const char *who);
185 PurpleChat *jabber_find_blist_chat(PurpleAccount *account, const char *name); 235 PurpleChat *jabber_find_blist_chat(PurpleAccount *account, const char *name);
186 gboolean jabber_offline_message(const PurpleBuddy *buddy); 236 gboolean jabber_offline_message(const PurpleBuddy *buddy);
187 int jabber_prpl_send_raw(PurpleConnection *gc, const char *buf, int len); 237 int jabber_prpl_send_raw(PurpleConnection *gc, const char *buf, int len);
188 GList *jabber_actions(PurplePlugin *plugin, gpointer context); 238 GList *jabber_actions(PurplePlugin *plugin, gpointer context);