Thu, 29 Aug 2013 22:59:30 -0700
Fix the FARSIGHT libs and cflags for the jabber prpl.
We never define FARSIGHT_LIBS or FARSIGHT_CFLAGS. We only ever define
FARSTREAM_LIBS and FARSTREAM_CFLAGS, even if they point to farsight.
I'm assuming this hasn't been a problem because:
1. The variables are allowed to be empty (it's not treated as an error)
2. libpurple and/or Pidgin link against farsight/farstream, so it's
apparently not necessary for the plugin to do it itself? Who knew.
| 7014 | 1 | /* |
| 15884 | 2 | * purple - Jabber Protocol Plugin |
| 7014 | 3 | * |
|
28322
ac8fec1d2234
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents:
28155
diff
changeset
|
4 | * Purple is the legal property of its developers, whose names are too numerous |
|
ac8fec1d2234
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents:
28155
diff
changeset
|
5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
ac8fec1d2234
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents:
28155
diff
changeset
|
6 | * source distribution. |
| 7014 | 7 | * |
| 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. | |
| 12 | * | |
| 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. | |
| 17 | * | |
| 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 | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18443
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 7014 | 21 | * |
| 22 | */ | |
| 23 | #include "internal.h" | |
|
18441
d255d04c0aa1
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18317
diff
changeset
|
24 | #include "core.h" |
| 7014 | 25 | #include "debug.h" |
| 26 | #include "prefs.h" | |
| 10941 | 27 | #include "util.h" |
| 7014 | 28 | |
| 7395 | 29 | #include "buddy.h" |
| 8312 | 30 | #include "disco.h" |
|
29913
58f5122fbcd3
First shot at refactoring the Google-specific XMPP code.
Marcus Lundblad <malu@pidgin.im>
parents:
29399
diff
changeset
|
31 | #include "google/gmail.h" |
|
58f5122fbcd3
First shot at refactoring the Google-specific XMPP code.
Marcus Lundblad <malu@pidgin.im>
parents:
29399
diff
changeset
|
32 | #include "google/google.h" |
|
58f5122fbcd3
First shot at refactoring the Google-specific XMPP code.
Marcus Lundblad <malu@pidgin.im>
parents:
29399
diff
changeset
|
33 | #include "google/jingleinfo.h" |
|
58f5122fbcd3
First shot at refactoring the Google-specific XMPP code.
Marcus Lundblad <malu@pidgin.im>
parents:
29399
diff
changeset
|
34 | #include "google/google_session.h" |
| 7014 | 35 | #include "iq.h" |
|
26143
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
23754
diff
changeset
|
36 | #include "jingle/jingle.h" |
| 7170 | 37 | #include "oob.h" |
| 7014 | 38 | #include "roster.h" |
| 7395 | 39 | #include "si.h" |
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
15884
diff
changeset
|
40 | #include "ping.h" |
|
17805
5bd417a1c847
Implemented XEP-0050: Ad-Hoc Commands. Note that this XEP requires sending an initial command to the peer, which is not implemented in libpurple itself (since this requires a discovery browser or equivalent).
Andreas Monitzer <am@adiumx.com>
parents:
17769
diff
changeset
|
41 | #include "adhoccommands.h" |
|
23626
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23076
diff
changeset
|
42 | #include "data.h" |
|
24372
830701cec96f
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <malu@pidgin.im>
parents:
23076
diff
changeset
|
43 | #include "ibb.h" |
| 7014 | 44 | |
|
7058
c62db98b7a2a
[gaim-migrate @ 7621]
Herman Bloggs <herman@bluedigits.com>
parents:
7014
diff
changeset
|
45 | #ifdef _WIN32 |
|
c62db98b7a2a
[gaim-migrate @ 7621]
Herman Bloggs <herman@bluedigits.com>
parents:
7014
diff
changeset
|
46 | #include "utsname.h" |
|
c62db98b7a2a
[gaim-migrate @ 7621]
Herman Bloggs <herman@bluedigits.com>
parents:
7014
diff
changeset
|
47 | #endif |
| 7014 | 48 | |
|
29399
cce925ddb58a
These should be static
Paul Aurich <darkrain42@pidgin.im>
parents:
29359
diff
changeset
|
49 | static GHashTable *iq_handlers = NULL; |
|
cce925ddb58a
These should be static
Paul Aurich <darkrain42@pidgin.im>
parents:
29359
diff
changeset
|
50 | static GHashTable *signal_iq_handlers = NULL; |
| 14356 | 51 | |
| 7014 | 52 | JabberIq *jabber_iq_new(JabberStream *js, JabberIqType type) |
| 53 | { | |
| 54 | JabberIq *iq; | |
| 55 | ||
| 56 | iq = g_new0(JabberIq, 1); | |
| 57 | ||
| 58 | iq->type = type; | |
| 59 | ||
| 60 | iq->node = xmlnode_new("iq"); | |
| 61 | switch(iq->type) { | |
| 62 | case JABBER_IQ_SET: | |
| 63 | xmlnode_set_attrib(iq->node, "type", "set"); | |
| 64 | break; | |
| 65 | case JABBER_IQ_GET: | |
| 66 | xmlnode_set_attrib(iq->node, "type", "get"); | |
| 67 | break; | |
| 68 | case JABBER_IQ_ERROR: | |
| 69 | xmlnode_set_attrib(iq->node, "type", "error"); | |
| 70 | break; | |
| 71 | case JABBER_IQ_RESULT: | |
| 72 | xmlnode_set_attrib(iq->node, "type", "result"); | |
| 73 | break; | |
| 74 | case JABBER_IQ_NONE: | |
| 75 | /* this shouldn't ever happen */ | |
| 76 | break; | |
| 77 | } | |
| 78 | ||
| 79 | iq->js = js; | |
| 80 | ||
| 81 | if(type == JABBER_IQ_GET || type == JABBER_IQ_SET) { | |
| 82 | iq->id = jabber_get_next_id(js); | |
| 83 | xmlnode_set_attrib(iq->node, "id", iq->id); | |
| 84 | } | |
| 85 | ||
| 86 | return iq; | |
| 87 | } | |
| 88 | ||
| 89 | JabberIq *jabber_iq_new_query(JabberStream *js, JabberIqType type, | |
| 90 | const char *xmlns) | |
| 91 | { | |
| 92 | JabberIq *iq = jabber_iq_new(js, type); | |
| 93 | xmlnode *query; | |
| 94 | ||
| 95 | query = xmlnode_new_child(iq->node, "query"); | |
| 13808 | 96 | xmlnode_set_namespace(query, xmlns); |
| 7014 | 97 | |
| 98 | return iq; | |
| 99 | } | |
| 100 | ||
| 7395 | 101 | typedef struct _JabberCallbackData { |
| 102 | JabberIqCallback *callback; | |
| 103 | gpointer data; | |
| 104 | } JabberCallbackData; | |
| 105 | ||
| 106 | void | |
| 107 | jabber_iq_set_callback(JabberIq *iq, JabberIqCallback *callback, gpointer data) | |
| 7014 | 108 | { |
| 109 | iq->callback = callback; | |
| 7395 | 110 | iq->callback_data = data; |
| 7014 | 111 | } |
| 112 | ||
| 113 | void jabber_iq_set_id(JabberIq *iq, const char *id) | |
| 114 | { | |
|
24520
726138a1c69b
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
115 | g_free(iq->id); |
| 7014 | 116 | |
| 117 | if(id) { | |
| 118 | xmlnode_set_attrib(iq->node, "id", id); | |
| 119 | iq->id = g_strdup(id); | |
| 120 | } else { | |
| 121 | xmlnode_remove_attrib(iq->node, "id"); | |
| 122 | iq->id = NULL; | |
| 123 | } | |
| 124 | } | |
| 125 | ||
| 126 | void jabber_iq_send(JabberIq *iq) | |
| 127 | { | |
| 7395 | 128 | JabberCallbackData *jcd; |
| 7014 | 129 | g_return_if_fail(iq != NULL); |
| 130 | ||
| 131 | jabber_send(iq->js, iq->node); | |
| 132 | ||
| 7395 | 133 | if(iq->id && iq->callback) { |
| 134 | jcd = g_new0(JabberCallbackData, 1); | |
| 135 | jcd->callback = iq->callback; | |
| 136 | jcd->data = iq->callback_data; | |
| 8312 | 137 | g_hash_table_insert(iq->js->iq_callbacks, g_strdup(iq->id), jcd); |
| 7395 | 138 | } |
| 7014 | 139 | |
| 140 | jabber_iq_free(iq); | |
| 141 | } | |
| 142 | ||
| 143 | void jabber_iq_free(JabberIq *iq) | |
| 144 | { | |
| 145 | g_return_if_fail(iq != NULL); | |
| 146 | ||
| 147 | g_free(iq->id); | |
| 148 | xmlnode_free(iq->node); | |
| 149 | g_free(iq); | |
| 150 | } | |
| 151 | ||
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
152 | static void jabber_iq_last_parse(JabberStream *js, const char *from, |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
153 | JabberIqType type, const char *id, |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
154 | xmlnode *packet) |
| 7014 | 155 | { |
| 156 | JabberIq *iq; | |
| 157 | xmlnode *query; | |
|
14453
1cc75906700c
[gaim-migrate @ 17098]
Mark Doliner <markdoliner@pidgin.im>
parents:
14375
diff
changeset
|
158 | char *idle_time; |
| 7014 | 159 | |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
160 | if(type == JABBER_IQ_GET) { |
|
28984
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28980
diff
changeset
|
161 | iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, NS_LAST_ACTIVITY); |
| 8006 | 162 | jabber_iq_set_id(iq, id); |
|
25818
d087a2754595
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <darkrain42@pidgin.im>
parents:
25817
diff
changeset
|
163 | if (from) |
|
d087a2754595
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <darkrain42@pidgin.im>
parents:
25817
diff
changeset
|
164 | xmlnode_set_attrib(iq->node, "to", from); |
| 7014 | 165 | |
| 8006 | 166 | query = xmlnode_get_child(iq->node, "query"); |
| 7014 | 167 | |
|
14453
1cc75906700c
[gaim-migrate @ 17098]
Mark Doliner <markdoliner@pidgin.im>
parents:
14375
diff
changeset
|
168 | idle_time = g_strdup_printf("%ld", js->idle ? time(NULL) - js->idle : 0); |
|
1cc75906700c
[gaim-migrate @ 17098]
Mark Doliner <markdoliner@pidgin.im>
parents:
14375
diff
changeset
|
169 | xmlnode_set_attrib(query, "seconds", idle_time); |
|
1cc75906700c
[gaim-migrate @ 17098]
Mark Doliner <markdoliner@pidgin.im>
parents:
14375
diff
changeset
|
170 | g_free(idle_time); |
| 7401 | 171 | |
| 8006 | 172 | jabber_iq_send(iq); |
| 173 | } | |
| 7014 | 174 | } |
| 175 | ||
|
27433
8eaac1cf4214
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <darkrain42@pidgin.im>
parents:
27175
diff
changeset
|
176 | static void jabber_time_parse(JabberStream *js, const char *from, |
|
8eaac1cf4214
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <darkrain42@pidgin.im>
parents:
27175
diff
changeset
|
177 | JabberIqType type, const char *id, |
|
8eaac1cf4214
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <darkrain42@pidgin.im>
parents:
27175
diff
changeset
|
178 | xmlnode *child) |
| 7014 | 179 | { |
| 180 | JabberIq *iq; | |
| 181 | time_t now_t; | |
|
27433
8eaac1cf4214
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <darkrain42@pidgin.im>
parents:
27175
diff
changeset
|
182 | struct tm *tm; |
|
9722
c1072806bcae
[gaim-migrate @ 10583]
Mark Doliner <markdoliner@pidgin.im>
parents:
9709
diff
changeset
|
183 | |
| 7014 | 184 | time(&now_t); |
|
18317
6c814e134e56
support replying to XEP-0202 queries
Nathan Walp <nwalp@pidgin.im>
parents:
18194
diff
changeset
|
185 | |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
186 | if(type == JABBER_IQ_GET) { |
|
27433
8eaac1cf4214
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <darkrain42@pidgin.im>
parents:
27175
diff
changeset
|
187 | xmlnode *tzo, *utc; |
|
8eaac1cf4214
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <darkrain42@pidgin.im>
parents:
27175
diff
changeset
|
188 | const char *date, *tz; |
| 7014 | 189 | |
|
25556
300d8959e04c
Fix the implementation of XEP-0202 (Entity Time) (thanks again to Marcus)
Paul Aurich <darkrain42@pidgin.im>
parents:
25554
diff
changeset
|
190 | iq = jabber_iq_new(js, JABBER_IQ_RESULT); |
| 8006 | 191 | jabber_iq_set_id(iq, id); |
|
25818
d087a2754595
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <darkrain42@pidgin.im>
parents:
25817
diff
changeset
|
192 | if (from) |
|
d087a2754595
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <darkrain42@pidgin.im>
parents:
25817
diff
changeset
|
193 | xmlnode_set_attrib(iq->node, "to", from); |
| 7014 | 194 | |
|
25556
300d8959e04c
Fix the implementation of XEP-0202 (Entity Time) (thanks again to Marcus)
Paul Aurich <darkrain42@pidgin.im>
parents:
25554
diff
changeset
|
195 | child = xmlnode_new_child(iq->node, child->name); |
|
28984
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28980
diff
changeset
|
196 | xmlnode_set_namespace(child, NS_ENTITY_TIME); |
| 10941 | 197 | |
|
27433
8eaac1cf4214
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <darkrain42@pidgin.im>
parents:
27175
diff
changeset
|
198 | /* <tzo>-06:00</tzo> */ |
|
8eaac1cf4214
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <darkrain42@pidgin.im>
parents:
27175
diff
changeset
|
199 | tm = localtime(&now_t); |
|
8eaac1cf4214
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <darkrain42@pidgin.im>
parents:
27175
diff
changeset
|
200 | tz = purple_get_tzoff_str(tm, TRUE); |
|
8eaac1cf4214
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <darkrain42@pidgin.im>
parents:
27175
diff
changeset
|
201 | tzo = xmlnode_new_child(child, "tzo"); |
|
8eaac1cf4214
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <darkrain42@pidgin.im>
parents:
27175
diff
changeset
|
202 | xmlnode_insert_data(tzo, tz, -1); |
| 10941 | 203 | |
|
27433
8eaac1cf4214
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <darkrain42@pidgin.im>
parents:
27175
diff
changeset
|
204 | /* <utc>2006-12-19T17:58:35Z</utc> */ |
|
8eaac1cf4214
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <darkrain42@pidgin.im>
parents:
27175
diff
changeset
|
205 | tm = gmtime(&now_t); |
|
29020
ac6acf2722f3
jabber: Don't use C99 time formatters, which are apparently not available on Windows when using MSVC.
Florian Quèze <florian@instantbird.org>
parents:
28984
diff
changeset
|
206 | date = purple_utf8_strftime("%Y-%m-%dT%H:%M:%SZ", tm); |
|
27433
8eaac1cf4214
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <darkrain42@pidgin.im>
parents:
27175
diff
changeset
|
207 | utc = xmlnode_new_child(child, "utc"); |
|
8eaac1cf4214
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <darkrain42@pidgin.im>
parents:
27175
diff
changeset
|
208 | xmlnode_insert_data(utc, date, -1); |
| 7014 | 209 | |
| 8006 | 210 | jabber_iq_send(iq); |
|
27433
8eaac1cf4214
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <darkrain42@pidgin.im>
parents:
27175
diff
changeset
|
211 | } else { |
|
8eaac1cf4214
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <darkrain42@pidgin.im>
parents:
27175
diff
changeset
|
212 | /* TODO: Errors */ |
|
18181
736c6abf62f4
respond to XEP-0199 queries (XMPP ping)
Nathan Walp <nwalp@pidgin.im>
parents:
17753
diff
changeset
|
213 | } |
|
736c6abf62f4
respond to XEP-0199 queries (XMPP ping)
Nathan Walp <nwalp@pidgin.im>
parents:
17753
diff
changeset
|
214 | } |
|
736c6abf62f4
respond to XEP-0199 queries (XMPP ping)
Nathan Walp <nwalp@pidgin.im>
parents:
17753
diff
changeset
|
215 | |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
216 | static void jabber_iq_version_parse(JabberStream *js, const char *from, |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
217 | JabberIqType type, const char *id, |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
218 | xmlnode *packet) |
| 7014 | 219 | { |
| 220 | JabberIq *iq; | |
| 221 | xmlnode *query; | |
| 222 | ||
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
223 | if(type == JABBER_IQ_GET) { |
|
18441
d255d04c0aa1
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18317
diff
changeset
|
224 | GHashTable *ui_info; |
|
d255d04c0aa1
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18317
diff
changeset
|
225 | const char *ui_name = NULL, *ui_version = NULL; |
|
20116
9952c317df4c
applied changes from 8543caa9958f323a231c630bebd65c74dec3401f
Richard Laager <rlaager@pidgin.im>
parents:
19897
diff
changeset
|
226 | #if 0 |
|
20225
684334efdc19
applied changes from d4b316d73ebaf93803ca2642e78b8821c3b5d5c7
Luke Schierer <lschiere@pidgin.im>
parents:
20116
diff
changeset
|
227 | char *os = NULL; |
| 15884 | 228 | if(!purple_prefs_get_bool("/plugins/prpl/jabber/hide_os")) { |
| 8006 | 229 | struct utsname osinfo; |
| 7014 | 230 | |
| 8006 | 231 | uname(&osinfo); |
| 232 | os = g_strdup_printf("%s %s %s", osinfo.sysname, osinfo.release, | |
| 233 | osinfo.machine); | |
| 234 | } | |
|
20116
9952c317df4c
applied changes from 8543caa9958f323a231c630bebd65c74dec3401f
Richard Laager <rlaager@pidgin.im>
parents:
19897
diff
changeset
|
235 | #endif |
| 7014 | 236 | |
| 8006 | 237 | iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, "jabber:iq:version"); |
|
25818
d087a2754595
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <darkrain42@pidgin.im>
parents:
25817
diff
changeset
|
238 | if (from) |
|
d087a2754595
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <darkrain42@pidgin.im>
parents:
25817
diff
changeset
|
239 | xmlnode_set_attrib(iq->node, "to", from); |
| 8006 | 240 | jabber_iq_set_id(iq, id); |
| 7014 | 241 | |
| 8006 | 242 | query = xmlnode_get_child(iq->node, "query"); |
| 7014 | 243 | |
|
18441
d255d04c0aa1
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18317
diff
changeset
|
244 | ui_info = purple_core_get_ui_info(); |
|
d255d04c0aa1
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18317
diff
changeset
|
245 | |
|
d255d04c0aa1
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18317
diff
changeset
|
246 | if(NULL != ui_info) { |
|
d255d04c0aa1
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18317
diff
changeset
|
247 | ui_name = g_hash_table_lookup(ui_info, "name"); |
|
d255d04c0aa1
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18317
diff
changeset
|
248 | ui_version = g_hash_table_lookup(ui_info, "version"); |
|
d255d04c0aa1
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18317
diff
changeset
|
249 | } |
|
d255d04c0aa1
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18317
diff
changeset
|
250 | |
|
d255d04c0aa1
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18317
diff
changeset
|
251 | if(NULL != ui_name && NULL != ui_version) { |
| 18443 | 252 | char *version_complete = g_strdup_printf("%s (libpurple " VERSION ")", ui_version); |
| 253 | xmlnode_insert_data(xmlnode_new_child(query, "name"), ui_name, -1); | |
| 254 | xmlnode_insert_data(xmlnode_new_child(query, "version"), version_complete, -1); | |
| 255 | g_free(version_complete); | |
|
18441
d255d04c0aa1
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18317
diff
changeset
|
256 | } else { |
|
d255d04c0aa1
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18317
diff
changeset
|
257 | xmlnode_insert_data(xmlnode_new_child(query, "name"), "libpurple", -1); |
|
d255d04c0aa1
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18317
diff
changeset
|
258 | xmlnode_insert_data(xmlnode_new_child(query, "version"), VERSION, -1); |
|
d255d04c0aa1
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18317
diff
changeset
|
259 | } |
|
d255d04c0aa1
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18317
diff
changeset
|
260 | |
|
20225
684334efdc19
applied changes from d4b316d73ebaf93803ca2642e78b8821c3b5d5c7
Luke Schierer <lschiere@pidgin.im>
parents:
20116
diff
changeset
|
261 | #if 0 |
| 8006 | 262 | if(os) { |
| 263 | xmlnode_insert_data(xmlnode_new_child(query, "os"), os, -1); | |
| 264 | g_free(os); | |
| 265 | } | |
|
20225
684334efdc19
applied changes from d4b316d73ebaf93803ca2642e78b8821c3b5d5c7
Luke Schierer <lschiere@pidgin.im>
parents:
20116
diff
changeset
|
266 | #endif |
| 10941 | 267 | |
| 8006 | 268 | jabber_iq_send(iq); |
| 7014 | 269 | } |
| 270 | } | |
| 271 | ||
| 13794 | 272 | void jabber_iq_remove_callback_by_id(JabberStream *js, const char *id) |
| 273 | { | |
| 274 | g_hash_table_remove(js->iq_callbacks, id); | |
| 275 | } | |
| 276 | ||
| 7014 | 277 | void jabber_iq_parse(JabberStream *js, xmlnode *packet) |
| 278 | { | |
| 7395 | 279 | JabberCallbackData *jcd; |
|
25554
53e161fc0658
Jabber IQ handlers should handle non-query child nodes
Paul Aurich <darkrain42@pidgin.im>
parents:
24520
diff
changeset
|
280 | xmlnode *child, *error, *x; |
| 7014 | 281 | const char *xmlns; |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
282 | const char *iq_type, *id, *from; |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
283 | JabberIqType type = JABBER_IQ_NONE; |
|
27103
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
284 | gboolean signal_return; |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
285 | |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
286 | from = xmlnode_get_attrib(packet, "from"); |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
287 | id = xmlnode_get_attrib(packet, "id"); |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
288 | iq_type = xmlnode_get_attrib(packet, "type"); |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
289 | |
|
25554
53e161fc0658
Jabber IQ handlers should handle non-query child nodes
Paul Aurich <darkrain42@pidgin.im>
parents:
24520
diff
changeset
|
290 | /* |
|
53e161fc0658
Jabber IQ handlers should handle non-query child nodes
Paul Aurich <darkrain42@pidgin.im>
parents:
24520
diff
changeset
|
291 | * child will be either the first tag child or NULL if there is no child. |
|
53e161fc0658
Jabber IQ handlers should handle non-query child nodes
Paul Aurich <darkrain42@pidgin.im>
parents:
24520
diff
changeset
|
292 | * Historically, we used just the 'query' subchild, but newer XEPs use |
|
53e161fc0658
Jabber IQ handlers should handle non-query child nodes
Paul Aurich <darkrain42@pidgin.im>
parents:
24520
diff
changeset
|
293 | * differently named children. Grabbing the first child is (for the time |
|
53e161fc0658
Jabber IQ handlers should handle non-query child nodes
Paul Aurich <darkrain42@pidgin.im>
parents:
24520
diff
changeset
|
294 | * being) sufficient. |
|
53e161fc0658
Jabber IQ handlers should handle non-query child nodes
Paul Aurich <darkrain42@pidgin.im>
parents:
24520
diff
changeset
|
295 | */ |
|
53e161fc0658
Jabber IQ handlers should handle non-query child nodes
Paul Aurich <darkrain42@pidgin.im>
parents:
24520
diff
changeset
|
296 | for (child = packet->child; child; child = child->next) { |
|
25813
2e5e39a3107c
This is shorter and easier to read.
Paul Aurich <darkrain42@pidgin.im>
parents:
25557
diff
changeset
|
297 | if (child->type == XMLNODE_TYPE_TAG) |
|
2e5e39a3107c
This is shorter and easier to read.
Paul Aurich <darkrain42@pidgin.im>
parents:
25557
diff
changeset
|
298 | break; |
|
25554
53e161fc0658
Jabber IQ handlers should handle non-query child nodes
Paul Aurich <darkrain42@pidgin.im>
parents:
24520
diff
changeset
|
299 | } |
|
53e161fc0658
Jabber IQ handlers should handle non-query child nodes
Paul Aurich <darkrain42@pidgin.im>
parents:
24520
diff
changeset
|
300 | |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
301 | if (iq_type) { |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
302 | if (!strcmp(iq_type, "get")) |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
303 | type = JABBER_IQ_GET; |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
304 | else if (!strcmp(iq_type, "set")) |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
305 | type = JABBER_IQ_SET; |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
306 | else if (!strcmp(iq_type, "result")) |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
307 | type = JABBER_IQ_RESULT; |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
308 | else if (!strcmp(iq_type, "error")) |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
309 | type = JABBER_IQ_ERROR; |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
310 | } |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
311 | |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
312 | if (type == JABBER_IQ_NONE) { |
|
24520
726138a1c69b
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
313 | purple_debug_error("jabber", "IQ with invalid type ('%s') - ignoring.\n", |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
314 | iq_type ? iq_type : "(null)"); |
|
24520
726138a1c69b
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
315 | return; |
|
726138a1c69b
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
316 | } |
|
726138a1c69b
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
317 | |
|
726138a1c69b
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
318 | /* All IQs must have an ID, so send an error for a set/get that doesn't */ |
|
726138a1c69b
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
319 | if(!id || !*id) { |
|
726138a1c69b
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
320 | |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
321 | if(type == JABBER_IQ_SET || type == JABBER_IQ_GET) { |
|
24520
726138a1c69b
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
322 | JabberIq *iq = jabber_iq_new(js, JABBER_IQ_ERROR); |
|
726138a1c69b
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
323 | |
|
726138a1c69b
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
324 | xmlnode_free(iq->node); |
|
726138a1c69b
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
325 | iq->node = xmlnode_copy(packet); |
|
25818
d087a2754595
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <darkrain42@pidgin.im>
parents:
25817
diff
changeset
|
326 | if (from) { |
|
d087a2754595
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <darkrain42@pidgin.im>
parents:
25817
diff
changeset
|
327 | xmlnode_set_attrib(iq->node, "to", from); |
|
d087a2754595
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <darkrain42@pidgin.im>
parents:
25817
diff
changeset
|
328 | xmlnode_remove_attrib(iq->node, "from"); |
|
d087a2754595
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <darkrain42@pidgin.im>
parents:
25817
diff
changeset
|
329 | } |
|
d087a2754595
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <darkrain42@pidgin.im>
parents:
25817
diff
changeset
|
330 | |
|
24520
726138a1c69b
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
331 | xmlnode_set_attrib(iq->node, "type", "error"); |
|
726138a1c69b
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
332 | /* This id is clearly not useful, but we must put something there for a valid stanza */ |
|
726138a1c69b
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
333 | iq->id = jabber_get_next_id(js); |
|
726138a1c69b
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
334 | xmlnode_set_attrib(iq->node, "id", iq->id); |
|
726138a1c69b
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
335 | error = xmlnode_new_child(iq->node, "error"); |
|
726138a1c69b
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
336 | xmlnode_set_attrib(error, "type", "modify"); |
|
726138a1c69b
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
337 | x = xmlnode_new_child(error, "bad-request"); |
|
28984
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28980
diff
changeset
|
338 | xmlnode_set_namespace(x, NS_XMPP_STANZAS); |
|
24520
726138a1c69b
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
339 | |
|
726138a1c69b
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
340 | jabber_iq_send(iq); |
|
726138a1c69b
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
341 | } else |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
342 | purple_debug_error("jabber", "IQ of type '%s' missing id - ignoring.\n", |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
343 | iq_type); |
|
24520
726138a1c69b
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
344 | |
|
726138a1c69b
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
345 | return; |
|
726138a1c69b
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
346 | } |
|
726138a1c69b
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
347 | |
|
28832
4e4b609b85e4
jabber: Use purple_connection_get_prpl() instead of jabber_plugin.
Paul Aurich <darkrain42@pidgin.im>
parents:
28322
diff
changeset
|
348 | signal_return = GPOINTER_TO_INT(purple_signal_emit_return_1(purple_connection_get_prpl(js->gc), |
|
28155
de9b298ef02e
jabber: Emit jabber-receiving-iq after we've ensured id is !NULL
Paul Aurich <darkrain42@pidgin.im>
parents:
27433
diff
changeset
|
349 | "jabber-receiving-iq", js->gc, iq_type, id, from, packet)); |
|
de9b298ef02e
jabber: Emit jabber-receiving-iq after we've ensured id is !NULL
Paul Aurich <darkrain42@pidgin.im>
parents:
27433
diff
changeset
|
350 | if (signal_return) |
|
de9b298ef02e
jabber: Emit jabber-receiving-iq after we've ensured id is !NULL
Paul Aurich <darkrain42@pidgin.im>
parents:
27433
diff
changeset
|
351 | return; |
|
de9b298ef02e
jabber: Emit jabber-receiving-iq after we've ensured id is !NULL
Paul Aurich <darkrain42@pidgin.im>
parents:
27433
diff
changeset
|
352 | |
| 8312 | 353 | /* First, lets see if a special callback got registered */ |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
354 | if(type == JABBER_IQ_RESULT || type == JABBER_IQ_ERROR) { |
|
25831
1ff20e8f93b5
Remove a "suggested parenthes around assignment" warning
Paul Aurich <darkrain42@pidgin.im>
parents:
25830
diff
changeset
|
355 | if((jcd = g_hash_table_lookup(js->iq_callbacks, id))) { |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
356 | jcd->callback(js, from, type, id, packet, jcd->data); |
| 13794 | 357 | jabber_iq_remove_callback_by_id(js, id); |
| 8314 | 358 | return; |
| 8312 | 359 | } |
| 360 | } | |
| 361 | ||
|
27103
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
362 | /* |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
363 | * Apparently not, so let's see if we have a pre-defined handler |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
364 | * or if an outside plugin is interested. |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
365 | */ |
|
25554
53e161fc0658
Jabber IQ handlers should handle non-query child nodes
Paul Aurich <darkrain42@pidgin.im>
parents:
24520
diff
changeset
|
366 | if(child && (xmlns = xmlnode_get_namespace(child))) { |
|
25820
c0ebe6bd49aa
Track the node name in addition to the namespace for handlers (try #2)
Paul Aurich <darkrain42@pidgin.im>
parents:
25814
diff
changeset
|
367 | char *key = g_strdup_printf("%s %s", child->name, xmlns); |
|
c0ebe6bd49aa
Track the node name in addition to the namespace for handlers (try #2)
Paul Aurich <darkrain42@pidgin.im>
parents:
25814
diff
changeset
|
368 | JabberIqHandler *jih = g_hash_table_lookup(iq_handlers, key); |
|
27103
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
369 | int signal_ref = GPOINTER_TO_INT(g_hash_table_lookup(signal_iq_handlers, key)); |
|
25820
c0ebe6bd49aa
Track the node name in addition to the namespace for handlers (try #2)
Paul Aurich <darkrain42@pidgin.im>
parents:
25814
diff
changeset
|
370 | g_free(key); |
| 7014 | 371 | |
|
27103
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
372 | if (signal_ref > 0) { |
|
28832
4e4b609b85e4
jabber: Use purple_connection_get_prpl() instead of jabber_plugin.
Paul Aurich <darkrain42@pidgin.im>
parents:
28322
diff
changeset
|
373 | signal_return = GPOINTER_TO_INT(purple_signal_emit_return_1(purple_connection_get_prpl(js->gc), "jabber-watched-iq", |
|
27103
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
374 | js->gc, iq_type, id, from, child)); |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
375 | if (signal_return) |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
376 | return; |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
377 | } |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
378 | |
|
25820
c0ebe6bd49aa
Track the node name in addition to the namespace for handlers (try #2)
Paul Aurich <darkrain42@pidgin.im>
parents:
25814
diff
changeset
|
379 | if(jih) { |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
380 | jih(js, from, type, id, child); |
| 8262 | 381 | return; |
| 382 | } | |
| 7395 | 383 | } |
|
26454
94130b583e0b
Clean up usage of USE_VV in the XMPP protocol.
Michael Ruprecht <maiku@pidgin.im>
parents:
26337
diff
changeset
|
384 | |
|
29359
cec28224afd4
jabber: Log a more useful message on unhandled IQs
Paul Aurich <darkrain42@pidgin.im>
parents:
29020
diff
changeset
|
385 | purple_debug_misc("jabber", "Unhandled IQ with id %s\n", id); |
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
15884
diff
changeset
|
386 | |
| 8312 | 387 | /* If we get here, send the default error reply mandated by XMPP-CORE */ |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25815
diff
changeset
|
388 | if(type == JABBER_IQ_SET || type == JABBER_IQ_GET) { |
| 8315 | 389 | JabberIq *iq = jabber_iq_new(js, JABBER_IQ_ERROR); |
| 8135 | 390 | |
| 8315 | 391 | xmlnode_free(iq->node); |
| 392 | iq->node = xmlnode_copy(packet); | |
|
25818
d087a2754595
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <darkrain42@pidgin.im>
parents:
25817
diff
changeset
|
393 | if (from) { |
|
d087a2754595
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <darkrain42@pidgin.im>
parents:
25817
diff
changeset
|
394 | xmlnode_set_attrib(iq->node, "to", from); |
|
d087a2754595
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <darkrain42@pidgin.im>
parents:
25817
diff
changeset
|
395 | xmlnode_remove_attrib(iq->node, "from"); |
|
d087a2754595
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <darkrain42@pidgin.im>
parents:
25817
diff
changeset
|
396 | } |
|
d087a2754595
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <darkrain42@pidgin.im>
parents:
25817
diff
changeset
|
397 | |
| 8315 | 398 | xmlnode_set_attrib(iq->node, "type", "error"); |
| 399 | error = xmlnode_new_child(iq->node, "error"); | |
| 400 | xmlnode_set_attrib(error, "type", "cancel"); | |
| 401 | xmlnode_set_attrib(error, "code", "501"); | |
| 402 | x = xmlnode_new_child(error, "feature-not-implemented"); | |
|
28984
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28980
diff
changeset
|
403 | xmlnode_set_namespace(x, NS_XMPP_STANZAS); |
| 8169 | 404 | |
| 8315 | 405 | jabber_iq_send(iq); |
| 406 | } | |
| 7014 | 407 | } |
| 408 | ||
|
25820
c0ebe6bd49aa
Track the node name in addition to the namespace for handlers (try #2)
Paul Aurich <darkrain42@pidgin.im>
parents:
25814
diff
changeset
|
409 | void jabber_iq_register_handler(const char *node, const char *xmlns, JabberIqHandler *handlerfunc) |
| 14356 | 410 | { |
|
25820
c0ebe6bd49aa
Track the node name in addition to the namespace for handlers (try #2)
Paul Aurich <darkrain42@pidgin.im>
parents:
25814
diff
changeset
|
411 | /* |
|
c0ebe6bd49aa
Track the node name in addition to the namespace for handlers (try #2)
Paul Aurich <darkrain42@pidgin.im>
parents:
25814
diff
changeset
|
412 | * This is valid because nodes nor namespaces cannot have spaces in them |
|
c0ebe6bd49aa
Track the node name in addition to the namespace for handlers (try #2)
Paul Aurich <darkrain42@pidgin.im>
parents:
25814
diff
changeset
|
413 | * (see http://www.w3.org/TR/2006/REC-xml-20060816/ and |
|
c0ebe6bd49aa
Track the node name in addition to the namespace for handlers (try #2)
Paul Aurich <darkrain42@pidgin.im>
parents:
25814
diff
changeset
|
414 | * http://www.w3.org/TR/REC-xml-names/) |
|
c0ebe6bd49aa
Track the node name in addition to the namespace for handlers (try #2)
Paul Aurich <darkrain42@pidgin.im>
parents:
25814
diff
changeset
|
415 | */ |
|
c0ebe6bd49aa
Track the node name in addition to the namespace for handlers (try #2)
Paul Aurich <darkrain42@pidgin.im>
parents:
25814
diff
changeset
|
416 | char *key = g_strdup_printf("%s %s", node, xmlns); |
|
c0ebe6bd49aa
Track the node name in addition to the namespace for handlers (try #2)
Paul Aurich <darkrain42@pidgin.im>
parents:
25814
diff
changeset
|
417 | g_hash_table_replace(iq_handlers, key, handlerfunc); |
| 14356 | 418 | } |
| 419 | ||
|
27103
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
420 | void jabber_iq_signal_register(const gchar *node, const gchar *xmlns) |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
421 | { |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
422 | gchar *key; |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
423 | int ref; |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
424 | |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
425 | g_return_if_fail(node != NULL && *node != '\0'); |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
426 | g_return_if_fail(xmlns != NULL && *xmlns != '\0'); |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
427 | |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
428 | key = g_strdup_printf("%s %s", node, xmlns); |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
429 | ref = GPOINTER_TO_INT(g_hash_table_lookup(signal_iq_handlers, key)); |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
430 | if (ref == 0) { |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
431 | g_hash_table_insert(signal_iq_handlers, key, GINT_TO_POINTER(1)); |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
432 | } else { |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
433 | g_hash_table_insert(signal_iq_handlers, key, GINT_TO_POINTER(ref + 1)); |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
434 | g_free(key); |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
435 | } |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
436 | } |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
437 | |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
438 | void jabber_iq_signal_unregister(const gchar *node, const gchar *xmlns) |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
439 | { |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
440 | gchar *key; |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
441 | int ref; |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
442 | |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
443 | g_return_if_fail(node != NULL && *node != '\0'); |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
444 | g_return_if_fail(xmlns != NULL && *xmlns != '\0'); |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
445 | |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
446 | key = g_strdup_printf("%s %s", node, xmlns); |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
447 | ref = GPOINTER_TO_INT(g_hash_table_lookup(signal_iq_handlers, key)); |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
448 | |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
449 | if (ref == 1) { |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
450 | g_hash_table_remove(signal_iq_handlers, key); |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
451 | } else if (ref > 1) { |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
452 | g_hash_table_insert(signal_iq_handlers, key, GINT_TO_POINTER(ref - 1)); |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
453 | } |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
454 | |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
455 | g_free(key); |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
456 | } |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
457 | |
| 14356 | 458 | void jabber_iq_init(void) |
| 459 | { | |
| 460 | iq_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); | |
|
27103
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
461 | signal_iq_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); |
| 14356 | 462 | |
|
26704
e6dba3759625
Gratuitous alphabetization of the IQ handlers (again!) and move the data handler to jabber_data_init
Paul Aurich <darkrain42@pidgin.im>
parents:
26701
diff
changeset
|
463 | jabber_iq_register_handler("jingle", JINGLE, jingle_parse); |
|
28984
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28980
diff
changeset
|
464 | jabber_iq_register_handler("mailbox", NS_GOOGLE_MAIL_NOTIFY, |
|
26704
e6dba3759625
Gratuitous alphabetization of the IQ handlers (again!) and move the data handler to jabber_data_init
Paul Aurich <darkrain42@pidgin.im>
parents:
26701
diff
changeset
|
465 | jabber_gmail_poke); |
|
28984
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28980
diff
changeset
|
466 | jabber_iq_register_handler("new-mail", NS_GOOGLE_MAIL_NOTIFY, |
|
26704
e6dba3759625
Gratuitous alphabetization of the IQ handlers (again!) and move the data handler to jabber_data_init
Paul Aurich <darkrain42@pidgin.im>
parents:
26701
diff
changeset
|
467 | jabber_gmail_poke); |
|
28979
191942cc7747
jabber: Start putting all the namespaces in one location with consistent naming.
Paul Aurich <darkrain42@pidgin.im>
parents:
28832
diff
changeset
|
468 | jabber_iq_register_handler("ping", NS_PING, jabber_ping_parse); |
|
191942cc7747
jabber: Start putting all the namespaces in one location with consistent naming.
Paul Aurich <darkrain42@pidgin.im>
parents:
28832
diff
changeset
|
469 | jabber_iq_register_handler("query", NS_GOOGLE_JINGLE_INFO, |
|
26704
e6dba3759625
Gratuitous alphabetization of the IQ handlers (again!) and move the data handler to jabber_data_init
Paul Aurich <darkrain42@pidgin.im>
parents:
26701
diff
changeset
|
470 | jabber_google_handle_jingle_info); |
|
28984
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28980
diff
changeset
|
471 | jabber_iq_register_handler("query", NS_BYTESTREAMS, |
|
26704
e6dba3759625
Gratuitous alphabetization of the IQ handlers (again!) and move the data handler to jabber_data_init
Paul Aurich <darkrain42@pidgin.im>
parents:
26701
diff
changeset
|
472 | jabber_bytestreams_parse); |
|
28984
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28980
diff
changeset
|
473 | jabber_iq_register_handler("query", NS_DISCO_INFO, jabber_disco_info_parse); |
|
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28980
diff
changeset
|
474 | jabber_iq_register_handler("query", NS_DISCO_ITEMS, jabber_disco_items_parse); |
|
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28980
diff
changeset
|
475 | jabber_iq_register_handler("query", NS_LAST_ACTIVITY, jabber_iq_last_parse); |
|
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28980
diff
changeset
|
476 | jabber_iq_register_handler("query", NS_OOB_IQ_DATA, jabber_oob_parse); |
|
26704
e6dba3759625
Gratuitous alphabetization of the IQ handlers (again!) and move the data handler to jabber_data_init
Paul Aurich <darkrain42@pidgin.im>
parents:
26701
diff
changeset
|
477 | jabber_iq_register_handler("query", "jabber:iq:register", |
|
e6dba3759625
Gratuitous alphabetization of the IQ handlers (again!) and move the data handler to jabber_data_init
Paul Aurich <darkrain42@pidgin.im>
parents:
26701
diff
changeset
|
478 | jabber_register_parse); |
|
e6dba3759625
Gratuitous alphabetization of the IQ handlers (again!) and move the data handler to jabber_data_init
Paul Aurich <darkrain42@pidgin.im>
parents:
26701
diff
changeset
|
479 | jabber_iq_register_handler("query", "jabber:iq:roster", |
|
e6dba3759625
Gratuitous alphabetization of the IQ handlers (again!) and move the data handler to jabber_data_init
Paul Aurich <darkrain42@pidgin.im>
parents:
26701
diff
changeset
|
480 | jabber_roster_parse); |
|
e6dba3759625
Gratuitous alphabetization of the IQ handlers (again!) and move the data handler to jabber_data_init
Paul Aurich <darkrain42@pidgin.im>
parents:
26701
diff
changeset
|
481 | jabber_iq_register_handler("query", "jabber:iq:version", |
|
e6dba3759625
Gratuitous alphabetization of the IQ handlers (again!) and move the data handler to jabber_data_init
Paul Aurich <darkrain42@pidgin.im>
parents:
26701
diff
changeset
|
482 | jabber_iq_version_parse); |
|
26697
2f086177af37
Fix-up the merge some more (*sigh*), readding <session/> handler
Paul Aurich <darkrain42@pidgin.im>
parents:
26695
diff
changeset
|
483 | #ifdef USE_VV |
|
28980
4a0f7340b539
jabber: Add the missing file and fix up the Google session namespaces
Paul Aurich <darkrain42@pidgin.im>
parents:
28979
diff
changeset
|
484 | jabber_iq_register_handler("session", NS_GOOGLE_SESSION, |
|
26697
2f086177af37
Fix-up the merge some more (*sigh*), readding <session/> handler
Paul Aurich <darkrain42@pidgin.im>
parents:
26695
diff
changeset
|
485 | jabber_google_session_parse); |
|
2f086177af37
Fix-up the merge some more (*sigh*), readding <session/> handler
Paul Aurich <darkrain42@pidgin.im>
parents:
26695
diff
changeset
|
486 | #endif |
|
28984
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28980
diff
changeset
|
487 | jabber_iq_register_handler("block", NS_SIMPLE_BLOCKING, jabber_blocklist_parse_push); |
|
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28980
diff
changeset
|
488 | jabber_iq_register_handler("unblock", NS_SIMPLE_BLOCKING, jabber_blocklist_parse_push); |
|
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28980
diff
changeset
|
489 | jabber_iq_register_handler("time", NS_ENTITY_TIME, jabber_time_parse); |
|
26704
e6dba3759625
Gratuitous alphabetization of the IQ handlers (again!) and move the data handler to jabber_data_init
Paul Aurich <darkrain42@pidgin.im>
parents:
26701
diff
changeset
|
490 | |
| 14356 | 491 | } |
| 492 | ||
| 493 | void jabber_iq_uninit(void) | |
| 494 | { | |
| 495 | g_hash_table_destroy(iq_handlers); | |
|
27103
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
496 | g_hash_table_destroy(signal_iq_handlers); |
|
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
26704
diff
changeset
|
497 | iq_handlers = signal_iq_handlers = NULL; |
| 14356 | 498 | } |