Mercurial > pidgin.yaz
annotate libpurple/protocols/jabber/iq.c @ 32493:743bb6b1aa30
Move struct_size to the beginning of the struct. Even if we don't
rewrite this somehow (as a GObject or otherwise), it really belongs at
the start.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 03 Sep 2011 23:30:40 +0000 |
parents | ae615b3d3e47 |
children |
rev | line source |
---|---|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /* |
15823 | 2 * purple - Jabber Protocol Plugin |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
28398
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
28221
diff
changeset
|
4 * Purple is the legal property of its developers, whose names are too numerous |
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
28221
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
28221
diff
changeset
|
6 * source distribution. |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * along with this program; if not, write to the Free Software |
19680
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18294
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
22 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 #include "internal.h" |
18292
9db52d9b8436
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18259
diff
changeset
|
24 #include "core.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
25 #include "debug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 #include "prefs.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 #include "util.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 #include "buddy.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 #include "disco.h" |
30905
ae615b3d3e47
First shot at refactoring the Google-specific XMPP code.
Marcus Lundblad <ml@update.uu.se>
parents:
29463
diff
changeset
|
31 #include "google/gmail.h" |
ae615b3d3e47
First shot at refactoring the Google-specific XMPP code.
Marcus Lundblad <ml@update.uu.se>
parents:
29463
diff
changeset
|
32 #include "google/google.h" |
ae615b3d3e47
First shot at refactoring the Google-specific XMPP code.
Marcus Lundblad <ml@update.uu.se>
parents:
29463
diff
changeset
|
33 #include "google/jingleinfo.h" |
ae615b3d3e47
First shot at refactoring the Google-specific XMPP code.
Marcus Lundblad <ml@update.uu.se>
parents:
29463
diff
changeset
|
34 #include "google/google_session.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 #include "iq.h" |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25704
diff
changeset
|
36 #include "jingle/jingle.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 #include "oob.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 #include "roster.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 #include "si.h" |
17562
6ab1089e2101
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents:
15823
diff
changeset
|
40 #include "ping.h" |
17598
43df07968000
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 <pidgin@monitzer.com>
parents:
17562
diff
changeset
|
41 #include "adhoccommands.h" |
23445
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
22913
diff
changeset
|
42 #include "data.h" |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
22913
diff
changeset
|
43 #include "ibb.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 #ifdef _WIN32 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 #include "utsname.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 |
29463 | 49 static GHashTable *iq_handlers = NULL; |
50 static GHashTable *signal_iq_handlers = NULL; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 JabberIq *jabber_iq_new(JabberStream *js, JabberIqType type) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
54 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
56 iq = g_new0(JabberIq, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 iq->type = type; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
59 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
60 iq->node = xmlnode_new("iq"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 switch(iq->type) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 case JABBER_IQ_SET: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
63 xmlnode_set_attrib(iq->node, "type", "set"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
64 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
65 case JABBER_IQ_GET: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
66 xmlnode_set_attrib(iq->node, "type", "get"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
67 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
68 case JABBER_IQ_ERROR: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
69 xmlnode_set_attrib(iq->node, "type", "error"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
70 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
71 case JABBER_IQ_RESULT: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
72 xmlnode_set_attrib(iq->node, "type", "result"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
73 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
74 case JABBER_IQ_NONE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
75 /* this shouldn't ever happen */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
76 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
77 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
78 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 iq->js = js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
80 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 if(type == JABBER_IQ_GET || type == JABBER_IQ_SET) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
82 iq->id = jabber_get_next_id(js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
83 xmlnode_set_attrib(iq->node, "id", iq->id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
84 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
86 return iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
87 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
88 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
89 JabberIq *jabber_iq_new_query(JabberStream *js, JabberIqType type, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 const char *xmlns) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
91 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 JabberIq *iq = jabber_iq_new(js, type); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 xmlnode *query; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
94 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 query = xmlnode_new_child(iq->node, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
96 xmlnode_set_namespace(query, xmlns); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
97 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
98 return iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
99 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
100 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 typedef struct _JabberCallbackData { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
102 JabberIqCallback *callback; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
103 gpointer data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
104 } JabberCallbackData; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
107 jabber_iq_set_callback(JabberIq *iq, JabberIqCallback *callback, gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
109 iq->callback = callback; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
110 iq->callback_data = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
111 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 void jabber_iq_set_id(JabberIq *iq, const char *id) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
114 { |
24244
040c66dffbf0
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23988
diff
changeset
|
115 g_free(iq->id); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 if(id) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 xmlnode_set_attrib(iq->node, "id", id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
119 iq->id = g_strdup(id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
120 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
121 xmlnode_remove_attrib(iq->node, "id"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
122 iq->id = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
125 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
126 void jabber_iq_send(JabberIq *iq) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
128 JabberCallbackData *jcd; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 g_return_if_fail(iq != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
130 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
131 jabber_send(iq->js, iq->node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
132 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
133 if(iq->id && iq->callback) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
134 jcd = g_new0(JabberCallbackData, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
135 jcd->callback = iq->callback; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
136 jcd->data = iq->callback_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
137 g_hash_table_insert(iq->js->iq_callbacks, g_strdup(iq->id), jcd); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
138 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
139 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
140 jabber_iq_free(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
141 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
142 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
143 void jabber_iq_free(JabberIq *iq) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
144 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
145 g_return_if_fail(iq != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
146 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
147 g_free(iq->id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
148 xmlnode_free(iq->node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
149 g_free(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
150 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
151 |
25933
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
152 static void jabber_iq_last_parse(JabberStream *js, const char *from, |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
153 JabberIqType type, const char *id, |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
154 xmlnode *packet) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
155 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
156 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
157 xmlnode *query; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 char *idle_time; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 |
25933
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
160 if(type == JABBER_IQ_GET) { |
29031
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
29027
diff
changeset
|
161 iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, NS_LAST_ACTIVITY); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
162 jabber_iq_set_id(iq, id); |
25934
c8606917787a
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <paul@darkrain42.org>
parents:
25933
diff
changeset
|
163 if (from) |
c8606917787a
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <paul@darkrain42.org>
parents:
25933
diff
changeset
|
164 xmlnode_set_attrib(iq->node, "to", from); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 query = xmlnode_get_child(iq->node, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
167 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
168 idle_time = g_strdup_printf("%ld", js->idle ? time(NULL) - js->idle : 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 xmlnode_set_attrib(query, "seconds", idle_time); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 g_free(idle_time); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
171 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
172 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
173 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
174 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
175 |
27188
add3989f682e
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <paul@darkrain42.org>
parents:
27033
diff
changeset
|
176 static void jabber_time_parse(JabberStream *js, const char *from, |
add3989f682e
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <paul@darkrain42.org>
parents:
27033
diff
changeset
|
177 JabberIqType type, const char *id, |
add3989f682e
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <paul@darkrain42.org>
parents:
27033
diff
changeset
|
178 xmlnode *child) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
179 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
180 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
181 time_t now_t; |
27188
add3989f682e
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <paul@darkrain42.org>
parents:
27033
diff
changeset
|
182 struct tm *tm; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
183 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
184 time(&now_t); |
18259
c5c265dff90c
support replying to XEP-0202 queries
Nathan Walp <nwalp@pidgin.im>
parents:
18122
diff
changeset
|
185 |
25933
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
186 if(type == JABBER_IQ_GET) { |
27188
add3989f682e
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <paul@darkrain42.org>
parents:
27033
diff
changeset
|
187 xmlnode *tzo, *utc; |
add3989f682e
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <paul@darkrain42.org>
parents:
27033
diff
changeset
|
188 const char *date, *tz; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
189 |
25926
865123f21a72
Fix the implementation of XEP-0202 (Entity Time) (thanks again to Marcus)
Paul Aurich <paul@darkrain42.org>
parents:
25924
diff
changeset
|
190 iq = jabber_iq_new(js, JABBER_IQ_RESULT); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 jabber_iq_set_id(iq, id); |
25934
c8606917787a
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <paul@darkrain42.org>
parents:
25933
diff
changeset
|
192 if (from) |
c8606917787a
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <paul@darkrain42.org>
parents:
25933
diff
changeset
|
193 xmlnode_set_attrib(iq->node, "to", from); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
194 |
25926
865123f21a72
Fix the implementation of XEP-0202 (Entity Time) (thanks again to Marcus)
Paul Aurich <paul@darkrain42.org>
parents:
25924
diff
changeset
|
195 child = xmlnode_new_child(iq->node, child->name); |
29031
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
29027
diff
changeset
|
196 xmlnode_set_namespace(child, NS_ENTITY_TIME); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
197 |
27188
add3989f682e
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <paul@darkrain42.org>
parents:
27033
diff
changeset
|
198 /* <tzo>-06:00</tzo> */ |
add3989f682e
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <paul@darkrain42.org>
parents:
27033
diff
changeset
|
199 tm = localtime(&now_t); |
add3989f682e
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <paul@darkrain42.org>
parents:
27033
diff
changeset
|
200 tz = purple_get_tzoff_str(tm, TRUE); |
add3989f682e
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <paul@darkrain42.org>
parents:
27033
diff
changeset
|
201 tzo = xmlnode_new_child(child, "tzo"); |
add3989f682e
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <paul@darkrain42.org>
parents:
27033
diff
changeset
|
202 xmlnode_insert_data(tzo, tz, -1); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 |
27188
add3989f682e
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <paul@darkrain42.org>
parents:
27033
diff
changeset
|
204 /* <utc>2006-12-19T17:58:35Z</utc> */ |
add3989f682e
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <paul@darkrain42.org>
parents:
27033
diff
changeset
|
205 tm = gmtime(&now_t); |
29057
8d213c65abad
jabber: Don't use C99 time formatters, which are apparently not available on Windows when using MSVC.
Florian Quèze <florian@instantbird.org>
parents:
29031
diff
changeset
|
206 date = purple_utf8_strftime("%Y-%m-%dT%H:%M:%SZ", tm); |
27188
add3989f682e
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <paul@darkrain42.org>
parents:
27033
diff
changeset
|
207 utc = xmlnode_new_child(child, "utc"); |
add3989f682e
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <paul@darkrain42.org>
parents:
27033
diff
changeset
|
208 xmlnode_insert_data(utc, date, -1); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 jabber_iq_send(iq); |
27188
add3989f682e
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <paul@darkrain42.org>
parents:
27033
diff
changeset
|
211 } else { |
add3989f682e
Remove obsoleted XEP-0090 (Legacy Entity Time)
Paul Aurich <paul@darkrain42.org>
parents:
27033
diff
changeset
|
212 /* TODO: Errors */ |
18109
3d7129ac1de9
respond to XEP-0199 queries (XMPP ping)
Nathan Walp <nwalp@pidgin.im>
parents:
17859
diff
changeset
|
213 } |
3d7129ac1de9
respond to XEP-0199 queries (XMPP ping)
Nathan Walp <nwalp@pidgin.im>
parents:
17859
diff
changeset
|
214 } |
3d7129ac1de9
respond to XEP-0199 queries (XMPP ping)
Nathan Walp <nwalp@pidgin.im>
parents:
17859
diff
changeset
|
215 |
25933
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
216 static void jabber_iq_version_parse(JabberStream *js, const char *from, |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
217 JabberIqType type, const char *id, |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
218 xmlnode *packet) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
219 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
220 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
221 xmlnode *query; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
222 |
25933
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
223 if(type == JABBER_IQ_GET) { |
18292
9db52d9b8436
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18259
diff
changeset
|
224 GHashTable *ui_info; |
9db52d9b8436
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18259
diff
changeset
|
225 const char *ui_name = NULL, *ui_version = NULL; |
20220
23248bf2bffd
applied changes from 8543caa9958f323a231c630bebd65c74dec3401f
Richard Laager <rlaager@wiktel.com>
parents:
19696
diff
changeset
|
226 #if 0 |
20333
53afc5cce143
applied changes from d4b316d73ebaf93803ca2642e78b8821c3b5d5c7
Luke Schierer <lschiere@pidgin.im>
parents:
20220
diff
changeset
|
227 char *os = NULL; |
15823 | 228 if(!purple_prefs_get_bool("/plugins/prpl/jabber/hide_os")) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
229 struct utsname osinfo; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
231 uname(&osinfo); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
232 os = g_strdup_printf("%s %s %s", osinfo.sysname, osinfo.release, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
233 osinfo.machine); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 } |
20220
23248bf2bffd
applied changes from 8543caa9958f323a231c630bebd65c74dec3401f
Richard Laager <rlaager@wiktel.com>
parents:
19696
diff
changeset
|
235 #endif |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
236 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
237 iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, "jabber:iq:version"); |
25934
c8606917787a
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <paul@darkrain42.org>
parents:
25933
diff
changeset
|
238 if (from) |
c8606917787a
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <paul@darkrain42.org>
parents:
25933
diff
changeset
|
239 xmlnode_set_attrib(iq->node, "to", from); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
240 jabber_iq_set_id(iq, id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 query = xmlnode_get_child(iq->node, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 |
18292
9db52d9b8436
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18259
diff
changeset
|
244 ui_info = purple_core_get_ui_info(); |
9db52d9b8436
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18259
diff
changeset
|
245 |
9db52d9b8436
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18259
diff
changeset
|
246 if(NULL != ui_info) { |
9db52d9b8436
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18259
diff
changeset
|
247 ui_name = g_hash_table_lookup(ui_info, "name"); |
9db52d9b8436
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18259
diff
changeset
|
248 ui_version = g_hash_table_lookup(ui_info, "version"); |
9db52d9b8436
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18259
diff
changeset
|
249 } |
9db52d9b8436
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18259
diff
changeset
|
250 |
9db52d9b8436
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18259
diff
changeset
|
251 if(NULL != ui_name && NULL != ui_version) { |
18294 | 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); | |
18292
9db52d9b8436
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18259
diff
changeset
|
256 } else { |
9db52d9b8436
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18259
diff
changeset
|
257 xmlnode_insert_data(xmlnode_new_child(query, "name"), "libpurple", -1); |
9db52d9b8436
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18259
diff
changeset
|
258 xmlnode_insert_data(xmlnode_new_child(query, "version"), VERSION, -1); |
9db52d9b8436
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18259
diff
changeset
|
259 } |
9db52d9b8436
core support for UI info...now to do the UI piece
Nathan Walp <nwalp@pidgin.im>
parents:
18259
diff
changeset
|
260 |
20333
53afc5cce143
applied changes from d4b316d73ebaf93803ca2642e78b8821c3b5d5c7
Luke Schierer <lschiere@pidgin.im>
parents:
20220
diff
changeset
|
261 #if 0 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
262 if(os) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 xmlnode_insert_data(xmlnode_new_child(query, "os"), os, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
264 g_free(os); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
265 } |
20333
53afc5cce143
applied changes from d4b316d73ebaf93803ca2642e78b8821c3b5d5c7
Luke Schierer <lschiere@pidgin.im>
parents:
20220
diff
changeset
|
266 #endif |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
267 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
268 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
269 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
270 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
271 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
272 void jabber_iq_remove_callback_by_id(JabberStream *js, const char *id) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
273 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 g_hash_table_remove(js->iq_callbacks, id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
275 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
276 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
277 void jabber_iq_parse(JabberStream *js, xmlnode *packet) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
278 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
279 JabberCallbackData *jcd; |
25924
b5052c66701c
Jabber IQ handlers should handle non-query child nodes
Paul Aurich <paul@darkrain42.org>
parents:
24244
diff
changeset
|
280 xmlnode *child, *error, *x; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
281 const char *xmlns; |
25933
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
282 const char *iq_type, *id, *from; |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
283 JabberIqType type = JABBER_IQ_NONE; |
26952
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
284 gboolean signal_return; |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
285 |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
286 from = xmlnode_get_attrib(packet, "from"); |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
287 id = xmlnode_get_attrib(packet, "id"); |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
288 iq_type = xmlnode_get_attrib(packet, "type"); |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
289 |
25924
b5052c66701c
Jabber IQ handlers should handle non-query child nodes
Paul Aurich <paul@darkrain42.org>
parents:
24244
diff
changeset
|
290 /* |
b5052c66701c
Jabber IQ handlers should handle non-query child nodes
Paul Aurich <paul@darkrain42.org>
parents:
24244
diff
changeset
|
291 * child will be either the first tag child or NULL if there is no child. |
b5052c66701c
Jabber IQ handlers should handle non-query child nodes
Paul Aurich <paul@darkrain42.org>
parents:
24244
diff
changeset
|
292 * Historically, we used just the 'query' subchild, but newer XEPs use |
b5052c66701c
Jabber IQ handlers should handle non-query child nodes
Paul Aurich <paul@darkrain42.org>
parents:
24244
diff
changeset
|
293 * differently named children. Grabbing the first child is (for the time |
b5052c66701c
Jabber IQ handlers should handle non-query child nodes
Paul Aurich <paul@darkrain42.org>
parents:
24244
diff
changeset
|
294 * being) sufficient. |
b5052c66701c
Jabber IQ handlers should handle non-query child nodes
Paul Aurich <paul@darkrain42.org>
parents:
24244
diff
changeset
|
295 */ |
b5052c66701c
Jabber IQ handlers should handle non-query child nodes
Paul Aurich <paul@darkrain42.org>
parents:
24244
diff
changeset
|
296 for (child = packet->child; child; child = child->next) { |
25929
19fa48931b9d
This is shorter and easier to read.
Paul Aurich <paul@darkrain42.org>
parents:
25927
diff
changeset
|
297 if (child->type == XMLNODE_TYPE_TAG) |
19fa48931b9d
This is shorter and easier to read.
Paul Aurich <paul@darkrain42.org>
parents:
25927
diff
changeset
|
298 break; |
25924
b5052c66701c
Jabber IQ handlers should handle non-query child nodes
Paul Aurich <paul@darkrain42.org>
parents:
24244
diff
changeset
|
299 } |
b5052c66701c
Jabber IQ handlers should handle non-query child nodes
Paul Aurich <paul@darkrain42.org>
parents:
24244
diff
changeset
|
300 |
25933
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
301 if (iq_type) { |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
302 if (!strcmp(iq_type, "get")) |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
303 type = JABBER_IQ_GET; |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
304 else if (!strcmp(iq_type, "set")) |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
305 type = JABBER_IQ_SET; |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
306 else if (!strcmp(iq_type, "result")) |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
307 type = JABBER_IQ_RESULT; |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
308 else if (!strcmp(iq_type, "error")) |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
309 type = JABBER_IQ_ERROR; |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
310 } |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
311 |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
312 if (type == JABBER_IQ_NONE) { |
24244
040c66dffbf0
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23988
diff
changeset
|
313 purple_debug_error("jabber", "IQ with invalid type ('%s') - ignoring.\n", |
25933
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
314 iq_type ? iq_type : "(null)"); |
24244
040c66dffbf0
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23988
diff
changeset
|
315 return; |
040c66dffbf0
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23988
diff
changeset
|
316 } |
040c66dffbf0
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23988
diff
changeset
|
317 |
040c66dffbf0
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23988
diff
changeset
|
318 /* All IQs must have an ID, so send an error for a set/get that doesn't */ |
040c66dffbf0
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23988
diff
changeset
|
319 if(!id || !*id) { |
040c66dffbf0
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23988
diff
changeset
|
320 |
25933
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
321 if(type == JABBER_IQ_SET || type == JABBER_IQ_GET) { |
24244
040c66dffbf0
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23988
diff
changeset
|
322 JabberIq *iq = jabber_iq_new(js, JABBER_IQ_ERROR); |
040c66dffbf0
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23988
diff
changeset
|
323 |
040c66dffbf0
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23988
diff
changeset
|
324 xmlnode_free(iq->node); |
040c66dffbf0
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23988
diff
changeset
|
325 iq->node = xmlnode_copy(packet); |
25934
c8606917787a
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <paul@darkrain42.org>
parents:
25933
diff
changeset
|
326 if (from) { |
c8606917787a
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <paul@darkrain42.org>
parents:
25933
diff
changeset
|
327 xmlnode_set_attrib(iq->node, "to", from); |
c8606917787a
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <paul@darkrain42.org>
parents:
25933
diff
changeset
|
328 xmlnode_remove_attrib(iq->node, "from"); |
c8606917787a
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <paul@darkrain42.org>
parents:
25933
diff
changeset
|
329 } |
c8606917787a
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <paul@darkrain42.org>
parents:
25933
diff
changeset
|
330 |
24244
040c66dffbf0
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23988
diff
changeset
|
331 xmlnode_set_attrib(iq->node, "type", "error"); |
040c66dffbf0
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23988
diff
changeset
|
332 /* This id is clearly not useful, but we must put something there for a valid stanza */ |
040c66dffbf0
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23988
diff
changeset
|
333 iq->id = jabber_get_next_id(js); |
040c66dffbf0
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23988
diff
changeset
|
334 xmlnode_set_attrib(iq->node, "id", iq->id); |
040c66dffbf0
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23988
diff
changeset
|
335 error = xmlnode_new_child(iq->node, "error"); |
040c66dffbf0
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23988
diff
changeset
|
336 xmlnode_set_attrib(error, "type", "modify"); |
040c66dffbf0
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23988
diff
changeset
|
337 x = xmlnode_new_child(error, "bad-request"); |
29031
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
29027
diff
changeset
|
338 xmlnode_set_namespace(x, NS_XMPP_STANZAS); |
24244
040c66dffbf0
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23988
diff
changeset
|
339 |
040c66dffbf0
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23988
diff
changeset
|
340 jabber_iq_send(iq); |
040c66dffbf0
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23988
diff
changeset
|
341 } else |
25933
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
342 purple_debug_error("jabber", "IQ of type '%s' missing id - ignoring.\n", |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
343 iq_type); |
24244
040c66dffbf0
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23988
diff
changeset
|
344 |
040c66dffbf0
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23988
diff
changeset
|
345 return; |
040c66dffbf0
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23988
diff
changeset
|
346 } |
040c66dffbf0
Perform some sanity checking on inbound IQs and send an error / drop as needed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23988
diff
changeset
|
347 |
28893
96ba7fd24177
jabber: Use purple_connection_get_prpl() instead of jabber_plugin.
Paul Aurich <paul@darkrain42.org>
parents:
28398
diff
changeset
|
348 signal_return = GPOINTER_TO_INT(purple_signal_emit_return_1(purple_connection_get_prpl(js->gc), |
28221
e502112a03e7
jabber: Emit jabber-receiving-iq after we've ensured id is !NULL
Paul Aurich <paul@darkrain42.org>
parents:
27188
diff
changeset
|
349 "jabber-receiving-iq", js->gc, iq_type, id, from, packet)); |
e502112a03e7
jabber: Emit jabber-receiving-iq after we've ensured id is !NULL
Paul Aurich <paul@darkrain42.org>
parents:
27188
diff
changeset
|
350 if (signal_return) |
e502112a03e7
jabber: Emit jabber-receiving-iq after we've ensured id is !NULL
Paul Aurich <paul@darkrain42.org>
parents:
27188
diff
changeset
|
351 return; |
e502112a03e7
jabber: Emit jabber-receiving-iq after we've ensured id is !NULL
Paul Aurich <paul@darkrain42.org>
parents:
27188
diff
changeset
|
352 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
353 /* First, lets see if a special callback got registered */ |
25933
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
354 if(type == JABBER_IQ_RESULT || type == JABBER_IQ_ERROR) { |
25947
ba2b63988b3c
Remove a "suggested parenthes around assignment" warning
Paul Aurich <paul@darkrain42.org>
parents:
25946
diff
changeset
|
355 if((jcd = g_hash_table_lookup(js->iq_callbacks, id))) { |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
356 jcd->callback(js, from, type, id, packet, jcd->data); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
357 jabber_iq_remove_callback_by_id(js, id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
358 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
359 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
360 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
361 |
26952
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
362 /* |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
363 * Apparently not, so let's see if we have a pre-defined handler |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
364 * or if an outside plugin is interested. |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
365 */ |
25924
b5052c66701c
Jabber IQ handlers should handle non-query child nodes
Paul Aurich <paul@darkrain42.org>
parents:
24244
diff
changeset
|
366 if(child && (xmlns = xmlnode_get_namespace(child))) { |
25931
89c4edb5e545
Track the node name in addition to the namespace for handlers (try #2)
Paul Aurich <paul@darkrain42.org>
parents:
25930
diff
changeset
|
367 char *key = g_strdup_printf("%s %s", child->name, xmlns); |
89c4edb5e545
Track the node name in addition to the namespace for handlers (try #2)
Paul Aurich <paul@darkrain42.org>
parents:
25930
diff
changeset
|
368 JabberIqHandler *jih = g_hash_table_lookup(iq_handlers, key); |
26952
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
369 int signal_ref = GPOINTER_TO_INT(g_hash_table_lookup(signal_iq_handlers, key)); |
25931
89c4edb5e545
Track the node name in addition to the namespace for handlers (try #2)
Paul Aurich <paul@darkrain42.org>
parents:
25930
diff
changeset
|
370 g_free(key); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
371 |
26952
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
372 if (signal_ref > 0) { |
28893
96ba7fd24177
jabber: Use purple_connection_get_prpl() instead of jabber_plugin.
Paul Aurich <paul@darkrain42.org>
parents:
28398
diff
changeset
|
373 signal_return = GPOINTER_TO_INT(purple_signal_emit_return_1(purple_connection_get_prpl(js->gc), "jabber-watched-iq", |
26952
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
374 js->gc, iq_type, id, from, child)); |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
375 if (signal_return) |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
376 return; |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
377 } |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
378 |
25931
89c4edb5e545
Track the node name in addition to the namespace for handlers (try #2)
Paul Aurich <paul@darkrain42.org>
parents:
25930
diff
changeset
|
379 if(jih) { |
25933
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
380 jih(js, from, type, id, child); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
381 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
382 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
383 } |
26416
6f0200f1e497
Clean up usage of USE_VV in the XMPP protocol.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26213
diff
changeset
|
384 |
29428
08cc1cf27ac4
jabber: Log a more useful message on unhandled IQs
Paul Aurich <paul@darkrain42.org>
parents:
29057
diff
changeset
|
385 purple_debug_misc("jabber", "Unhandled IQ with id %s\n", id); |
17562
6ab1089e2101
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents:
15823
diff
changeset
|
386 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
387 /* If we get here, send the default error reply mandated by XMPP-CORE */ |
25933
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25932
diff
changeset
|
388 if(type == JABBER_IQ_SET || type == JABBER_IQ_GET) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
389 JabberIq *iq = jabber_iq_new(js, JABBER_IQ_ERROR); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
390 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
391 xmlnode_free(iq->node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
392 iq->node = xmlnode_copy(packet); |
25934
c8606917787a
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <paul@darkrain42.org>
parents:
25933
diff
changeset
|
393 if (from) { |
c8606917787a
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <paul@darkrain42.org>
parents:
25933
diff
changeset
|
394 xmlnode_set_attrib(iq->node, "to", from); |
c8606917787a
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <paul@darkrain42.org>
parents:
25933
diff
changeset
|
395 xmlnode_remove_attrib(iq->node, "from"); |
c8606917787a
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <paul@darkrain42.org>
parents:
25933
diff
changeset
|
396 } |
c8606917787a
Avoid assertion failures on NULL 'from' attributes
Paul Aurich <paul@darkrain42.org>
parents:
25933
diff
changeset
|
397 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
398 xmlnode_set_attrib(iq->node, "type", "error"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
399 error = xmlnode_new_child(iq->node, "error"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
400 xmlnode_set_attrib(error, "type", "cancel"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
401 xmlnode_set_attrib(error, "code", "501"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
402 x = xmlnode_new_child(error, "feature-not-implemented"); |
29031
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
29027
diff
changeset
|
403 xmlnode_set_namespace(x, NS_XMPP_STANZAS); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
404 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
405 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
406 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
407 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
408 |
25931
89c4edb5e545
Track the node name in addition to the namespace for handlers (try #2)
Paul Aurich <paul@darkrain42.org>
parents:
25930
diff
changeset
|
409 void jabber_iq_register_handler(const char *node, const char *xmlns, JabberIqHandler *handlerfunc) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
410 { |
25931
89c4edb5e545
Track the node name in addition to the namespace for handlers (try #2)
Paul Aurich <paul@darkrain42.org>
parents:
25930
diff
changeset
|
411 /* |
89c4edb5e545
Track the node name in addition to the namespace for handlers (try #2)
Paul Aurich <paul@darkrain42.org>
parents:
25930
diff
changeset
|
412 * This is valid because nodes nor namespaces cannot have spaces in them |
89c4edb5e545
Track the node name in addition to the namespace for handlers (try #2)
Paul Aurich <paul@darkrain42.org>
parents:
25930
diff
changeset
|
413 * (see http://www.w3.org/TR/2006/REC-xml-20060816/ and |
89c4edb5e545
Track the node name in addition to the namespace for handlers (try #2)
Paul Aurich <paul@darkrain42.org>
parents:
25930
diff
changeset
|
414 * http://www.w3.org/TR/REC-xml-names/) |
89c4edb5e545
Track the node name in addition to the namespace for handlers (try #2)
Paul Aurich <paul@darkrain42.org>
parents:
25930
diff
changeset
|
415 */ |
89c4edb5e545
Track the node name in addition to the namespace for handlers (try #2)
Paul Aurich <paul@darkrain42.org>
parents:
25930
diff
changeset
|
416 char *key = g_strdup_printf("%s %s", node, xmlns); |
89c4edb5e545
Track the node name in addition to the namespace for handlers (try #2)
Paul Aurich <paul@darkrain42.org>
parents:
25930
diff
changeset
|
417 g_hash_table_replace(iq_handlers, key, handlerfunc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
418 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
419 |
26952
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
420 void jabber_iq_signal_register(const gchar *node, const gchar *xmlns) |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
421 { |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
422 gchar *key; |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
423 int ref; |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
424 |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
425 g_return_if_fail(node != NULL && *node != '\0'); |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
426 g_return_if_fail(xmlns != NULL && *xmlns != '\0'); |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
427 |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
428 key = g_strdup_printf("%s %s", node, xmlns); |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
429 ref = GPOINTER_TO_INT(g_hash_table_lookup(signal_iq_handlers, key)); |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
430 if (ref == 0) { |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
431 g_hash_table_insert(signal_iq_handlers, key, GINT_TO_POINTER(1)); |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
432 } else { |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
433 g_hash_table_insert(signal_iq_handlers, key, GINT_TO_POINTER(ref + 1)); |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
434 g_free(key); |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
435 } |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
436 } |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
437 |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
438 void jabber_iq_signal_unregister(const gchar *node, const gchar *xmlns) |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
439 { |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
440 gchar *key; |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
441 int ref; |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
442 |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
443 g_return_if_fail(node != NULL && *node != '\0'); |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
444 g_return_if_fail(xmlns != NULL && *xmlns != '\0'); |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
445 |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
446 key = g_strdup_printf("%s %s", node, xmlns); |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
447 ref = GPOINTER_TO_INT(g_hash_table_lookup(signal_iq_handlers, key)); |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
448 |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
449 if (ref == 1) { |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
450 g_hash_table_remove(signal_iq_handlers, key); |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
451 } else if (ref > 1) { |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
452 g_hash_table_insert(signal_iq_handlers, key, GINT_TO_POINTER(ref - 1)); |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
453 } |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
454 |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
455 g_free(key); |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
456 } |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
457 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
458 void jabber_iq_init(void) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
459 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
460 iq_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); |
26952
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
461 signal_iq_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
462 |
26564
457dca546b23
Gratuitous alphabetization of the IQ handlers (again!) and move the data handler to jabber_data_init
Paul Aurich <paul@darkrain42.org>
parents:
26561
diff
changeset
|
463 jabber_iq_register_handler("jingle", JINGLE, jingle_parse); |
29031
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
29027
diff
changeset
|
464 jabber_iq_register_handler("mailbox", NS_GOOGLE_MAIL_NOTIFY, |
26564
457dca546b23
Gratuitous alphabetization of the IQ handlers (again!) and move the data handler to jabber_data_init
Paul Aurich <paul@darkrain42.org>
parents:
26561
diff
changeset
|
465 jabber_gmail_poke); |
29031
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
29027
diff
changeset
|
466 jabber_iq_register_handler("new-mail", NS_GOOGLE_MAIL_NOTIFY, |
26564
457dca546b23
Gratuitous alphabetization of the IQ handlers (again!) and move the data handler to jabber_data_init
Paul Aurich <paul@darkrain42.org>
parents:
26561
diff
changeset
|
467 jabber_gmail_poke); |
29026
7b4ade7c6d8a
jabber: Start putting all the namespaces in one location with consistent naming.
Paul Aurich <paul@darkrain42.org>
parents:
28893
diff
changeset
|
468 jabber_iq_register_handler("ping", NS_PING, jabber_ping_parse); |
7b4ade7c6d8a
jabber: Start putting all the namespaces in one location with consistent naming.
Paul Aurich <paul@darkrain42.org>
parents:
28893
diff
changeset
|
469 jabber_iq_register_handler("query", NS_GOOGLE_JINGLE_INFO, |
26564
457dca546b23
Gratuitous alphabetization of the IQ handlers (again!) and move the data handler to jabber_data_init
Paul Aurich <paul@darkrain42.org>
parents:
26561
diff
changeset
|
470 jabber_google_handle_jingle_info); |
29031
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
29027
diff
changeset
|
471 jabber_iq_register_handler("query", NS_BYTESTREAMS, |
26564
457dca546b23
Gratuitous alphabetization of the IQ handlers (again!) and move the data handler to jabber_data_init
Paul Aurich <paul@darkrain42.org>
parents:
26561
diff
changeset
|
472 jabber_bytestreams_parse); |
29031
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
29027
diff
changeset
|
473 jabber_iq_register_handler("query", NS_DISCO_INFO, jabber_disco_info_parse); |
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
29027
diff
changeset
|
474 jabber_iq_register_handler("query", NS_DISCO_ITEMS, jabber_disco_items_parse); |
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
29027
diff
changeset
|
475 jabber_iq_register_handler("query", NS_LAST_ACTIVITY, jabber_iq_last_parse); |
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
29027
diff
changeset
|
476 jabber_iq_register_handler("query", NS_OOB_IQ_DATA, jabber_oob_parse); |
26564
457dca546b23
Gratuitous alphabetization of the IQ handlers (again!) and move the data handler to jabber_data_init
Paul Aurich <paul@darkrain42.org>
parents:
26561
diff
changeset
|
477 jabber_iq_register_handler("query", "jabber:iq:register", |
457dca546b23
Gratuitous alphabetization of the IQ handlers (again!) and move the data handler to jabber_data_init
Paul Aurich <paul@darkrain42.org>
parents:
26561
diff
changeset
|
478 jabber_register_parse); |
457dca546b23
Gratuitous alphabetization of the IQ handlers (again!) and move the data handler to jabber_data_init
Paul Aurich <paul@darkrain42.org>
parents:
26561
diff
changeset
|
479 jabber_iq_register_handler("query", "jabber:iq:roster", |
457dca546b23
Gratuitous alphabetization of the IQ handlers (again!) and move the data handler to jabber_data_init
Paul Aurich <paul@darkrain42.org>
parents:
26561
diff
changeset
|
480 jabber_roster_parse); |
457dca546b23
Gratuitous alphabetization of the IQ handlers (again!) and move the data handler to jabber_data_init
Paul Aurich <paul@darkrain42.org>
parents:
26561
diff
changeset
|
481 jabber_iq_register_handler("query", "jabber:iq:version", |
457dca546b23
Gratuitous alphabetization of the IQ handlers (again!) and move the data handler to jabber_data_init
Paul Aurich <paul@darkrain42.org>
parents:
26561
diff
changeset
|
482 jabber_iq_version_parse); |
26557
bf9438ea308d
Fix-up the merge some more (*sigh*), readding <session/> handler
Paul Aurich <paul@darkrain42.org>
parents:
26555
diff
changeset
|
483 #ifdef USE_VV |
29027
9feec7d1d95c
jabber: Add the missing file and fix up the Google session namespaces
Paul Aurich <paul@darkrain42.org>
parents:
29026
diff
changeset
|
484 jabber_iq_register_handler("session", NS_GOOGLE_SESSION, |
26557
bf9438ea308d
Fix-up the merge some more (*sigh*), readding <session/> handler
Paul Aurich <paul@darkrain42.org>
parents:
26555
diff
changeset
|
485 jabber_google_session_parse); |
bf9438ea308d
Fix-up the merge some more (*sigh*), readding <session/> handler
Paul Aurich <paul@darkrain42.org>
parents:
26555
diff
changeset
|
486 #endif |
29031
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
29027
diff
changeset
|
487 jabber_iq_register_handler("block", NS_SIMPLE_BLOCKING, jabber_blocklist_parse_push); |
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
29027
diff
changeset
|
488 jabber_iq_register_handler("unblock", NS_SIMPLE_BLOCKING, jabber_blocklist_parse_push); |
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
29027
diff
changeset
|
489 jabber_iq_register_handler("time", NS_ENTITY_TIME, jabber_time_parse); |
26564
457dca546b23
Gratuitous alphabetization of the IQ handlers (again!) and move the data handler to jabber_data_init
Paul Aurich <paul@darkrain42.org>
parents:
26561
diff
changeset
|
490 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
491 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
492 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
493 void jabber_iq_uninit(void) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
494 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
495 g_hash_table_destroy(iq_handlers); |
26952
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
496 g_hash_table_destroy(signal_iq_handlers); |
92565c8e1e3a
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 <paul@darkrain42.org>
parents:
26564
diff
changeset
|
497 iq_handlers = signal_iq_handlers = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
498 } |