Tue, 12 Jun 2007 01:25:46 +0000
Fixed whitespace to match the coding convention used in libpurple
| 7014 | 1 | /** |
| 2 | * @file jabber.h | |
| 3 | * | |
| 15884 | 4 | * purple |
| 7014 | 5 | * |
| 6 | * Copyright (C) 2003 Nathan Walp <faceprint@faceprint.com> | |
| 2086 | 7 | * |
| 7014 | 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. | |
| 2086 | 12 | * |
| 7014 | 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
17779
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17773
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 7014 | 16 | * GNU General Public License for more details. |
| 2086 | 17 | * |
| 7014 | 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 | |
|
17779
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17773
diff
changeset
|
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 2086 | 21 | */ |
| 15884 | 22 | #ifndef _PURPLE_JABBER_H_ |
| 23 | #define _PURPLE_JABBER_H_ | |
| 2086 | 24 | |
| 13808 | 25 | #include <libxml/parser.h> |
| 7014 | 26 | #include <glib.h> |
|
14013
86dac5633bd9
[gaim-migrate @ 16496]
Mark Doliner <markdoliner@pidgin.im>
parents:
13808
diff
changeset
|
27 | #include "circbuffer.h" |
| 7014 | 28 | #include "connection.h" |
|
14370
12ef3d4096ee
[gaim-migrate @ 16998]
Mark Doliner <markdoliner@pidgin.im>
parents:
14324
diff
changeset
|
29 | #include "dnssrv.h" |
| 8113 | 30 | #include "roomlist.h" |
| 7014 | 31 | #include "sslconn.h" |
| 2086 | 32 | |
| 7014 | 33 | #include "jutil.h" |
| 34 | #include "xmlnode.h" | |
| 2086 | 35 | |
| 12508 | 36 | #ifdef HAVE_CYRUS_SASL |
| 37 | #include <sasl/sasl.h> | |
| 38 | #endif | |
| 39 | ||
| 16066 | 40 | #define CAPS0115_NODE "http://pidgin.im/caps" |
| 13385 | 41 | |
| 7014 | 42 | typedef enum { |
|
17779
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17773
diff
changeset
|
43 | JABBER_CAP_NONE = 0, |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17773
diff
changeset
|
44 | JABBER_CAP_XHTML = 1 << 0, |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17773
diff
changeset
|
45 | JABBER_CAP_COMPOSING = 1 << 1, |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17773
diff
changeset
|
46 | JABBER_CAP_SI = 1 << 2, |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17773
diff
changeset
|
47 | JABBER_CAP_SI_FILE_XFER = 1 << 3, |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17773
diff
changeset
|
48 | JABBER_CAP_BYTESTREAMS = 1 << 4, |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17773
diff
changeset
|
49 | JABBER_CAP_IBB = 1 << 5, |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17773
diff
changeset
|
50 | JABBER_CAP_CHAT_STATES = 1 << 6, |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17773
diff
changeset
|
51 | JABBER_CAP_IQ_SEARCH = 1 << 7, |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17773
diff
changeset
|
52 | JABBER_CAP_IQ_REGISTER = 1 << 8, |
| 15225 | 53 | |
| 54 | /* Google Talk extensions: | |
| 55 | * http://code.google.com/apis/talk/jep_extensions/extensions.html | |
| 56 | */ | |
|
17779
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17773
diff
changeset
|
57 | JABBER_CAP_GMAIL_NOTIFY = 1 << 9, |
| 15265 | 58 | JABBER_CAP_GOOGLE_ROSTER = 1 << 10, |
| 15225 | 59 | |
|
17779
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17773
diff
changeset
|
60 | JABBER_CAP_PING = 1 << 11, |
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17766
diff
changeset
|
61 | |
|
17779
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17773
diff
changeset
|
62 | JABBER_CAP_RETRIEVED = 1 << 31 |
| 8312 | 63 | } JabberCapabilities; |
| 64 | ||
| 65 | typedef enum { | |
| 7014 | 66 | JABBER_STREAM_OFFLINE, |
| 67 | JABBER_STREAM_CONNECTING, | |
| 68 | JABBER_STREAM_INITIALIZING, | |
| 69 | JABBER_STREAM_AUTHENTICATING, | |
| 70 | JABBER_STREAM_REINITIALIZING, | |
| 71 | JABBER_STREAM_CONNECTED | |
| 72 | } JabberStreamState; | |
| 2086 | 73 | |
| 7014 | 74 | typedef struct _JabberStream |
| 2086 | 75 | { |
| 7014 | 76 | int fd; |
| 2086 | 77 | |
| 15884 | 78 | PurpleSrvQueryData *srv_query_data; |
|
14175
2bc5a80c5071
[gaim-migrate @ 16747]
Mark Doliner <markdoliner@pidgin.im>
parents:
14062
diff
changeset
|
79 | |
| 13808 | 80 | xmlParserCtxt *context; |
| 7014 | 81 | xmlnode *current; |
| 2086 | 82 | |
| 7014 | 83 | enum { |
| 84 | JABBER_PROTO_0_9, | |
| 85 | JABBER_PROTO_1_0 | |
| 86 | } protocol_version; | |
| 7291 | 87 | enum { |
| 8296 | 88 | JABBER_AUTH_UNKNOWN, |
| 7291 | 89 | JABBER_AUTH_DIGEST_MD5, |
| 8296 | 90 | JABBER_AUTH_PLAIN, |
| 12508 | 91 | JABBER_AUTH_IQ_AUTH, |
| 92 | JABBER_AUTH_CYRUS | |
| 7291 | 93 | } auth_type; |
| 7014 | 94 | char *stream_id; |
| 95 | JabberStreamState state; | |
| 2086 | 96 | |
| 7014 | 97 | /* SASL authentication */ |
| 98 | char *expected_rspauth; | |
| 2086 | 99 | |
| 7014 | 100 | GHashTable *buddies; |
| 101 | gboolean roster_parsed; | |
| 2086 | 102 | |
| 7014 | 103 | GHashTable *chats; |
| 8043 | 104 | GList *chat_servers; |
| 15884 | 105 | PurpleRoomlist *roomlist; |
| 11675 | 106 | GList *user_directories; |
| 2086 | 107 | |
| 8312 | 108 | GHashTable *iq_callbacks; |
| 109 | GHashTable *disco_callbacks; | |
| 7014 | 110 | int next_id; |
| 2086 | 111 | |
| 8312 | 112 | |
| 7395 | 113 | GList *oob_file_transfers; |
| 7170 | 114 | GList *file_transfers; |
| 115 | ||
|
14453
1cc75906700c
[gaim-migrate @ 17098]
Mark Doliner <markdoliner@pidgin.im>
parents:
14375
diff
changeset
|
116 | time_t idle; |
|
1cc75906700c
[gaim-migrate @ 17098]
Mark Doliner <markdoliner@pidgin.im>
parents:
14375
diff
changeset
|
117 | |
| 7014 | 118 | JabberID *user; |
| 15884 | 119 | PurpleConnection *gc; |
| 120 | PurpleSslConnection *gsc; | |
| 7072 | 121 | |
| 122 | gboolean registration; | |
| 10189 | 123 | |
| 124 | char *avatar_hash; | |
| 10941 | 125 | GSList *pending_avatar_requests; |
| 12508 | 126 | |
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15265
diff
changeset
|
127 | GSList *pending_buddy_info_requests; |
|
15800
2d0ec4fe2681
pass the correct domain to cyrus sasl (sf patch 1663064)
Nathan Walp <nwalp@pidgin.im>
parents:
15435
diff
changeset
|
128 | |
| 15884 | 129 | PurpleCircBuffer *write_buffer; |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12508
diff
changeset
|
130 | guint writeh; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12508
diff
changeset
|
131 | |
| 14062 | 132 | gboolean reinit; |
| 133 | ||
| 15225 | 134 | JabberCapabilities server_caps; |
| 15197 | 135 | gboolean googletalk; |
| 136 | char *server_name; | |
|
15800
2d0ec4fe2681
pass the correct domain to cyrus sasl (sf patch 1663064)
Nathan Walp <nwalp@pidgin.im>
parents:
15435
diff
changeset
|
137 | |
| 15225 | 138 | char *gmail_last_time; |
| 139 | char *gmail_last_tid; | |
| 15197 | 140 | |
| 12508 | 141 | /* OK, this stays at the end of the struct, so plugins can depend |
| 142 | * on the rest of the stuff being in the right place | |
| 143 | */ | |
| 144 | #ifdef HAVE_CYRUS_SASL | |
| 145 | sasl_conn_t *sasl; | |
| 146 | sasl_callback_t *sasl_cb; | |
| 147 | int sasl_state; | |
| 148 | int sasl_maxbuf; | |
| 149 | GString *sasl_mechs; | |
| 150 | #endif | |
|
17779
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17773
diff
changeset
|
151 | char *serverFQDN; |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17773
diff
changeset
|
152 | |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17773
diff
changeset
|
153 | /* does the local server support PEP? */ |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17773
diff
changeset
|
154 | gboolean pep; |
| 7014 | 155 | } JabberStream; |
| 2086 | 156 | |
| 7014 | 157 | void jabber_process_packet(JabberStream *js, xmlnode *packet); |
| 158 | void jabber_send(JabberStream *js, xmlnode *data); | |
| 7642 | 159 | void jabber_send_raw(JabberStream *js, const char *data, int len); |
| 2086 | 160 | |
| 7014 | 161 | void jabber_stream_set_state(JabberStream *js, JabberStreamState state); |
| 2086 | 162 | |
| 7077 | 163 | void jabber_register_parse(JabberStream *js, xmlnode *packet); |
| 8016 | 164 | void jabber_register_start(JabberStream *js); |
| 7077 | 165 | |
| 7014 | 166 | char *jabber_get_next_id(JabberStream *js); |
| 2086 | 167 | |
| 8401 | 168 | char *jabber_parse_error(JabberStream *js, xmlnode *packet); |
| 169 | ||
|
17773
6956b763b3d1
Implemented adding callbacks for PEP events. Moved the feature list to be application-global instead of per-connection (makes more sense).
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
170 | void jabber_add_feature(const gchar *shortname, const gchar *namespace); |
|
6956b763b3d1
Implemented adding callbacks for PEP events. Moved the feature list to be application-global instead of per-connection (makes more sense).
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
171 | void jabber_remove_feature(const gchar *shortname); |
|
17770
e67998927a3c
Added the ability to define extensions to caps
Andreas Monitzer <am@adiumx.com>
parents:
17769
diff
changeset
|
172 | |
|
16302
eb633ebf84f2
This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@pidgin.im>
parents:
16066
diff
changeset
|
173 | /** PRPL functions */ |
|
eb633ebf84f2
This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@pidgin.im>
parents:
16066
diff
changeset
|
174 | const char *jabber_list_icon(PurpleAccount *a, PurpleBuddy *b); |
|
eb633ebf84f2
This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@pidgin.im>
parents:
16066
diff
changeset
|
175 | const char* jabber_list_emblem(PurpleBuddy *b); |
|
eb633ebf84f2
This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@pidgin.im>
parents:
16066
diff
changeset
|
176 | char *jabber_status_text(PurpleBuddy *b); |
|
eb633ebf84f2
This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@pidgin.im>
parents:
16066
diff
changeset
|
177 | void jabber_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full); |
|
eb633ebf84f2
This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@pidgin.im>
parents:
16066
diff
changeset
|
178 | GList *jabber_status_types(PurpleAccount *account); |
|
eb633ebf84f2
This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@pidgin.im>
parents:
16066
diff
changeset
|
179 | void jabber_login(PurpleAccount *account); |
|
eb633ebf84f2
This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@pidgin.im>
parents:
16066
diff
changeset
|
180 | void jabber_close(PurpleConnection *gc); |
|
eb633ebf84f2
This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@pidgin.im>
parents:
16066
diff
changeset
|
181 | void jabber_idle_set(PurpleConnection *gc, int idle); |
|
eb633ebf84f2
This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@pidgin.im>
parents:
16066
diff
changeset
|
182 | void jabber_keepalive(PurpleConnection *gc); |
|
eb633ebf84f2
This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@pidgin.im>
parents:
16066
diff
changeset
|
183 | void jabber_register_account(PurpleAccount *account); |
|
eb633ebf84f2
This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@pidgin.im>
parents:
16066
diff
changeset
|
184 | void jabber_convo_closed(PurpleConnection *gc, const char *who); |
|
eb633ebf84f2
This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@pidgin.im>
parents:
16066
diff
changeset
|
185 | PurpleChat *jabber_find_blist_chat(PurpleAccount *account, const char *name); |
|
eb633ebf84f2
This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@pidgin.im>
parents:
16066
diff
changeset
|
186 | gboolean jabber_offline_message(const PurpleBuddy *buddy); |
|
eb633ebf84f2
This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@pidgin.im>
parents:
16066
diff
changeset
|
187 | int jabber_prpl_send_raw(PurpleConnection *gc, const char *buf, int len); |
|
eb633ebf84f2
This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@pidgin.im>
parents:
16066
diff
changeset
|
188 | GList *jabber_actions(PurplePlugin *plugin, gpointer context); |
|
eb633ebf84f2
This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@pidgin.im>
parents:
16066
diff
changeset
|
189 | void jabber_register_commands(void); |
|
eb633ebf84f2
This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@pidgin.im>
parents:
16066
diff
changeset
|
190 | void jabber_init_plugin(PurplePlugin *plugin); |
|
eb633ebf84f2
This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@pidgin.im>
parents:
16066
diff
changeset
|
191 | |
|
17773
6956b763b3d1
Implemented adding callbacks for PEP events. Moved the feature list to be application-global instead of per-connection (makes more sense).
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
192 | typedef struct _JabberFeature |
|
6956b763b3d1
Implemented adding callbacks for PEP events. Moved the feature list to be application-global instead of per-connection (makes more sense).
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
193 | { |
|
17779
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17773
diff
changeset
|
194 | gchar *shortname; |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17773
diff
changeset
|
195 | gchar *namespace; |
|
17773
6956b763b3d1
Implemented adding callbacks for PEP events. Moved the feature list to be application-global instead of per-connection (makes more sense).
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
196 | } JabberFeature; |
|
6956b763b3d1
Implemented adding callbacks for PEP events. Moved the feature list to be application-global instead of per-connection (makes more sense).
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
197 | |
|
6956b763b3d1
Implemented adding callbacks for PEP events. Moved the feature list to be application-global instead of per-connection (makes more sense).
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
198 | /* what kind of additional features as returned from disco#info are supported? */ |
|
6956b763b3d1
Implemented adding callbacks for PEP events. Moved the feature list to be application-global instead of per-connection (makes more sense).
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
199 | extern GList *jabber_features; |
|
6956b763b3d1
Implemented adding callbacks for PEP events. Moved the feature list to be application-global instead of per-connection (makes more sense).
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
200 | |
| 15884 | 201 | #endif /* _PURPLE_JABBER_H_ */ |