annotate pidgin/plugins/disco/xmppdisco.c @ 32310:142429bcb4c8

propagate from branch 'im.pidgin.pidgin' (head bb53d1e9201138b79a1eef0d4a7cda1fc852c59f) to branch 'im.pidgin.pidgin.next.major' (head 85a38af15472bf17064bbe597f94f32ad167c4e6)
author Mark Doliner <mark@kingant.net>
date Sun, 07 Aug 2011 05:19:54 +0000
parents ebb0f7d27f5b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1 /*
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
2 * Purple - XMPP Service Disco Browser
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
3 *
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
4 * This program is free software; you can redistribute it and/or modify
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
7 * (at your option) any later version.
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
8 *
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
9 * This program is distributed in the hope that it will be useful,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
12 * GNU General Public License for more details.
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
13 *
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
15 * along with this program; if not, write to the Free Software
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
17 *
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
18 */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
19
27108
53294b47a4a6 Fix an issue with the server responding with jid/node items as first-level children and add a TODO.
Paul Aurich <paul@darkrain42.org>
parents: 27089
diff changeset
20 /* TODO list (a little bit of a brain dump):
27113
2f10136a6d28 Hmm, this wasn't saved when I committed it.
Paul Aurich <paul@darkrain42.org>
parents: 27108
diff changeset
21 * Support more actions than "register" and "add" based on context.
2f10136a6d28 Hmm, this wasn't saved when I committed it.
Paul Aurich <paul@darkrain42.org>
parents: 27108
diff changeset
22 - Subscribe to pubsub nodes (just...because?)
27108
53294b47a4a6 Fix an issue with the server responding with jid/node items as first-level children and add a TODO.
Paul Aurich <paul@darkrain42.org>
parents: 27089
diff changeset
23 - Execute ad-hoc commands
53294b47a4a6 Fix an issue with the server responding with jid/node items as first-level children and add a TODO.
Paul Aurich <paul@darkrain42.org>
parents: 27089
diff changeset
24 - Change 'Register' to 'Unregister' if we're registered?
53294b47a4a6 Fix an issue with the server responding with jid/node items as first-level children and add a TODO.
Paul Aurich <paul@darkrain42.org>
parents: 27089
diff changeset
25 - Administer MUCs
27113
2f10136a6d28 Hmm, this wasn't saved when I committed it.
Paul Aurich <paul@darkrain42.org>
parents: 27108
diff changeset
26 * Enumerate pubsub node contents.
2f10136a6d28 Hmm, this wasn't saved when I committed it.
Paul Aurich <paul@darkrain42.org>
parents: 27108
diff changeset
27 - PEP too? (useful development tool at times)
2f10136a6d28 Hmm, this wasn't saved when I committed it.
Paul Aurich <paul@darkrain42.org>
parents: 27108
diff changeset
28 * See if we can better handle the ad-hoc commands that ejabberd returns
2f10136a6d28 Hmm, this wasn't saved when I committed it.
Paul Aurich <paul@darkrain42.org>
parents: 27108
diff changeset
29 when disco'ing a server as an administrator:
27108
53294b47a4a6 Fix an issue with the server responding with jid/node items as first-level children and add a TODO.
Paul Aurich <paul@darkrain42.org>
parents: 27089
diff changeset
30 from disco#items:
53294b47a4a6 Fix an issue with the server responding with jid/node items as first-level children and add a TODO.
Paul Aurich <paul@darkrain42.org>
parents: 27089
diff changeset
31 <item jid='darkrain42.org' node='announce' name='Announcements'/>
53294b47a4a6 Fix an issue with the server responding with jid/node items as first-level children and add a TODO.
Paul Aurich <paul@darkrain42.org>
parents: 27089
diff changeset
32 disco#info:
53294b47a4a6 Fix an issue with the server responding with jid/node items as first-level children and add a TODO.
Paul Aurich <paul@darkrain42.org>
parents: 27089
diff changeset
33 <iq from='darkrain42.org' type='result'>
53294b47a4a6 Fix an issue with the server responding with jid/node items as first-level children and add a TODO.
Paul Aurich <paul@darkrain42.org>
parents: 27089
diff changeset
34 <query xmlns='http://jabber.org/protocol/disco#info' node='announce'/>
53294b47a4a6 Fix an issue with the server responding with jid/node items as first-level children and add a TODO.
Paul Aurich <paul@darkrain42.org>
parents: 27089
diff changeset
35 </iq>
53294b47a4a6 Fix an issue with the server responding with jid/node items as first-level children and add a TODO.
Paul Aurich <paul@darkrain42.org>
parents: 27089
diff changeset
36 * For services that are a JID w/o a node, handle fetching ad-hoc commands?
53294b47a4a6 Fix an issue with the server responding with jid/node items as first-level children and add a TODO.
Paul Aurich <paul@darkrain42.org>
parents: 27089
diff changeset
37 */
53294b47a4a6 Fix an issue with the server responding with jid/node items as first-level children and add a TODO.
Paul Aurich <paul@darkrain42.org>
parents: 27089
diff changeset
38
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
39 #include "internal.h"
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
40 #include "pidgin.h"
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
41
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
42 #include "debug.h"
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
43 #include "signals.h"
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
44 #include "version.h"
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
45
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
46 #include "gtkconv.h"
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
47 #include "gtkimhtml.h"
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
48 #include "gtkplugin.h"
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
49
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
50 #include "xmppdisco.h"
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
51 #include "gtkdisco.h"
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
52
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
53 /* Variables */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
54 PurplePlugin *my_plugin = NULL;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
55 static GHashTable *iq_callbacks = NULL;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
56 static gboolean iq_listening = FALSE;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
57
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
58 typedef void (*XmppIqCallback)(PurpleConnection *pc, const char *type,
27158
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27126
diff changeset
59 const char *id, const char *from, xmlnode *iq,
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27126
diff changeset
60 gpointer data);
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
61
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
62 struct item_data {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
63 PidginDiscoList *list;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
64 XmppDiscoService *parent;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
65 char *name;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
66 char *node; /* disco#info replies don't always include the node */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
67 };
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
68
27482
ebb0f7d27f5b Make the use of xmpp_iq_cb_data->context explicit.
Paul Aurich <paul@darkrain42.org>
parents: 27371
diff changeset
69 struct xmpp_iq_cb_data
ebb0f7d27f5b Make the use of xmpp_iq_cb_data->context explicit.
Paul Aurich <paul@darkrain42.org>
parents: 27371
diff changeset
70 {
ebb0f7d27f5b Make the use of xmpp_iq_cb_data->context explicit.
Paul Aurich <paul@darkrain42.org>
parents: 27371
diff changeset
71 /*
ebb0f7d27f5b Make the use of xmpp_iq_cb_data->context explicit.
Paul Aurich <paul@darkrain42.org>
parents: 27371
diff changeset
72 * Every IQ callback in this plugin uses the same structure for the
ebb0f7d27f5b Make the use of xmpp_iq_cb_data->context explicit.
Paul Aurich <paul@darkrain42.org>
parents: 27371
diff changeset
73 * callback data. It's a hack (it wouldn't scale), but it's used so that
ebb0f7d27f5b Make the use of xmpp_iq_cb_data->context explicit.
Paul Aurich <paul@darkrain42.org>
parents: 27371
diff changeset
74 * it's easy to clean up all the callbacks when the account disconnects
ebb0f7d27f5b Make the use of xmpp_iq_cb_data->context explicit.
Paul Aurich <paul@darkrain42.org>
parents: 27371
diff changeset
75 * (see remove_iq_callbacks_by_pc below).
ebb0f7d27f5b Make the use of xmpp_iq_cb_data->context explicit.
Paul Aurich <paul@darkrain42.org>
parents: 27371
diff changeset
76 */
ebb0f7d27f5b Make the use of xmpp_iq_cb_data->context explicit.
Paul Aurich <paul@darkrain42.org>
parents: 27371
diff changeset
77 struct item_data *context;
ebb0f7d27f5b Make the use of xmpp_iq_cb_data->context explicit.
Paul Aurich <paul@darkrain42.org>
parents: 27371
diff changeset
78 PurpleConnection *pc;
ebb0f7d27f5b Make the use of xmpp_iq_cb_data->context explicit.
Paul Aurich <paul@darkrain42.org>
parents: 27371
diff changeset
79 XmppIqCallback cb;
ebb0f7d27f5b Make the use of xmpp_iq_cb_data->context explicit.
Paul Aurich <paul@darkrain42.org>
parents: 27371
diff changeset
80 };
ebb0f7d27f5b Make the use of xmpp_iq_cb_data->context explicit.
Paul Aurich <paul@darkrain42.org>
parents: 27371
diff changeset
81
ebb0f7d27f5b Make the use of xmpp_iq_cb_data->context explicit.
Paul Aurich <paul@darkrain42.org>
parents: 27371
diff changeset
82
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
83 static char*
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
84 generate_next_id()
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
85 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
86 static guint32 index = 0;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
87
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
88 if (index == 0) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
89 do {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
90 index = g_random_int();
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
91 } while (index == 0);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
92 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
93
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
94 return g_strdup_printf("purpledisco%x", index++);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
95 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
96
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
97 static gboolean
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
98 remove_iq_callbacks_by_pc(gpointer key, gpointer value, gpointer user_data)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
99 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
100 struct xmpp_iq_cb_data *cb_data = value;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
101
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
102 if (cb_data && cb_data->pc == user_data) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
103 struct item_data *item_data = cb_data->context;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
104
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
105 if (item_data) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
106 pidgin_disco_list_unref(item_data->list);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
107 g_free(item_data->name);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
108 g_free(item_data->node);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
109 g_free(item_data);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
110 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
111
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
112 return TRUE;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
113 } else
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
114 return FALSE;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
115 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
116
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
117 static gboolean
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
118 xmpp_iq_received(PurpleConnection *pc, const char *type, const char *id,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
119 const char *from, xmlnode *iq)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
120 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
121 struct xmpp_iq_cb_data *cb_data;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
122
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
123 cb_data = g_hash_table_lookup(iq_callbacks, id);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
124 if (!cb_data)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
125 return FALSE;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
126
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
127 cb_data->cb(cb_data->pc, type, id, from, iq, cb_data->context);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
128
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
129 g_hash_table_remove(iq_callbacks, id);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
130 if (g_hash_table_size(iq_callbacks) == 0) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
131 PurplePlugin *prpl = purple_connection_get_prpl(pc);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
132 iq_listening = FALSE;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
133 purple_signal_disconnect(prpl, "jabber-receiving-iq", my_plugin,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
134 PURPLE_CALLBACK(xmpp_iq_received));
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
135 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
136
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
137 /* Om nom nom nom */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
138 return TRUE;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
139 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
140
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
141 static void
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
142 xmpp_iq_register_callback(PurpleConnection *pc, gchar *id, gpointer data,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
143 XmppIqCallback cb)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
144 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
145 struct xmpp_iq_cb_data *cbdata = g_new0(struct xmpp_iq_cb_data, 1);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
146
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
147 cbdata->context = data;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
148 cbdata->cb = cb;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
149 cbdata->pc = pc;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
150
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
151 g_hash_table_insert(iq_callbacks, id, cbdata);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
152
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
153 if (!iq_listening) {
27158
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27126
diff changeset
154 PurplePlugin *prpl = purple_plugins_find_with_id(XMPP_PLUGIN_ID);
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
155 iq_listening = TRUE;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
156 purple_signal_connect(prpl, "jabber-receiving-iq", my_plugin,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
157 PURPLE_CALLBACK(xmpp_iq_received), NULL);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
158 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
159 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
160
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
161 static void
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
162 xmpp_disco_info_do(PurpleConnection *pc, gpointer cbdata, const char *jid,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
163 const char *node, XmppIqCallback cb)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
164 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
165 xmlnode *iq, *query;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
166 char *id = generate_next_id();
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
167
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
168 iq = xmlnode_new("iq");
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
169 xmlnode_set_attrib(iq, "type", "get");
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
170 xmlnode_set_attrib(iq, "to", jid);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
171 xmlnode_set_attrib(iq, "id", id);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
172
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
173 query = xmlnode_new_child(iq, "query");
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
174 xmlnode_set_namespace(query, NS_DISCO_INFO);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
175 if (node)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
176 xmlnode_set_attrib(query, "node", node);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
177
27089
d148ca9e4d9a Use the modified signal in more places.
Paul Aurich <paul@darkrain42.org>
parents: 27087
diff changeset
178 /* Steals id */
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
179 xmpp_iq_register_callback(pc, id, cbdata, cb);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
180
27089
d148ca9e4d9a Use the modified signal in more places.
Paul Aurich <paul@darkrain42.org>
parents: 27087
diff changeset
181 purple_signal_emit(purple_connection_get_prpl(pc), "jabber-sending-xmlnode",
d148ca9e4d9a Use the modified signal in more places.
Paul Aurich <paul@darkrain42.org>
parents: 27087
diff changeset
182 pc, &iq);
d148ca9e4d9a Use the modified signal in more places.
Paul Aurich <paul@darkrain42.org>
parents: 27087
diff changeset
183 if (iq != NULL)
d148ca9e4d9a Use the modified signal in more places.
Paul Aurich <paul@darkrain42.org>
parents: 27087
diff changeset
184 xmlnode_free(iq);
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
185 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
186
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
187 static void
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
188 xmpp_disco_items_do(PurpleConnection *pc, gpointer cbdata, const char *jid,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
189 const char *node, XmppIqCallback cb)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
190 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
191 xmlnode *iq, *query;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
192 char *id = generate_next_id();
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
193
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
194 iq = xmlnode_new("iq");
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
195 xmlnode_set_attrib(iq, "type", "get");
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
196 xmlnode_set_attrib(iq, "to", jid);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
197 xmlnode_set_attrib(iq, "id", id);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
198
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
199 query = xmlnode_new_child(iq, "query");
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
200 xmlnode_set_namespace(query, NS_DISCO_ITEMS);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
201 if (node)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
202 xmlnode_set_attrib(query, "node", node);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
203
27089
d148ca9e4d9a Use the modified signal in more places.
Paul Aurich <paul@darkrain42.org>
parents: 27087
diff changeset
204 /* Steals id */
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
205 xmpp_iq_register_callback(pc, id, cbdata, cb);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
206
27089
d148ca9e4d9a Use the modified signal in more places.
Paul Aurich <paul@darkrain42.org>
parents: 27087
diff changeset
207 purple_signal_emit(purple_connection_get_prpl(pc), "jabber-sending-xmlnode",
d148ca9e4d9a Use the modified signal in more places.
Paul Aurich <paul@darkrain42.org>
parents: 27087
diff changeset
208 pc, &iq);
d148ca9e4d9a Use the modified signal in more places.
Paul Aurich <paul@darkrain42.org>
parents: 27087
diff changeset
209 if (iq != NULL)
d148ca9e4d9a Use the modified signal in more places.
Paul Aurich <paul@darkrain42.org>
parents: 27087
diff changeset
210 xmlnode_free(iq);
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
211 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
212
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
213 static XmppDiscoServiceType
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
214 disco_service_type_from_identity(xmlnode *identity)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
215 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
216 const char *category, *type;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
217
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
218 if (!identity)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
219 return XMPP_DISCO_SERVICE_TYPE_OTHER;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
220
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
221 category = xmlnode_get_attrib(identity, "category");
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
222 type = xmlnode_get_attrib(identity, "type");
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
223
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
224 if (!category)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
225 return XMPP_DISCO_SERVICE_TYPE_OTHER;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
226
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
227 if (g_str_equal(category, "conference"))
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
228 return XMPP_DISCO_SERVICE_TYPE_CHAT;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
229 else if (g_str_equal(category, "directory"))
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
230 return XMPP_DISCO_SERVICE_TYPE_DIRECTORY;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
231 else if (g_str_equal(category, "gateway"))
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
232 return XMPP_DISCO_SERVICE_TYPE_GATEWAY;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
233 else if (g_str_equal(category, "pubsub")) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
234 if (!type || g_str_equal(type, "collection"))
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
235 return XMPP_DISCO_SERVICE_TYPE_PUBSUB_COLLECTION;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
236 else if (g_str_equal(type, "leaf"))
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
237 return XMPP_DISCO_SERVICE_TYPE_PUBSUB_LEAF;
27059
9639747bb98c Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents: 27058
diff changeset
238 else if (g_str_equal(type, "service"))
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
239 return XMPP_DISCO_SERVICE_TYPE_OTHER;
27059
9639747bb98c Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents: 27058
diff changeset
240 else {
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
241 purple_debug_warning("xmppdisco", "Unknown pubsub type '%s'\n", type);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
242 return XMPP_DISCO_SERVICE_TYPE_OTHER;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
243 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
244 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
245
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
246 return XMPP_DISCO_SERVICE_TYPE_OTHER;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
247 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
248
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
249 static const struct {
27158
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27126
diff changeset
250 const char *from;
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27126
diff changeset
251 const char *to;
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
252 } disco_type_mappings[] = {
27158
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27126
diff changeset
253 { "gadu-gadu", "gadu-gadu" }, /* the prpl is prpl-gg, but list_icon returns "gadu-gadu" */
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27126
diff changeset
254 { "sametime", "meanwhile" },
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27126
diff changeset
255 { "myspaceim", "myspace" },
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27126
diff changeset
256 { "xmpp", "jabber" }, /* prpl-jabber (mentioned in case the prpl is renamed so this line will match) */
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27126
diff changeset
257 { NULL, NULL }
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
258 };
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
259
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
260 static const gchar *
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
261 disco_type_from_string(const gchar *str)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
262 {
27158
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27126
diff changeset
263 int i = 0;
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
264
27158
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27126
diff changeset
265 g_return_val_if_fail(str != NULL, "");
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
266
27158
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27126
diff changeset
267 for ( ; disco_type_mappings[i].from; ++i) {
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27126
diff changeset
268 if (!strcasecmp(str, disco_type_mappings[i].from))
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27126
diff changeset
269 return disco_type_mappings[i].to;
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27126
diff changeset
270 }
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
271
27158
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27126
diff changeset
272 /* fallback to the string itself */
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27126
diff changeset
273 return str;
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
274 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
275
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
276 static void
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
277 got_info_cb(PurpleConnection *pc, const char *type, const char *id,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
278 const char *from, xmlnode *iq, gpointer data)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
279 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
280 struct item_data *item_data = data;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
281 PidginDiscoList *list = item_data->list;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
282 xmlnode *query;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
283
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
284 --list->fetch_count;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
285
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
286 if (!list->in_progress)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
287 goto out;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
288
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
289 if (g_str_equal(type, "result") &&
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
290 (query = xmlnode_get_child(iq, "query"))) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
291 xmlnode *identity = xmlnode_get_child(query, "identity");
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
292 XmppDiscoService *service;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
293 xmlnode *feature;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
294
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
295 service = g_new0(XmppDiscoService, 1);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
296 service->list = item_data->list;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
297 purple_debug_info("xmppdisco", "parent for %s is %p\n", from, item_data->parent);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
298 service->parent = item_data->parent;
27168
f5222e5ae468 Don't support adding JID+node items.
Paul Aurich <paul@darkrain42.org>
parents: 27158
diff changeset
299 service->flags = 0;
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
300 service->type = disco_service_type_from_identity(identity);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
301
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
302 if (item_data->node) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
303 if (item_data->name) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
304 service->name = item_data->name;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
305 item_data->name = NULL;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
306 } else
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
307 service->name = g_strdup(item_data->node);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
308
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
309 service->node = item_data->node;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
310 item_data->node = NULL;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
311
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
312 if (service->type == XMPP_DISCO_SERVICE_TYPE_PUBSUB_COLLECTION)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
313 service->flags |= XMPP_DISCO_BROWSE;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
314 } else
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
315 service->name = g_strdup(from);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
316
27168
f5222e5ae468 Don't support adding JID+node items.
Paul Aurich <paul@darkrain42.org>
parents: 27158
diff changeset
317 if (!service->node)
f5222e5ae468 Don't support adding JID+node items.
Paul Aurich <paul@darkrain42.org>
parents: 27158
diff changeset
318 /* Only support adding JIDs, not JID+node combos */
f5222e5ae468 Don't support adding JID+node items.
Paul Aurich <paul@darkrain42.org>
parents: 27158
diff changeset
319 service->flags |= XMPP_DISCO_ADD;
f5222e5ae468 Don't support adding JID+node items.
Paul Aurich <paul@darkrain42.org>
parents: 27158
diff changeset
320
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
321 if (item_data->name) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
322 service->description = item_data->name;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
323 item_data->name = NULL;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
324 } else if (identity)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
325 service->description = g_strdup(xmlnode_get_attrib(identity, "name"));
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
326
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
327 /* TODO: Overlap with service->name a bit */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
328 service->jid = g_strdup(from);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
329
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
330 for (feature = xmlnode_get_child(query, "feature"); feature;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
331 feature = xmlnode_get_next_twin(feature)) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
332 const char *var;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
333 if (!(var = xmlnode_get_attrib(feature, "var")))
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
334 continue;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
335
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
336 if (g_str_equal(var, NS_REGISTER))
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
337 service->flags |= XMPP_DISCO_REGISTER;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
338 else if (g_str_equal(var, NS_DISCO_ITEMS))
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
339 service->flags |= XMPP_DISCO_BROWSE;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
340 else if (g_str_equal(var, NS_MUC)) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
341 service->flags |= XMPP_DISCO_BROWSE;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
342 service->type = XMPP_DISCO_SERVICE_TYPE_CHAT;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
343 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
344 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
345
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
346 if (service->type == XMPP_DISCO_SERVICE_TYPE_GATEWAY)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
347 service->gateway_type = g_strdup(disco_type_from_string(
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
348 xmlnode_get_attrib(identity, "type")));
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
349
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
350 pidgin_disco_add_service(list, service, service->parent);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
351 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
352
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
353 out:
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
354 if (list->fetch_count == 0)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
355 pidgin_disco_list_set_in_progress(list, FALSE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
356
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
357 g_free(item_data->name);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
358 g_free(item_data->node);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
359 g_free(item_data);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
360 pidgin_disco_list_unref(list);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
361 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
362
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
363 static void
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
364 got_items_cb(PurpleConnection *pc, const char *type, const char *id,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
365 const char *from, xmlnode *iq, gpointer data)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
366 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
367 struct item_data *item_data = data;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
368 PidginDiscoList *list = item_data->list;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
369 xmlnode *query;
27085
61d817c4c935 Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <paul@darkrain42.org>
parents: 27059
diff changeset
370 gboolean has_items = FALSE;
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
371
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
372 --list->fetch_count;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
373
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
374 if (!list->in_progress)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
375 goto out;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
376
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
377 if (g_str_equal(type, "result") &&
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
378 (query = xmlnode_get_child(iq, "query"))) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
379 xmlnode *item;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
380
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
381 for (item = xmlnode_get_child(query, "item"); item;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
382 item = xmlnode_get_next_twin(item)) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
383 const char *jid = xmlnode_get_attrib(item, "jid");
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
384 const char *name = xmlnode_get_attrib(item, "name");
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
385 const char *node = xmlnode_get_attrib(item, "node");
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
386
27085
61d817c4c935 Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <paul@darkrain42.org>
parents: 27059
diff changeset
387 has_items = TRUE;
61d817c4c935 Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <paul@darkrain42.org>
parents: 27059
diff changeset
388
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
389 if (item_data->parent->type == XMPP_DISCO_SERVICE_TYPE_CHAT) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
390 /* This is a hacky first-order approximation. Any MUC
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
391 * component that has a >1 level hierarchy (a Yahoo MUC
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
392 * transport component probably does) will violate this.
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
393 *
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
394 * On the other hand, this is better than querying all the
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
395 * chats at conference.jabber.org to enumerate them.
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
396 */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
397 XmppDiscoService *service = g_new0(XmppDiscoService, 1);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
398 service->list = item_data->list;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
399 service->parent = item_data->parent;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
400 service->flags = XMPP_DISCO_ADD;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
401 service->type = XMPP_DISCO_SERVICE_TYPE_CHAT;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
402
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
403 service->name = g_strdup(name);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
404 service->jid = g_strdup(jid);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
405 service->node = g_strdup(node);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
406 pidgin_disco_add_service(list, service, item_data->parent);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
407 } else {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
408 struct item_data *item_data2 = g_new0(struct item_data, 1);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
409
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
410 item_data2->list = item_data->list;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
411 item_data2->parent = item_data->parent;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
412 item_data2->name = g_strdup(name);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
413 item_data2->node = g_strdup(node);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
414
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
415 ++list->fetch_count;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
416 pidgin_disco_list_ref(list);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
417 xmpp_disco_info_do(pc, item_data2, jid, node, got_info_cb);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
418 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
419 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
420 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
421
27085
61d817c4c935 Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <paul@darkrain42.org>
parents: 27059
diff changeset
422 if (!has_items)
61d817c4c935 Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <paul@darkrain42.org>
parents: 27059
diff changeset
423 pidgin_disco_add_service(list, NULL, item_data->parent);
61d817c4c935 Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <paul@darkrain42.org>
parents: 27059
diff changeset
424
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
425 out:
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
426 if (list->fetch_count == 0)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
427 pidgin_disco_list_set_in_progress(list, FALSE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
428
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
429 g_free(item_data);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
430 pidgin_disco_list_unref(list);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
431 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
432
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
433 static void
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
434 server_items_cb(PurpleConnection *pc, const char *type, const char *id,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
435 const char *from, xmlnode *iq, gpointer data)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
436 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
437 struct item_data *cb_data = data;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
438 PidginDiscoList *list = cb_data->list;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
439 xmlnode *query;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
440
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
441 g_free(cb_data);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
442 --list->fetch_count;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
443
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
444 if (g_str_equal(type, "result") &&
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
445 (query = xmlnode_get_child(iq, "query"))) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
446 xmlnode *item;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
447
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
448 for (item = xmlnode_get_child(query, "item"); item;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
449 item = xmlnode_get_next_twin(item)) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
450 const char *jid = xmlnode_get_attrib(item, "jid");
27108
53294b47a4a6 Fix an issue with the server responding with jid/node items as first-level children and add a TODO.
Paul Aurich <paul@darkrain42.org>
parents: 27089
diff changeset
451 const char *name = xmlnode_get_attrib(item, "name");
53294b47a4a6 Fix an issue with the server responding with jid/node items as first-level children and add a TODO.
Paul Aurich <paul@darkrain42.org>
parents: 27089
diff changeset
452 const char *node = xmlnode_get_attrib(item, "node");
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
453 struct item_data *item_data;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
454
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
455 if (!jid)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
456 continue;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
457
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
458 item_data = g_new0(struct item_data, 1);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
459 item_data->list = list;
27108
53294b47a4a6 Fix an issue with the server responding with jid/node items as first-level children and add a TODO.
Paul Aurich <paul@darkrain42.org>
parents: 27089
diff changeset
460 item_data->name = g_strdup(name);
53294b47a4a6 Fix an issue with the server responding with jid/node items as first-level children and add a TODO.
Paul Aurich <paul@darkrain42.org>
parents: 27089
diff changeset
461 item_data->node = g_strdup(node);
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
462
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
463 ++list->fetch_count;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
464 pidgin_disco_list_ref(list);
27108
53294b47a4a6 Fix an issue with the server responding with jid/node items as first-level children and add a TODO.
Paul Aurich <paul@darkrain42.org>
parents: 27089
diff changeset
465 xmpp_disco_info_do(pc, item_data, jid, node, got_info_cb);
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
466 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
467 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
468
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
469 if (list->fetch_count == 0)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
470 pidgin_disco_list_set_in_progress(list, FALSE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
471
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
472 pidgin_disco_list_unref(list);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
473 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
474
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
475 static void
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
476 server_info_cb(PurpleConnection *pc, const char *type, const char *id,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
477 const char *from, xmlnode *iq, gpointer data)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
478 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
479 struct item_data *cb_data = data;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
480 PidginDiscoList *list = cb_data->list;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
481 xmlnode *query;
27126
0901c3662286 Make XMPP Disco plugin show better errors when getting a 404-like return.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27113
diff changeset
482 xmlnode *error;
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
483 gboolean items = FALSE;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
484
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
485 --list->fetch_count;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
486
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
487 if (g_str_equal(type, "result") &&
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
488 (query = xmlnode_get_child(iq, "query"))) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
489 xmlnode *feature;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
490
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
491 for (feature = xmlnode_get_child(query, "feature"); feature;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
492 feature = xmlnode_get_next_twin(feature)) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
493 const char *var = xmlnode_get_attrib(feature, "var");
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
494 if (purple_strequal(var, NS_DISCO_ITEMS)) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
495 items = TRUE;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
496 break;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
497 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
498 }
27126
0901c3662286 Make XMPP Disco plugin show better errors when getting a 404-like return.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27113
diff changeset
499
0901c3662286 Make XMPP Disco plugin show better errors when getting a 404-like return.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27113
diff changeset
500 if (items) {
0901c3662286 Make XMPP Disco plugin show better errors when getting a 404-like return.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27113
diff changeset
501 xmpp_disco_items_do(pc, cb_data, from, NULL /* node */, server_items_cb);
0901c3662286 Make XMPP Disco plugin show better errors when getting a 404-like return.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27113
diff changeset
502 ++list->fetch_count;
0901c3662286 Make XMPP Disco plugin show better errors when getting a 404-like return.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27113
diff changeset
503 pidgin_disco_list_ref(list);
0901c3662286 Make XMPP Disco plugin show better errors when getting a 404-like return.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27113
diff changeset
504 }
27371
4c55aa5aab82 If no disco#items feature was found (like with gmail.com), then our disco
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27168
diff changeset
505 else {
4c55aa5aab82 If no disco#items feature was found (like with gmail.com), then our disco
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27168
diff changeset
506 pidgin_disco_list_set_in_progress(list, FALSE);
4c55aa5aab82 If no disco#items feature was found (like with gmail.com), then our disco
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27168
diff changeset
507 g_free(cb_data);
4c55aa5aab82 If no disco#items feature was found (like with gmail.com), then our disco
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27168
diff changeset
508 }
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
509 }
27126
0901c3662286 Make XMPP Disco plugin show better errors when getting a 404-like return.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27113
diff changeset
510 else {
0901c3662286 Make XMPP Disco plugin show better errors when getting a 404-like return.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27113
diff changeset
511 error = xmlnode_get_child(iq, "error");
0901c3662286 Make XMPP Disco plugin show better errors when getting a 404-like return.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27113
diff changeset
512 if (xmlnode_get_child(error, "remote-server-not-found")
0901c3662286 Make XMPP Disco plugin show better errors when getting a 404-like return.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27113
diff changeset
513 || xmlnode_get_child(error, "jid-malformed")) {
0901c3662286 Make XMPP Disco plugin show better errors when getting a 404-like return.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27113
diff changeset
514 purple_notify_error(my_plugin, _("Error"),
0901c3662286 Make XMPP Disco plugin show better errors when getting a 404-like return.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27113
diff changeset
515 _("Server does not exist"),
0901c3662286 Make XMPP Disco plugin show better errors when getting a 404-like return.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27113
diff changeset
516 NULL);
0901c3662286 Make XMPP Disco plugin show better errors when getting a 404-like return.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27113
diff changeset
517 }
0901c3662286 Make XMPP Disco plugin show better errors when getting a 404-like return.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27113
diff changeset
518 else {
0901c3662286 Make XMPP Disco plugin show better errors when getting a 404-like return.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27113
diff changeset
519 purple_notify_error(my_plugin, _("Error"),
0901c3662286 Make XMPP Disco plugin show better errors when getting a 404-like return.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27113
diff changeset
520 _("Server does not support service discovery"),
0901c3662286 Make XMPP Disco plugin show better errors when getting a 404-like return.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27113
diff changeset
521 NULL);
0901c3662286 Make XMPP Disco plugin show better errors when getting a 404-like return.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27113
diff changeset
522 }
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
523 pidgin_disco_list_set_in_progress(list, FALSE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
524 g_free(cb_data);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
525 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
526
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
527 pidgin_disco_list_unref(list);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
528 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
529
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
530 void xmpp_disco_start(PidginDiscoList *list)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
531 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
532 struct item_data *cb_data;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
533
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
534 g_return_if_fail(list != NULL);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
535
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
536 ++list->fetch_count;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
537 pidgin_disco_list_ref(list);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
538
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
539 cb_data = g_new0(struct item_data, 1);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
540 cb_data->list = list;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
541
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
542 xmpp_disco_info_do(list->pc, cb_data, list->server, NULL, server_info_cb);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
543 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
544
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
545 void xmpp_disco_service_expand(XmppDiscoService *service)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
546 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
547 struct item_data *item_data;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
548
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
549 g_return_if_fail(service != NULL);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
550
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
551 if (service->expanded)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
552 return;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
553
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
554 item_data = g_new0(struct item_data, 1);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
555 item_data->list = service->list;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
556 item_data->parent = service;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
557
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
558 ++service->list->fetch_count;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
559 pidgin_disco_list_ref(service->list);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
560
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
561 pidgin_disco_list_set_in_progress(service->list, TRUE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
562
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
563 xmpp_disco_items_do(service->list->pc, item_data, service->jid, service->node,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
564 got_items_cb);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
565 service->expanded = TRUE;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
566 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
567
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
568 void xmpp_disco_service_register(XmppDiscoService *service)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
569 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
570 xmlnode *iq, *query;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
571 char *id = generate_next_id();
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
572
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
573 iq = xmlnode_new("iq");
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
574 xmlnode_set_attrib(iq, "type", "get");
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
575 xmlnode_set_attrib(iq, "to", service->jid);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
576 xmlnode_set_attrib(iq, "id", id);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
577
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
578 query = xmlnode_new_child(iq, "query");
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
579 xmlnode_set_namespace(query, NS_REGISTER);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
580
27089
d148ca9e4d9a Use the modified signal in more places.
Paul Aurich <paul@darkrain42.org>
parents: 27087
diff changeset
581 purple_signal_emit(purple_connection_get_prpl(service->list->pc),
d148ca9e4d9a Use the modified signal in more places.
Paul Aurich <paul@darkrain42.org>
parents: 27087
diff changeset
582 "jabber-sending-xmlnode", service->list->pc, &iq);
d148ca9e4d9a Use the modified signal in more places.
Paul Aurich <paul@darkrain42.org>
parents: 27087
diff changeset
583 if (iq != NULL)
d148ca9e4d9a Use the modified signal in more places.
Paul Aurich <paul@darkrain42.org>
parents: 27087
diff changeset
584 xmlnode_free(iq);
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
585 g_free(id);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
586 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
587
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
588 static void
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
589 create_dialog(PurplePluginAction *action)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
590 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
591 pidgin_disco_dialog_new();
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
592 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
593
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
594 static GList *
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
595 actions(PurplePlugin *plugin, gpointer context)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
596 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
597 GList *l = NULL;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
598 PurplePluginAction *action = NULL;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
599
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
600 action = purple_plugin_action_new(_("XMPP Service Discovery"),
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
601 create_dialog);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
602 l = g_list_prepend(l, action);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
603
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
604 return l;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
605 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
606
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
607 static void
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
608 signed_off_cb(PurpleConnection *pc, gpointer unused)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
609 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
610 /* Deal with any dialogs */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
611 pidgin_disco_signed_off_cb(pc);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
612
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
613 /* Remove all the IQ callbacks for this connection */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
614 g_hash_table_foreach_remove(iq_callbacks, remove_iq_callbacks_by_pc, pc);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
615 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
616
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
617 static gboolean
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
618 plugin_load(PurplePlugin *plugin)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
619 {
27158
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27126
diff changeset
620 PurplePlugin *xmpp_prpl;
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
621
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
622 my_plugin = plugin;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
623
27158
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27126
diff changeset
624 xmpp_prpl = purple_plugins_find_with_id(XMPP_PLUGIN_ID);
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27126
diff changeset
625 if (NULL == xmpp_prpl)
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27126
diff changeset
626 return FALSE;
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
627
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
628 purple_signal_connect(purple_connections_get_handle(), "signing-off",
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
629 plugin, PURPLE_CALLBACK(signed_off_cb), NULL);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
630
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
631 iq_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
632
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
633 return TRUE;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
634 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
635
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
636 static gboolean
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
637 plugin_unload(PurplePlugin *plugin)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
638 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
639 g_hash_table_destroy(iq_callbacks);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
640 iq_callbacks = NULL;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
641
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
642 purple_signals_disconnect_by_handle(plugin);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
643 pidgin_disco_dialogs_destroy_all();
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
644
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
645 return TRUE;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
646 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
647
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
648 static PurplePluginInfo info =
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
649 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
650 PURPLE_PLUGIN_MAGIC,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
651 PURPLE_MAJOR_VERSION,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
652 PURPLE_MINOR_VERSION,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
653 PURPLE_PLUGIN_STANDARD,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
654 PIDGIN_PLUGIN_TYPE,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
655 0,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
656 NULL,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
657 PURPLE_PRIORITY_DEFAULT,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
658 "gtk-xmppdisco",
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
659 N_("XMPP Service Discovery"),
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
660 DISPLAY_VERSION,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
661 N_("Allows browsing and registering services."),
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
662 N_("This plugin is useful for registering with legacy transports or other "
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
663 "XMPP services."),
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
664 "Paul Aurich <paul@darkrain42.org>",
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
665 PURPLE_WEBSITE,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
666 plugin_load,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
667 plugin_unload,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
668 NULL, /**< destroy */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
669 NULL, /**< ui_info */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
670 NULL, /**< extra_info */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
671 NULL, /**< prefs_info */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
672 actions,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
673
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
674 /* padding */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
675 NULL,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
676 NULL,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
677 NULL,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
678 NULL
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
679 };
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
680
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
681 static void
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
682 init_plugin(PurplePlugin *plugin)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
683 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
684 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
685
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
686 PURPLE_INIT_PLUGIN(xmppdisco, init_plugin, info)