annotate libpurple/protocols/jabber/jabber.c @ 25774:514051f3b6cf

Add option for forcing BOSH (useful for debugging)
author Paul Aurich <paul@darkrain42.org>
date Mon, 01 Dec 2008 04:00:41 +0000
parents c4eb9f10ecb5
children 1516525c86fa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /*
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2 * purple - Jabber Protocol Plugin
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4 * Copyright (C) 2003, Nathan Walp <faceprint@faceprint.com>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * GNU General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
19680
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19200
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 #include "internal.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 #include "account.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24 #include "accountopt.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 #include "blist.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 #include "cmds.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27 #include "connection.h"
15891
87ea711b9781 Re-arrange #includes so 'make check' stands a chance of passing during
Stu Tomlinson <stu@nosnilmot.com>
parents: 15823
diff changeset
28 #include "conversation.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include "debug.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include "dnssrv.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 #include "message.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 #include "notify.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 #include "pluginpref.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34 #include "proxy.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 #include "prpl.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 #include "request.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 #include "server.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 #include "util.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 #include "version.h"
15891
87ea711b9781 Re-arrange #includes so 'make check' stands a chance of passing during
Stu Tomlinson <stu@nosnilmot.com>
parents: 15823
diff changeset
40 #include "xmlnode.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41
25585
45816181b7de * fixing a bug in jabber_caps_compare()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25575
diff changeset
42 #include "caps.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43 #include "auth.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 #include "buddy.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 #include "chat.h"
23445
4ac5db6e39f3 Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents: 23182
diff changeset
46 #include "data.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 #include "disco.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 #include "google.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49 #include "iq.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 #include "jutil.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 #include "message.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 #include "parser.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 #include "presence.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54 #include "jabber.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55 #include "roster.h"
17562
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
56 #include "ping.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57 #include "si.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 #include "xdata.h"
17561
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents: 17560
diff changeset
59 #include "pep.h"
17610
9a19c46adf66 The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17608
diff changeset
60 #include "adhoccommands.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61
23445
4ac5db6e39f3 Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents: 23182
diff changeset
62
17606
108f3b42976f Introduced an additional connection stage to the jabber connection progress in order to be able to tell in the application, whether SSL/TLS is enabled, so it can display a lock icon next to the connection.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17603
diff changeset
63 #define JABBER_CONNECT_STEPS (js->gsc ? 9 : 5)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
64
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
65 static PurplePlugin *my_protocol = NULL;
25575
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
66
21538
4e5bef6c3379 Fix #3669
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21418
diff changeset
67 GList *jabber_features = NULL;
25575
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
68 GList *jabber_identities = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
69
18703
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
70 static void jabber_unregister_account_cb(JabberStream *js);
23643
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
71 static void try_srv_connect(JabberStream *js);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73 static void jabber_stream_init(JabberStream *js)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75 char *open_stream;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77 open_stream = g_strdup_printf("<stream:stream to='%s' "
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78 "xmlns='jabber:client' "
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79 "xmlns:stream='http://etherx.jabber.org/streams' "
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80 "version='1.0'>",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81 js->user->domain);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82 /* setup the parser fresh for each stream */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83 jabber_parser_setup(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84 jabber_send_raw(js, open_stream, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85 js->reinit = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86 g_free(open_stream);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 jabber_session_initialized_cb(JabberStream *js, xmlnode *packet, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92 const char *type = xmlnode_get_attrib(packet, "type");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93 if(type && !strcmp(type, "result")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94 jabber_stream_set_state(js, JABBER_STREAM_CONNECTED);
18703
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
95 if(js->unregistration)
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
96 jabber_unregister_account_cb(js);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97 } else {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
98 purple_connection_error_reason (js->gc,
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
99 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
20117
f24a2cacacd1 Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents: 20076
diff changeset
100 ("Error initializing session"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104 static void jabber_session_init(JabberStream *js)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 JabberIq *iq = jabber_iq_new(js, JABBER_IQ_SET);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 xmlnode *session;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 jabber_iq_set_callback(iq, jabber_session_initialized_cb, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 session = xmlnode_new_child(iq->node, "session");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 xmlnode_set_namespace(session, "urn:ietf:params:xml:ns:xmpp-session");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 jabber_iq_send(iq);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 static void jabber_bind_result_cb(JabberStream *js, xmlnode *packet,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120 const char *type = xmlnode_get_attrib(packet, "type");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121 xmlnode *bind;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 if(type && !strcmp(type, "result") &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 (bind = xmlnode_get_child_with_namespace(packet, "bind", "urn:ietf:params:xml:ns:xmpp-bind"))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 xmlnode *jid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 char *full_jid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127 if((jid = xmlnode_get_child(bind, "jid")) && (full_jid = xmlnode_get_data(jid))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 JabberBuddy *my_jb = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 jabber_id_free(js->user);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 if(!(js->user = jabber_id_new(full_jid))) {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
131 purple_connection_error_reason (js->gc,
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
132 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
20117
f24a2cacacd1 Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents: 20076
diff changeset
133 _("Invalid response from server."));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 if((my_jb = jabber_buddy_find(js, full_jid, TRUE)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 my_jb->subscription |= JABBER_SUB_BOTH;
24155
a61c017d3a99 Set the connection display name to the server-assigned full jid for XMPP
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23988
diff changeset
137
a61c017d3a99 Set the connection display name to the server-assigned full jid for XMPP
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23988
diff changeset
138 purple_connection_set_display_name(js->gc, full_jid);
a61c017d3a99 Set the connection display name to the server-assigned full jid for XMPP
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23988
diff changeset
139
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140 g_free(full_jid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142 } else {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
143 PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
20814
bde477ec6a71 Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents: 20792
diff changeset
144 char *msg = jabber_parse_error(js, packet, &reason);
bde477ec6a71 Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents: 20792
diff changeset
145 purple_connection_error_reason (js->gc, reason, msg);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
147 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149 jabber_session_init(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
151
24500
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
152 static char *jabber_prep_resource(char *input) {
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
153 char hostname[256]; /* current hostname */
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
154
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
155 /* Empty resource == don't send any */
24508
5cd0188892f6 Revert the part of 280dc76b which broke XMPP resources such that only those
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24505
diff changeset
156 if (*input == '\0')
24500
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
157 return NULL;
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
158
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
159 /* Replace __HOSTNAME__ with hostname */
24505
9bb624e345aa me likes this better, References #5565
Ka-Hing Cheung <khc@hxbc.us>
parents: 24501
diff changeset
160 if (gethostname(hostname, sizeof(hostname) - 1)) {
9bb624e345aa me likes this better, References #5565
Ka-Hing Cheung <khc@hxbc.us>
parents: 24501
diff changeset
161 purple_debug_warning("jabber", "gethostname: %s\n", g_strerror(errno));
9bb624e345aa me likes this better, References #5565
Ka-Hing Cheung <khc@hxbc.us>
parents: 24501
diff changeset
162 /* according to glibc doc, the only time an error is returned
9bb624e345aa me likes this better, References #5565
Ka-Hing Cheung <khc@hxbc.us>
parents: 24501
diff changeset
163 is if the hostname is longer than the buffer, in which case
9bb624e345aa me likes this better, References #5565
Ka-Hing Cheung <khc@hxbc.us>
parents: 24501
diff changeset
164 glibc 2.2+ would still fill the buffer with partial
9bb624e345aa me likes this better, References #5565
Ka-Hing Cheung <khc@hxbc.us>
parents: 24501
diff changeset
165 hostname, so maybe we want to detect that and use it
9bb624e345aa me likes this better, References #5565
Ka-Hing Cheung <khc@hxbc.us>
parents: 24501
diff changeset
166 instead
9bb624e345aa me likes this better, References #5565
Ka-Hing Cheung <khc@hxbc.us>
parents: 24501
diff changeset
167 */
24500
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
168 strcpy(hostname, "localhost");
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
169 }
24505
9bb624e345aa me likes this better, References #5565
Ka-Hing Cheung <khc@hxbc.us>
parents: 24501
diff changeset
170 hostname[sizeof(hostname) - 1] = '\0';
24500
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
171
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
172 return purple_strreplace(input, "__HOSTNAME__", hostname);
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
173 }
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
174
25607
f775f6021654 * using libpurple's internal SASL mechanisms during BOSH authentication phase
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25602
diff changeset
175 void jabber_stream_features_parse(JabberStream *js, xmlnode *packet)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177 if(xmlnode_get_child(packet, "starttls")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178 if(jabber_process_starttls(js, packet))
24500
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
179
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180 return;
17623
a8420fd18545 Added an option to require SSL or TLS when connecting to an XMPP server.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17621
diff changeset
181 } else if(purple_account_get_bool(js->gc->account, "require_tls", FALSE) && !js->gsc) {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
182 purple_connection_error_reason (js->gc,
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
183 PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR,
20117
f24a2cacacd1 Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents: 20076
diff changeset
184 _("You require encryption, but it is not available on this server."));
17623
a8420fd18545 Added an option to require SSL or TLS when connecting to an XMPP server.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17621
diff changeset
185 return;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188 if(js->registration) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189 jabber_register_start(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
190 } else if(xmlnode_get_child(packet, "mechanisms")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191 jabber_auth_start(js, packet);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192 } else if(xmlnode_get_child(packet, "bind")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193 xmlnode *bind, *resource;
24500
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
194 char *requested_resource;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 JabberIq *iq = jabber_iq_new(js, JABBER_IQ_SET);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196 bind = xmlnode_new_child(iq->node, "bind");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 xmlnode_set_namespace(bind, "urn:ietf:params:xml:ns:xmpp-bind");
24500
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
198 requested_resource = jabber_prep_resource(js->user->resource);
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
199
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
200 if (requested_resource != NULL) {
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
201 resource = xmlnode_new_child(bind, "resource");
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
202 xmlnode_insert_data(resource, requested_resource, -1);
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
203 free(requested_resource);
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
204 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206 jabber_iq_set_callback(iq, jabber_bind_result_cb, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
207
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208 jabber_iq_send(iq);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209 } else /* if(xmlnode_get_child_with_namespace(packet, "auth")) */ {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210 /* If we get an empty stream:features packet, or we explicitly get
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211 * an auth feature with namespace http://jabber.org/features/iq-auth
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212 * we should revert back to iq:auth authentication, even though we're
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 * connecting to an XMPP server. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 js->auth_type = JABBER_AUTH_IQ_AUTH;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215 jabber_stream_set_state(js, JABBER_STREAM_AUTHENTICATING);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
217 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 static void jabber_stream_handle_error(JabberStream *js, xmlnode *packet)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220 {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
221 PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
20814
bde477ec6a71 Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents: 20792
diff changeset
222 char *msg = jabber_parse_error(js, packet, &reason);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223
20814
bde477ec6a71 Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents: 20792
diff changeset
224 purple_connection_error_reason (js->gc, reason, msg);
bde477ec6a71 Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents: 20792
diff changeset
225
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
226 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
229 static void tls_init(JabberStream *js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
230
17621
bbd92ee894f2 Fixed a bug in the XMPP parser involving event handlers that replace the xmlnode packet. This caused double frees in this situation. The replacing function must free the xmlnode, since multiple event handlers could do this, and the intermediate xml trees would leak otherwise.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17620
diff changeset
231 void jabber_process_packet(JabberStream *js, xmlnode **packet)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
232 {
15919
26593bef6568 Minor code cleanup
Mark Doliner <mark@kingant.net>
parents: 15918
diff changeset
233 const char *xmlns;
26593bef6568 Minor code cleanup
Mark Doliner <mark@kingant.net>
parents: 15918
diff changeset
234
17621
bbd92ee894f2 Fixed a bug in the XMPP parser involving event handlers that replace the xmlnode packet. This caused double frees in this situation. The replacing function must free the xmlnode, since multiple event handlers could do this, and the intermediate xml trees would leak otherwise.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17620
diff changeset
235 purple_signal_emit(my_protocol, "jabber-receiving-xmlnode", js->gc, packet);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237 /* if the signal leaves us with a null packet, we're done */
17621
bbd92ee894f2 Fixed a bug in the XMPP parser involving event handlers that replace the xmlnode packet. This caused double frees in this situation. The replacing function must free the xmlnode, since multiple event handlers could do this, and the intermediate xml trees would leak otherwise.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17620
diff changeset
238 if(NULL == *packet)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240
17621
bbd92ee894f2 Fixed a bug in the XMPP parser involving event handlers that replace the xmlnode packet. This caused double frees in this situation. The replacing function must free the xmlnode, since multiple event handlers could do this, and the intermediate xml trees would leak otherwise.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17620
diff changeset
241 xmlns = xmlnode_get_namespace(*packet);
15919
26593bef6568 Minor code cleanup
Mark Doliner <mark@kingant.net>
parents: 15918
diff changeset
242
17621
bbd92ee894f2 Fixed a bug in the XMPP parser involving event handlers that replace the xmlnode packet. This caused double frees in this situation. The replacing function must free the xmlnode, since multiple event handlers could do this, and the intermediate xml trees would leak otherwise.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17620
diff changeset
243 if(!strcmp((*packet)->name, "iq")) {
bbd92ee894f2 Fixed a bug in the XMPP parser involving event handlers that replace the xmlnode packet. This caused double frees in this situation. The replacing function must free the xmlnode, since multiple event handlers could do this, and the intermediate xml trees would leak otherwise.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17620
diff changeset
244 jabber_iq_parse(js, *packet);
bbd92ee894f2 Fixed a bug in the XMPP parser involving event handlers that replace the xmlnode packet. This caused double frees in this situation. The replacing function must free the xmlnode, since multiple event handlers could do this, and the intermediate xml trees would leak otherwise.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17620
diff changeset
245 } else if(!strcmp((*packet)->name, "presence")) {
bbd92ee894f2 Fixed a bug in the XMPP parser involving event handlers that replace the xmlnode packet. This caused double frees in this situation. The replacing function must free the xmlnode, since multiple event handlers could do this, and the intermediate xml trees would leak otherwise.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17620
diff changeset
246 jabber_presence_parse(js, *packet);
bbd92ee894f2 Fixed a bug in the XMPP parser involving event handlers that replace the xmlnode packet. This caused double frees in this situation. The replacing function must free the xmlnode, since multiple event handlers could do this, and the intermediate xml trees would leak otherwise.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17620
diff changeset
247 } else if(!strcmp((*packet)->name, "message")) {
bbd92ee894f2 Fixed a bug in the XMPP parser involving event handlers that replace the xmlnode packet. This caused double frees in this situation. The replacing function must free the xmlnode, since multiple event handlers could do this, and the intermediate xml trees would leak otherwise.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17620
diff changeset
248 jabber_message_parse(js, *packet);
bbd92ee894f2 Fixed a bug in the XMPP parser involving event handlers that replace the xmlnode packet. This caused double frees in this situation. The replacing function must free the xmlnode, since multiple event handlers could do this, and the intermediate xml trees would leak otherwise.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17620
diff changeset
249 } else if(!strcmp((*packet)->name, "stream:features")) {
bbd92ee894f2 Fixed a bug in the XMPP parser involving event handlers that replace the xmlnode packet. This caused double frees in this situation. The replacing function must free the xmlnode, since multiple event handlers could do this, and the intermediate xml trees would leak otherwise.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17620
diff changeset
250 jabber_stream_features_parse(js, *packet);
21538
4e5bef6c3379 Fix #3669
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21418
diff changeset
251 } else if (!strcmp((*packet)->name, "features") && xmlns &&
15919
26593bef6568 Minor code cleanup
Mark Doliner <mark@kingant.net>
parents: 15918
diff changeset
252 !strcmp(xmlns, "http://etherx.jabber.org/streams")) {
17621
bbd92ee894f2 Fixed a bug in the XMPP parser involving event handlers that replace the xmlnode packet. This caused double frees in this situation. The replacing function must free the xmlnode, since multiple event handlers could do this, and the intermediate xml trees would leak otherwise.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17620
diff changeset
253 jabber_stream_features_parse(js, *packet);
bbd92ee894f2 Fixed a bug in the XMPP parser involving event handlers that replace the xmlnode packet. This caused double frees in this situation. The replacing function must free the xmlnode, since multiple event handlers could do this, and the intermediate xml trees would leak otherwise.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17620
diff changeset
254 } else if(!strcmp((*packet)->name, "stream:error") ||
21538
4e5bef6c3379 Fix #3669
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21418
diff changeset
255 (!strcmp((*packet)->name, "error") && xmlns &&
15919
26593bef6568 Minor code cleanup
Mark Doliner <mark@kingant.net>
parents: 15918
diff changeset
256 !strcmp(xmlns, "http://etherx.jabber.org/streams")))
26593bef6568 Minor code cleanup
Mark Doliner <mark@kingant.net>
parents: 15918
diff changeset
257 {
17621
bbd92ee894f2 Fixed a bug in the XMPP parser involving event handlers that replace the xmlnode packet. This caused double frees in this situation. The replacing function must free the xmlnode, since multiple event handlers could do this, and the intermediate xml trees would leak otherwise.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17620
diff changeset
258 jabber_stream_handle_error(js, *packet);
bbd92ee894f2 Fixed a bug in the XMPP parser involving event handlers that replace the xmlnode packet. This caused double frees in this situation. The replacing function must free the xmlnode, since multiple event handlers could do this, and the intermediate xml trees would leak otherwise.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17620
diff changeset
259 } else if(!strcmp((*packet)->name, "challenge")) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260 if(js->state == JABBER_STREAM_AUTHENTICATING)
17621
bbd92ee894f2 Fixed a bug in the XMPP parser involving event handlers that replace the xmlnode packet. This caused double frees in this situation. The replacing function must free the xmlnode, since multiple event handlers could do this, and the intermediate xml trees would leak otherwise.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17620
diff changeset
261 jabber_auth_handle_challenge(js, *packet);
bbd92ee894f2 Fixed a bug in the XMPP parser involving event handlers that replace the xmlnode packet. This caused double frees in this situation. The replacing function must free the xmlnode, since multiple event handlers could do this, and the intermediate xml trees would leak otherwise.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17620
diff changeset
262 } else if(!strcmp((*packet)->name, "success")) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
263 if(js->state == JABBER_STREAM_AUTHENTICATING)
17621
bbd92ee894f2 Fixed a bug in the XMPP parser involving event handlers that replace the xmlnode packet. This caused double frees in this situation. The replacing function must free the xmlnode, since multiple event handlers could do this, and the intermediate xml trees would leak otherwise.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17620
diff changeset
264 jabber_auth_handle_success(js, *packet);
bbd92ee894f2 Fixed a bug in the XMPP parser involving event handlers that replace the xmlnode packet. This caused double frees in this situation. The replacing function must free the xmlnode, since multiple event handlers could do this, and the intermediate xml trees would leak otherwise.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17620
diff changeset
265 } else if(!strcmp((*packet)->name, "failure")) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266 if(js->state == JABBER_STREAM_AUTHENTICATING)
17621
bbd92ee894f2 Fixed a bug in the XMPP parser involving event handlers that replace the xmlnode packet. This caused double frees in this situation. The replacing function must free the xmlnode, since multiple event handlers could do this, and the intermediate xml trees would leak otherwise.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17620
diff changeset
267 jabber_auth_handle_failure(js, *packet);
bbd92ee894f2 Fixed a bug in the XMPP parser involving event handlers that replace the xmlnode packet. This caused double frees in this situation. The replacing function must free the xmlnode, since multiple event handlers could do this, and the intermediate xml trees would leak otherwise.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17620
diff changeset
268 } else if(!strcmp((*packet)->name, "proceed")) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
269 if(js->state == JABBER_STREAM_AUTHENTICATING && !js->gsc)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270 tls_init(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
272 purple_debug(PURPLE_DEBUG_WARNING, "jabber", "Unknown packet: %s\n",
17621
bbd92ee894f2 Fixed a bug in the XMPP parser involving event handlers that replace the xmlnode packet. This caused double frees in this situation. The replacing function must free the xmlnode, since multiple event handlers could do this, and the intermediate xml trees would leak otherwise.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17620
diff changeset
273 (*packet)->name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
274 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
276
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
277 static int jabber_do_send(JabberStream *js, const char *data, int len)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
278 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
279 int ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
280
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
281 if (js->gsc)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
282 ret = purple_ssl_write(js->gsc, data, len);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
283 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
284 ret = write(js->fd, data, len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
285
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
286 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
287 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
288
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
289 static void jabber_send_cb(gpointer data, gint source, PurpleInputCondition cond)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
290 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
291 JabberStream *js = data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
292 int ret, writelen;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
293 writelen = purple_circ_buffer_get_max_read(js->write_buffer);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
294
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
295 if (writelen == 0) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
296 purple_input_remove(js->writeh);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
297 js->writeh = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
298 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
299 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
300
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301 ret = jabber_do_send(js, js->write_buffer->outptr, writelen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
303 if (ret < 0 && errno == EAGAIN)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
304 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
305 else if (ret <= 0) {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
306 purple_connection_error_reason (js->gc,
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
307 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
20117
f24a2cacacd1 Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents: 20076
diff changeset
308 _("Write error"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
310 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
311
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
312 purple_circ_buffer_mark_read(js->write_buffer, ret);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
313 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
314
23378
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
315 static gboolean do_jabber_send_raw(JabberStream *js, const char *data, int len)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
316 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
317 int ret;
23378
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
318 gboolean success = TRUE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
319
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
320 if (len == -1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
321 len = strlen(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
322
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
323 if (js->writeh == 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
324 ret = jabber_do_send(js, data, len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
325 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
326 ret = -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
327 errno = EAGAIN;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
328 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
329
23378
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
330 if (ret < 0 && errno != EAGAIN) {
20117
f24a2cacacd1 Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents: 20076
diff changeset
331 purple_connection_error_reason (js->gc,
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
332 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
20117
f24a2cacacd1 Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents: 20076
diff changeset
333 _("Write error"));
23378
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
334 success = FALSE;
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
335 } else if (ret < len) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
336 if (ret < 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
337 ret = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
338 if (js->writeh == 0)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
339 js->writeh = purple_input_add(
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
340 js->gsc ? js->gsc->fd : js->fd,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
341 PURPLE_INPUT_WRITE, jabber_send_cb, js);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
342 purple_circ_buffer_append(js->write_buffer,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
343 data + ret, len - ret);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
344 }
23378
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
345
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
346 return success;
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
347 }
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
348
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
349 void jabber_send_raw(JabberStream *js, const char *data, int len)
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
350 {
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
351
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
352 /* because printing a tab to debug every minute gets old */
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
353 if(strcmp(data, "\t"))
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
354 purple_debug(PURPLE_DEBUG_MISC, "jabber", "Sending%s: %s\n",
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
355 js->gsc ? " (ssl)" : "", data);
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
356
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
357 /* If we've got a security layer, we need to encode the data,
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
358 * splitting it on the maximum buffer length negotiated */
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
359
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
360 purple_signal_emit(my_protocol, "jabber-sending-text", js->gc, &data);
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
361 if (data == NULL)
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
362 return;
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
363
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
364 #ifdef HAVE_CYRUS_SASL
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
365 if (js->sasl_maxbuf>0) {
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
366 int pos = 0;
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
367
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
368 if (!js->gsc && js->fd<0)
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
369 return;
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
370
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
371 if (len == -1)
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
372 len = strlen(data);
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
373
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
374 while (pos < len) {
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
375 int towrite;
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
376 const char *out;
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
377 unsigned olen;
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
378
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
379 towrite = MIN((len - pos), js->sasl_maxbuf);
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
380
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
381 sasl_encode(js->sasl, &data[pos], towrite, &out, &olen);
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
382 pos += towrite;
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
383
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
384 if (!do_jabber_send_raw(js, out, olen))
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
385 break;
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
386 }
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
387 return;
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
388 }
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
389 #endif
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
390
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
391 if (len == -1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
392 len = strlen(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
393
25608
a03a953ba63d * moving BOSH interfacing from jabber_send to jabber_send_raw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25607
diff changeset
394 if (js->use_bosh) {
a03a953ba63d * moving BOSH interfacing from jabber_send to jabber_send_raw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25607
diff changeset
395 xmlnode *xnode = xmlnode_from_str(data, len);
a03a953ba63d * moving BOSH interfacing from jabber_send to jabber_send_raw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25607
diff changeset
396 if (xnode) jabber_bosh_connection_send(&(js->bosh), xnode);
a03a953ba63d * moving BOSH interfacing from jabber_send to jabber_send_raw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25607
diff changeset
397 else {
a03a953ba63d * moving BOSH interfacing from jabber_send to jabber_send_raw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25607
diff changeset
398 purple_connection_error_reason(js->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
a03a953ba63d * moving BOSH interfacing from jabber_send to jabber_send_raw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25607
diff changeset
399 _("Someone tried to send non-XML in a Jabber world."));
a03a953ba63d * moving BOSH interfacing from jabber_send to jabber_send_raw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25607
diff changeset
400 }
a03a953ba63d * moving BOSH interfacing from jabber_send to jabber_send_raw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25607
diff changeset
401 } else {
25717
907ca9a36fe0 explicit merge of '714a7c7f903d11c96ffade34966121da549d998f'
Paul Aurich <paul@darkrain42.org>
parents: 25608 25716
diff changeset
402 do_jabber_send_raw(js, data, len);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
403 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
404 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
405
16240
547c76fe2e7a This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@gmail.com>
parents: 16068
diff changeset
406 int jabber_prpl_send_raw(PurpleConnection *gc, const char *buf, int len)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
407 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
408 JabberStream *js = (JabberStream*)gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
409 jabber_send_raw(js, buf, len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
410 return len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
411 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
412
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
413 void jabber_send(JabberStream *js, xmlnode *packet)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
414 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
415 char *txt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
416 int len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
417
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
418 purple_signal_emit(my_protocol, "jabber-sending-xmlnode", js->gc, &packet);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
419
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
420 /* if we get NULL back, we're done processing */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
421 if(NULL == packet)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
422 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
423
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
424 txt = xmlnode_to_str(packet, &len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
425 jabber_send_raw(js, txt, len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
426 g_free(txt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
428
23379
6c728443b426 We only allow one keepalive timeout, so simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23378
diff changeset
429 static void jabber_pong_cb(JabberStream *js, xmlnode *packet, gpointer unused)
21859
e13609ce4548 Send XMPP Pings to the server instead of whitespace for our keepalives. Timeout the connection if there's no response in 20 seconds
Sean Egan <seanegan@gmail.com>
parents: 21814
diff changeset
430 {
23379
6c728443b426 We only allow one keepalive timeout, so simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23378
diff changeset
431 purple_timeout_remove(js->keepalive_timeout);
21964
eaaac273d80c Keep track of the keepalive timeout source so it can be removed when the account disconnects. This prevents a possible crash if the timeout fired after the account disconnected.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21948
diff changeset
432 js->keepalive_timeout = -1;
21859
e13609ce4548 Send XMPP Pings to the server instead of whitespace for our keepalives. Timeout the connection if there's no response in 20 seconds
Sean Egan <seanegan@gmail.com>
parents: 21814
diff changeset
433 }
e13609ce4548 Send XMPP Pings to the server instead of whitespace for our keepalives. Timeout the connection if there's no response in 20 seconds
Sean Egan <seanegan@gmail.com>
parents: 21814
diff changeset
434
e13609ce4548 Send XMPP Pings to the server instead of whitespace for our keepalives. Timeout the connection if there's no response in 20 seconds
Sean Egan <seanegan@gmail.com>
parents: 21814
diff changeset
435 static gboolean jabber_pong_timeout(PurpleConnection *gc)
e13609ce4548 Send XMPP Pings to the server instead of whitespace for our keepalives. Timeout the connection if there's no response in 20 seconds
Sean Egan <seanegan@gmail.com>
parents: 21814
diff changeset
436 {
21973
966f98d4b04b Masca noticed that dc6923294f5f33ff7a52a998e1b9e9ad47be0211 made jabber.c not
Will Thompson <will.thompson@collabora.co.uk>
parents: 21964
diff changeset
437 JabberStream *js = gc->proto_data;
21859
e13609ce4548 Send XMPP Pings to the server instead of whitespace for our keepalives. Timeout the connection if there's no response in 20 seconds
Sean Egan <seanegan@gmail.com>
parents: 21814
diff changeset
438 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
e13609ce4548 Send XMPP Pings to the server instead of whitespace for our keepalives. Timeout the connection if there's no response in 20 seconds
Sean Egan <seanegan@gmail.com>
parents: 21814
diff changeset
439 _("Ping timeout"));
21964
eaaac273d80c Keep track of the keepalive timeout source so it can be removed when the account disconnects. This prevents a possible crash if the timeout fired after the account disconnected.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21948
diff changeset
440 js->keepalive_timeout = -1;
21859
e13609ce4548 Send XMPP Pings to the server instead of whitespace for our keepalives. Timeout the connection if there's no response in 20 seconds
Sean Egan <seanegan@gmail.com>
parents: 21814
diff changeset
441 return FALSE;
e13609ce4548 Send XMPP Pings to the server instead of whitespace for our keepalives. Timeout the connection if there's no response in 20 seconds
Sean Egan <seanegan@gmail.com>
parents: 21814
diff changeset
442 }
e13609ce4548 Send XMPP Pings to the server instead of whitespace for our keepalives. Timeout the connection if there's no response in 20 seconds
Sean Egan <seanegan@gmail.com>
parents: 21814
diff changeset
443
16240
547c76fe2e7a This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@gmail.com>
parents: 16068
diff changeset
444 void jabber_keepalive(PurpleConnection *gc)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
445 {
21964
eaaac273d80c Keep track of the keepalive timeout source so it can be removed when the account disconnects. This prevents a possible crash if the timeout fired after the account disconnected.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21948
diff changeset
446 JabberStream *js = gc->proto_data;
21859
e13609ce4548 Send XMPP Pings to the server instead of whitespace for our keepalives. Timeout the connection if there's no response in 20 seconds
Sean Egan <seanegan@gmail.com>
parents: 21814
diff changeset
447
22448
8ec6ac1b9e26 Only allow one keepalive_timeout at a time. This prevents us from starting a
Evan Schoenberg <evan.s@dreskin.net>
parents: 22432
diff changeset
448 if (js->keepalive_timeout == -1) {
8ec6ac1b9e26 Only allow one keepalive_timeout at a time. This prevents us from starting a
Evan Schoenberg <evan.s@dreskin.net>
parents: 22432
diff changeset
449 JabberIq *iq = jabber_iq_new(js, JABBER_IQ_GET);
8ec6ac1b9e26 Only allow one keepalive_timeout at a time. This prevents us from starting a
Evan Schoenberg <evan.s@dreskin.net>
parents: 22432
diff changeset
450
8ec6ac1b9e26 Only allow one keepalive_timeout at a time. This prevents us from starting a
Evan Schoenberg <evan.s@dreskin.net>
parents: 22432
diff changeset
451 xmlnode *ping = xmlnode_new_child(iq->node, "ping");
8ec6ac1b9e26 Only allow one keepalive_timeout at a time. This prevents us from starting a
Evan Schoenberg <evan.s@dreskin.net>
parents: 22432
diff changeset
452 xmlnode_set_namespace(ping, "urn:xmpp:ping");
8ec6ac1b9e26 Only allow one keepalive_timeout at a time. This prevents us from starting a
Evan Schoenberg <evan.s@dreskin.net>
parents: 22432
diff changeset
453
8ec6ac1b9e26 Only allow one keepalive_timeout at a time. This prevents us from starting a
Evan Schoenberg <evan.s@dreskin.net>
parents: 22432
diff changeset
454 js->keepalive_timeout = purple_timeout_add_seconds(120, (GSourceFunc)(jabber_pong_timeout), gc);
23379
6c728443b426 We only allow one keepalive timeout, so simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23378
diff changeset
455 jabber_iq_set_callback(iq, jabber_pong_cb, NULL);
22448
8ec6ac1b9e26 Only allow one keepalive_timeout at a time. This prevents us from starting a
Evan Schoenberg <evan.s@dreskin.net>
parents: 22432
diff changeset
456 jabber_iq_send(iq);
8ec6ac1b9e26 Only allow one keepalive_timeout at a time. This prevents us from starting a
Evan Schoenberg <evan.s@dreskin.net>
parents: 22432
diff changeset
457 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
458 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
459
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
460 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
461 jabber_recv_cb_ssl(gpointer data, PurpleSslConnection *gsc,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
462 PurpleInputCondition cond)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
463 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
464 PurpleConnection *gc = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
465 JabberStream *js = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
466 int len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
467 static char buf[4096];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
468
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
469 /* TODO: It should be possible to make this check unnecessary */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
470 if(!PURPLE_CONNECTION_IS_VALID(gc)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
471 purple_ssl_close(gsc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
472 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
473 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
474
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
475 while((len = purple_ssl_read(gsc, buf, sizeof(buf) - 1)) > 0) {
22149
252b96b6a32c Don't send keep-alives if we've received data since in the last KEEPALIVE_INTERVAL seconds
Sean Egan <seanegan@gmail.com>
parents: 22097
diff changeset
476 gc->last_received = time(NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
477 buf[len] = '\0';
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
478 purple_debug(PURPLE_DEBUG_INFO, "jabber", "Recv (ssl)(%d): %s\n", len, buf);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
479 jabber_parser_process(js, buf, len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
480 if(js->reinit)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
481 jabber_stream_init(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
482 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
483
23398
47b709962aab Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <mark@kingant.net>
parents: 23391
diff changeset
484 if(len < 0 && errno == EAGAIN)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
485 return;
23398
47b709962aab Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <mark@kingant.net>
parents: 23391
diff changeset
486 else {
47b709962aab Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <mark@kingant.net>
parents: 23391
diff changeset
487 if (len == 0)
47b709962aab Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <mark@kingant.net>
parents: 23391
diff changeset
488 purple_debug_info("jabber", "Server closed the connection.\n");
47b709962aab Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <mark@kingant.net>
parents: 23391
diff changeset
489 else
47b709962aab Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <mark@kingant.net>
parents: 23391
diff changeset
490 purple_debug_info("jabber", "Disconnected: %s\n", g_strerror(errno));
20117
f24a2cacacd1 Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents: 20076
diff changeset
491 purple_connection_error_reason (js->gc,
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
492 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
20117
f24a2cacacd1 Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents: 20076
diff changeset
493 _("Read Error"));
23398
47b709962aab Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <mark@kingant.net>
parents: 23391
diff changeset
494 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
495 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
496
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
497 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
498 jabber_recv_cb(gpointer data, gint source, PurpleInputCondition condition)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
499 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
500 PurpleConnection *gc = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
501 JabberStream *js = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
502 int len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
503 static char buf[4096];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
504
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
505 if(!PURPLE_CONNECTION_IS_VALID(gc))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
506 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
507
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
508 if((len = read(js->fd, buf, sizeof(buf) - 1)) > 0) {
22149
252b96b6a32c Don't send keep-alives if we've received data since in the last KEEPALIVE_INTERVAL seconds
Sean Egan <seanegan@gmail.com>
parents: 22097
diff changeset
509 gc->last_received = time(NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
510 #ifdef HAVE_CYRUS_SASL
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
511 if (js->sasl_maxbuf>0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
512 const char *out;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
513 unsigned int olen;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
514 sasl_decode(js->sasl, buf, len, &out, &olen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
515 if (olen>0) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
516 purple_debug(PURPLE_DEBUG_INFO, "jabber", "RecvSASL (%u): %s\n", olen, out);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
517 jabber_parser_process(js,out,olen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
518 if(js->reinit)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
519 jabber_stream_init(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
520 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
521 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
522 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
523 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
524 buf[len] = '\0';
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
525 purple_debug(PURPLE_DEBUG_INFO, "jabber", "Recv (%d): %s\n", len, buf);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
526 jabber_parser_process(js, buf, len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
527 if(js->reinit)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
528 jabber_stream_init(js);
23398
47b709962aab Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <mark@kingant.net>
parents: 23391
diff changeset
529 } else if(len < 0 && errno == EAGAIN) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
530 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
531 } else {
23398
47b709962aab Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <mark@kingant.net>
parents: 23391
diff changeset
532 if (len == 0)
47b709962aab Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <mark@kingant.net>
parents: 23391
diff changeset
533 purple_debug_info("jabber", "Server closed the connection.\n");
47b709962aab Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <mark@kingant.net>
parents: 23391
diff changeset
534 else
47b709962aab Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <mark@kingant.net>
parents: 23391
diff changeset
535 purple_debug_info("jabber", "Disconnected: %s\n", g_strerror(errno));
20117
f24a2cacacd1 Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents: 20076
diff changeset
536 purple_connection_error_reason (js->gc,
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
537 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
20117
f24a2cacacd1 Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents: 20076
diff changeset
538 _("Read Error"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
539 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
540 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
541
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
542 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
543 jabber_login_callback_ssl(gpointer data, PurpleSslConnection *gsc,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
544 PurpleInputCondition cond)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
545 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
546 PurpleConnection *gc = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
547 JabberStream *js;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
548
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
549 /* TODO: It should be possible to make this check unnecessary */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
550 if(!PURPLE_CONNECTION_IS_VALID(gc)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
551 purple_ssl_close(gsc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
552 return;
19999
da29f5c7dc1a Clear the password when we get an auth. error and we're not saving passwords so that you don't need to go into the account settings to reset it. Fix #3083.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19722
diff changeset
553 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
554
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
555 js = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
556
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
557 if(js->state == JABBER_STREAM_CONNECTING)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
558 jabber_send_raw(js, "<?xml version='1.0' ?>", -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
559 jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
560 purple_ssl_input_add(gsc, jabber_recv_cb_ssl, gc);
17606
108f3b42976f Introduced an additional connection stage to the jabber connection progress in order to be able to tell in the application, whether SSL/TLS is enabled, so it can display a lock icon next to the connection.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17603
diff changeset
561
108f3b42976f Introduced an additional connection stage to the jabber connection progress in order to be able to tell in the application, whether SSL/TLS is enabled, so it can display a lock icon next to the connection.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17603
diff changeset
562 /* Tell the app that we're doing encryption */
108f3b42976f Introduced an additional connection stage to the jabber connection progress in order to be able to tell in the application, whether SSL/TLS is enabled, so it can display a lock icon next to the connection.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17603
diff changeset
563 jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING_ENCRYPTION);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
564 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
565
25600
1cbe5a9f6efb * adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25597
diff changeset
566 static void
1cbe5a9f6efb * adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25597
diff changeset
567 jabber_bosh_login_callback(PurpleBOSHConnection *conn)
1cbe5a9f6efb * adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25597
diff changeset
568 {
1cbe5a9f6efb * adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25597
diff changeset
569 purple_debug_info("jabber","YAY...BOSH connection established.\n");
1cbe5a9f6efb * adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25597
diff changeset
570 }
1cbe5a9f6efb * adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25597
diff changeset
571
25596
7768cad83127 * looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25593
diff changeset
572 static void
7768cad83127 * looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25593
diff changeset
573 txt_resolved_cb(PurpleTxtResponse *resp, int results, gpointer data)
7768cad83127 * looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25593
diff changeset
574 {
7768cad83127 * looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25593
diff changeset
575 PurpleConnection *gc = data;
7768cad83127 * looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25593
diff changeset
576 JabberStream *js = gc->proto_data;
7768cad83127 * looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25593
diff changeset
577 int n;
7768cad83127 * looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25593
diff changeset
578
25597
9f8951284a2e * small bugfix in jabber_ipc_add_feature()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25596
diff changeset
579 if (results == 0) {
25596
7768cad83127 * looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25593
diff changeset
580 gchar *tmp;
7768cad83127 * looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25593
diff changeset
581 tmp = g_strdup_printf(_("Could not find alternative XMPP connection methods after failing to connect directly.\n"));
7768cad83127 * looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25593
diff changeset
582 purple_connection_error_reason (gc,
7768cad83127 * looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25593
diff changeset
583 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
25600
1cbe5a9f6efb * adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25597
diff changeset
584 g_free(tmp);
1cbe5a9f6efb * adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25597
diff changeset
585 return;
25596
7768cad83127 * looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25593
diff changeset
586 }
7768cad83127 * looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25593
diff changeset
587
7768cad83127 * looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25593
diff changeset
588 for (n = 0; n < results; n++) {
25597
9f8951284a2e * small bugfix in jabber_ipc_add_feature()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25596
diff changeset
589 gchar **token;
9f8951284a2e * small bugfix in jabber_ipc_add_feature()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25596
diff changeset
590 token = g_strsplit(resp[n].content, "=", 2);
9f8951284a2e * small bugfix in jabber_ipc_add_feature()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25596
diff changeset
591 if (!strcmp(token[0], "_xmpp-client-xbosh")) {
9f8951284a2e * small bugfix in jabber_ipc_add_feature()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25596
diff changeset
592 purple_debug_info("jabber","Found alternative connection method using %s at %s.\n", token[0], token[1]);
25602
f9322be084c4 * doing HTTP requests
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25601
diff changeset
593 jabber_bosh_connection_init(&(js->bosh), gc->account, js, token[1]);
25597
9f8951284a2e * small bugfix in jabber_ipc_add_feature()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25596
diff changeset
594 g_strfreev(token);
9f8951284a2e * small bugfix in jabber_ipc_add_feature()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25596
diff changeset
595 break;
9f8951284a2e * small bugfix in jabber_ipc_add_feature()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25596
diff changeset
596 }
9f8951284a2e * small bugfix in jabber_ipc_add_feature()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25596
diff changeset
597 g_strfreev(token);
25596
7768cad83127 * looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25593
diff changeset
598 }
25600
1cbe5a9f6efb * adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25597
diff changeset
599 if (js->bosh.host) {
1cbe5a9f6efb * adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25597
diff changeset
600 js->bosh.userdata = gc;
1cbe5a9f6efb * adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25597
diff changeset
601 jabber_bosh_connection_connect(&(js->bosh));
1cbe5a9f6efb * adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25597
diff changeset
602 } else {
1cbe5a9f6efb * adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25597
diff changeset
603 purple_debug_info("jabber","Didn't find an alternative connection method.\n");
1cbe5a9f6efb * adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25597
diff changeset
604 }
25596
7768cad83127 * looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25593
diff changeset
605 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
606
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
607 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
608 jabber_login_callback(gpointer data, gint source, const gchar *error)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
609 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
610 PurpleConnection *gc = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
611 JabberStream *js = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
612
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
613 if (source < 0) {
23643
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
614 if (js->srv_rec != NULL) {
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
615 purple_debug_error("jabber", "Unable to connect to server: %s. Trying next SRV record.\n", error);
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
616 try_srv_connect(js);
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
617 } else {
25716
ba362a67278c propagate from branch 'im.pidgin.pidgin' (head 2747d5e0324ca6b81e83bbb8b75e1efebcbbad6e)
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23644 25597
diff changeset
618 purple_debug_info("jabber","Couldn't connect directly to %s. Trying to find alternative connection methods, like BOSH.\n", js->user->domain);
ba362a67278c propagate from branch 'im.pidgin.pidgin' (head 2747d5e0324ca6b81e83bbb8b75e1efebcbbad6e)
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23644 25597
diff changeset
619 purple_txt_resolve("_xmppconnect", js->user->domain, txt_resolved_cb, gc);
23643
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
620 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
621 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
622 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
623
23643
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
624 g_free(js->srv_rec);
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
625 js->srv_rec = NULL;
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
626
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
627 js->fd = source;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
628
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
629 if(js->state == JABBER_STREAM_CONNECTING)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
630 jabber_send_raw(js, "<?xml version='1.0' ?>", -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
631
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
632 jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
633 gc->inpa = purple_input_add(js->fd, PURPLE_INPUT_READ, jabber_recv_cb, gc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
634 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
635
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
636 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
637 jabber_ssl_connect_failure(PurpleSslConnection *gsc, PurpleSslErrorType error,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
638 gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
639 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
640 PurpleConnection *gc = data;
15607
66dc2367b137 If jabber_ssl_connect_failure() is called because a connect attempt fails, but the user has already canceled the attempt by signing the account offline, this would previously crash. It now does not.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15498
diff changeset
641 JabberStream *js;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
642
15607
66dc2367b137 If jabber_ssl_connect_failure() is called because a connect attempt fails, but the user has already canceled the attempt by signing the account offline, this would previously crash. It now does not.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15498
diff changeset
643 /* If the connection is already disconnected, we don't need to do anything else */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
644 if(!PURPLE_CONNECTION_IS_VALID(gc))
15607
66dc2367b137 If jabber_ssl_connect_failure() is called because a connect attempt fails, but the user has already canceled the attempt by signing the account offline, this would previously crash. It now does not.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15498
diff changeset
645 return;
66dc2367b137 If jabber_ssl_connect_failure() is called because a connect attempt fails, but the user has already canceled the attempt by signing the account offline, this would previously crash. It now does not.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15498
diff changeset
646
66dc2367b137 If jabber_ssl_connect_failure() is called because a connect attempt fails, but the user has already canceled the attempt by signing the account offline, this would previously crash. It now does not.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15498
diff changeset
647 js = gc->proto_data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
648 js->gsc = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
649
20117
f24a2cacacd1 Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents: 20076
diff changeset
650 purple_connection_ssl_error (gc, error);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
651 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
652
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
653 static void tls_init(JabberStream *js)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
654 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
655 purple_input_remove(js->gc->inpa);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
656 js->gc->inpa = 0;
18929
67cb28c0ec89 applied changes from e52b685d84ca8874da6e3e71199829e513500642
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18163
diff changeset
657 js->gsc = purple_ssl_connect_with_host_fd(js->gc->account, js->fd,
22034
d63892ade0a6 Now checking the hostname supplied by the user, or the host-part of the JID when no host name is given against the CN of the domain. This makes libpurple comply to the RFC. Fixes http://trac.adiumx.com/ticket/8787
Andreas Monitzer <pidgin@monitzer.com>
parents: 22000
diff changeset
658 jabber_login_callback_ssl, jabber_ssl_connect_failure, js->certificate_CN, js->gc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
659 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
660
23643
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
661 static gboolean jabber_login_connect(JabberStream *js, const char *domain, const char *host, int port,
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
662 gboolean fatal_failure)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
663 {
22327
dc47e908965f Use connect server as FQDN for SASL auth except when it is an IP address.
Stu Tomlinson <stu@nosnilmot.com>
parents: 22149
diff changeset
664 /* host should be used in preference to domain to
dc47e908965f Use connect server as FQDN for SASL auth except when it is an IP address.
Stu Tomlinson <stu@nosnilmot.com>
parents: 22149
diff changeset
665 * allow SASL authentication to work with FQDN of the server,
dc47e908965f Use connect server as FQDN for SASL auth except when it is an IP address.
Stu Tomlinson <stu@nosnilmot.com>
parents: 22149
diff changeset
666 * but we use domain as fallback for when users enter IP address
dc47e908965f Use connect server as FQDN for SASL auth except when it is an IP address.
Stu Tomlinson <stu@nosnilmot.com>
parents: 22149
diff changeset
667 * in connect server */
23643
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
668 g_free(js->serverFQDN);
22327
dc47e908965f Use connect server as FQDN for SASL auth except when it is an IP address.
Stu Tomlinson <stu@nosnilmot.com>
parents: 22149
diff changeset
669 if (purple_ip_address_is_valid(host))
dc47e908965f Use connect server as FQDN for SASL auth except when it is an IP address.
Stu Tomlinson <stu@nosnilmot.com>
parents: 22149
diff changeset
670 js->serverFQDN = g_strdup(domain);
dc47e908965f Use connect server as FQDN for SASL auth except when it is an IP address.
Stu Tomlinson <stu@nosnilmot.com>
parents: 22149
diff changeset
671 else
dc47e908965f Use connect server as FQDN for SASL auth except when it is an IP address.
Stu Tomlinson <stu@nosnilmot.com>
parents: 22149
diff changeset
672 js->serverFQDN = g_strdup(host);
15766
51dd9ae01585 pass the correct domain to cyrus sasl (sf patch 1663064)
Nathan Walp <nwalp@pidgin.im>
parents: 15729
diff changeset
673
17007
37a2d6eadd34 fix #699
Nathan Walp <nwalp@pidgin.im>
parents: 16963
diff changeset
674 if (purple_proxy_connect(js->gc, js->gc->account, host,
23643
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
675 port, jabber_login_callback, js->gc) == NULL) {
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
676 if (fatal_failure) {
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
677 purple_connection_error_reason (js->gc,
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
678 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
679 _("Unable to create socket"));
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
680 }
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
681
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
682 return FALSE;
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
683 }
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
684
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
685 return TRUE;
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
686 }
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
687
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
688 static void try_srv_connect(JabberStream *js)
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
689 {
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
690 while (js->srv_rec != NULL && js->srv_rec_idx < js->max_srv_rec_idx) {
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
691 PurpleSrvResponse *tmp_resp = js->srv_rec + (js->srv_rec_idx++);
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
692 if (jabber_login_connect(js, tmp_resp->hostname, tmp_resp->hostname, tmp_resp->port, FALSE))
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
693 return;
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
694 }
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
695
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
696 g_free(js->srv_rec);
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
697 js->srv_rec = NULL;
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
698
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
699 /* Fall back to the defaults (I'm not sure if we should actually do this) */
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
700 jabber_login_connect(js, js->user->domain, js->user->domain,
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
701 purple_account_get_int(js->gc->account, "port", 5222), TRUE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
702 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
703
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
704 static void srv_resolved_cb(PurpleSrvResponse *resp, int results, gpointer data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
705 {
23643
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
706 JabberStream *js = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
707 js->srv_query_data = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
708
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
709 if(results) {
23643
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
710 js->srv_rec = resp;
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
711 js->srv_rec_idx = 0;
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
712 js->max_srv_rec_idx = results;
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
713 try_srv_connect(js);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
714 } else {
17007
37a2d6eadd34 fix #699
Nathan Walp <nwalp@pidgin.im>
parents: 16963
diff changeset
715 jabber_login_connect(js, js->user->domain, js->user->domain,
23643
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
716 purple_account_get_int(js->gc->account, "port", 5222), TRUE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
717 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
718 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
719
16240
547c76fe2e7a This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@gmail.com>
parents: 16068
diff changeset
720 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
721 jabber_login(PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
722 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
723 PurpleConnection *gc = purple_account_get_connection(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
724 const char *connect_server = purple_account_get_string(account,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
725 "connect_server", "");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
726 JabberStream *js;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
727 JabberBuddy *my_jb = NULL;
25774
514051f3b6cf Add option for forcing BOSH (useful for debugging)
Paul Aurich <paul@darkrain42.org>
parents: 25772
diff changeset
728 /* XXX FORCE_BOSH */
514051f3b6cf Add option for forcing BOSH (useful for debugging)
Paul Aurich <paul@darkrain42.org>
parents: 25772
diff changeset
729 gboolean force_bosh = purple_account_get_bool(account, "force_bosh", FALSE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
730
23445
4ac5db6e39f3 Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents: 23182
diff changeset
731 gc->flags |= PURPLE_CONNECTION_HTML |
4ac5db6e39f3 Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents: 23182
diff changeset
732 PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
733 js = gc->proto_data = g_new0(JabberStream, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
734 js->gc = gc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
735 js->fd = -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
736 js->iq_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
737 g_free, g_free);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
738 js->disco_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
739 g_free, g_free);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
740 js->buddies = g_hash_table_new_full(g_str_hash, g_str_equal,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
741 g_free, (GDestroyNotify)jabber_buddy_free);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
742 js->chats = g_hash_table_new_full(g_str_hash, g_str_equal,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
743 g_free, (GDestroyNotify)jabber_chat_free);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
744 js->user = jabber_id_new(purple_account_get_username(account));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
745 js->next_id = g_random_int();
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
746 js->write_buffer = purple_circ_buffer_new(512);
21978
cacc01b50a23 Fixes for incorrectly displaying user tune emblem and empty current media.
Stu Tomlinson <stu@nosnilmot.com>
parents: 21973
diff changeset
747 js->old_length = 0;
21964
eaaac273d80c Keep track of the keepalive timeout source so it can be removed when the account disconnects. This prevents a possible crash if the timeout fired after the account disconnected.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21948
diff changeset
748 js->keepalive_timeout = -1;
23287
eb27ae817284 Don't crash if the given jabber id is invalid. For example,
Mark Doliner <mark@kingant.net>
parents: 23271
diff changeset
749 js->certificate_CN = g_strdup(connect_server[0] ? connect_server : js->user ? js->user->domain : NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
750
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
751 if(!js->user) {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
752 purple_connection_error_reason (gc,
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
753 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS,
20117
f24a2cacacd1 Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents: 20076
diff changeset
754 _("Invalid XMPP ID"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
755 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
756 }
16963
919515748253 Handle people forgetting to enter a domain. Also, change 'server,' in the account options to 'domain,' which is its proper name, and hopefully less confusion
Sean Egan <seanegan@gmail.com>
parents: 16962
diff changeset
757
919515748253 Handle people forgetting to enter a domain. Also, change 'server,' in the account options to 'domain,' which is its proper name, and hopefully less confusion
Sean Egan <seanegan@gmail.com>
parents: 16962
diff changeset
758 if (!js->user->domain || *(js->user->domain) == '\0') {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
759 purple_connection_error_reason (gc,
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
760 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS,
20117
f24a2cacacd1 Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents: 20076
diff changeset
761 _("Invalid XMPP ID. Domain must be set."));
16963
919515748253 Handle people forgetting to enter a domain. Also, change 'server,' in the account options to 'domain,' which is its proper name, and hopefully less confusion
Sean Egan <seanegan@gmail.com>
parents: 16962
diff changeset
762 return;
919515748253 Handle people forgetting to enter a domain. Also, change 'server,' in the account options to 'domain,' which is its proper name, and hopefully less confusion
Sean Egan <seanegan@gmail.com>
parents: 16962
diff changeset
763 }
919515748253 Handle people forgetting to enter a domain. Also, change 'server,' in the account options to 'domain,' which is its proper name, and hopefully less confusion
Sean Egan <seanegan@gmail.com>
parents: 16962
diff changeset
764
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
765 if((my_jb = jabber_buddy_find(js, purple_account_get_username(account), TRUE)))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
766 my_jb->subscription |= JABBER_SUB_BOTH;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
767
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
768 jabber_stream_set_state(js, JABBER_STREAM_CONNECTING);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
769
25774
514051f3b6cf Add option for forcing BOSH (useful for debugging)
Paul Aurich <paul@darkrain42.org>
parents: 25772
diff changeset
770 /* XXX FORCE_BOSH: Remove this */
514051f3b6cf Add option for forcing BOSH (useful for debugging)
Paul Aurich <paul@darkrain42.org>
parents: 25772
diff changeset
771 if (force_bosh) {
514051f3b6cf Add option for forcing BOSH (useful for debugging)
Paul Aurich <paul@darkrain42.org>
parents: 25772
diff changeset
772 purple_txt_resolve("_xmppconnect", js->user->domain, txt_resolved_cb, gc);
514051f3b6cf Add option for forcing BOSH (useful for debugging)
Paul Aurich <paul@darkrain42.org>
parents: 25772
diff changeset
773 return;
514051f3b6cf Add option for forcing BOSH (useful for debugging)
Paul Aurich <paul@darkrain42.org>
parents: 25772
diff changeset
774 }
514051f3b6cf Add option for forcing BOSH (useful for debugging)
Paul Aurich <paul@darkrain42.org>
parents: 25772
diff changeset
775
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
776 /* if they've got old-ssl mode going, we probably want to ignore SRV lookups */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
777 if(purple_account_get_bool(js->gc->account, "old_ssl", FALSE)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
778 if(purple_ssl_is_supported()) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
779 js->gsc = purple_ssl_connect(js->gc->account,
22034
d63892ade0a6 Now checking the hostname supplied by the user, or the host-part of the JID when no host name is given against the CN of the domain. This makes libpurple comply to the RFC. Fixes http://trac.adiumx.com/ticket/8787
Andreas Monitzer <pidgin@monitzer.com>
parents: 22000
diff changeset
780 js->certificate_CN,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
781 purple_account_get_int(account, "port", 5223), jabber_login_callback_ssl,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
782 jabber_ssl_connect_failure, js->gc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
783 } else {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
784 purple_connection_error_reason (js->gc,
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
785 PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT,
20117
f24a2cacacd1 Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents: 20076
diff changeset
786 _("SSL support unavailable"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
787 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
788 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
789
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
790 /* no old-ssl, so if they've specified a connect server, we'll use that, otherwise we'll
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
791 * invoke the magic of SRV lookups, to figure out host and port */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
792 if(!js->gsc) {
25593
affaa4c4836e * some code style adjustments in caps.c
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25590
diff changeset
793 if(connect_server[0]) {
23643
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
794 jabber_login_connect(js, js->user->domain, connect_server, purple_account_get_int(account, "port", 5222), TRUE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
795 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
796 js->srv_query_data = purple_srv_resolve("xmpp-client",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
797 "tcp", js->user->domain, srv_resolved_cb, js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
798 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
799 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
800 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
801
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
802
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
803 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
804 conn_close_cb(gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
805 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
806 JabberStream *js = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
807 PurpleAccount *account = purple_connection_get_account(js->gc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
808
17603
7a3a66c6530a Fixed a leak: The XML parser was never cleaned up on disconnect.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17599
diff changeset
809 jabber_parser_free(js);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
810
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
811 purple_account_disconnect(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
812
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
813 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
814 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
815
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
816 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
817 jabber_connection_schedule_close(JabberStream *js)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
818 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
819 purple_timeout_add(0, conn_close_cb, js);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
820 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
821
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
822 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
823 jabber_registration_result_cb(JabberStream *js, xmlnode *packet, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
824 {
17607
ca0b86f3dbd2 Implemented a callback for a successful registration, supplying the username and password to the application when available, in the way explained by Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17606
diff changeset
825 PurpleAccount *account = purple_connection_get_account(js->gc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
826 const char *type = xmlnode_get_attrib(packet, "type");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
827 char *buf;
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
828 char *to = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
829
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
830 if(!strcmp(type, "result")) {
17607
ca0b86f3dbd2 Implemented a callback for a successful registration, supplying the username and password to the application when available, in the way explained by Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17606
diff changeset
831 if(js->registration) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
832 buf = g_strdup_printf(_("Registration of %s@%s successful"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
833 js->user->node, js->user->domain);
17608
a8b1159fd95b Simplified registration callback per request of Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17607
diff changeset
834 if(account->registration_cb)
a8b1159fd95b Simplified registration callback per request of Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17607
diff changeset
835 (account->registration_cb)(account, TRUE, account->registration_cb_user_data);
17607
ca0b86f3dbd2 Implemented a callback for a successful registration, supplying the username and password to the application when available, in the way explained by Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17606
diff changeset
836 }
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
837 else
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
838 buf = g_strdup_printf(_("Registration to %s successful"),
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
839 to);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
840 purple_notify_info(NULL, _("Registration Successful"),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
841 _("Registration Successful"), buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
842 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
843 } else {
20814
bde477ec6a71 Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents: 20792
diff changeset
844 char *msg = jabber_parse_error(js, packet, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
845
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
846 if(!msg)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
847 msg = g_strdup(_("Unknown Error"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
848
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
849 purple_notify_error(NULL, _("Registration Failed"),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
850 _("Registration Failed"), msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
851 g_free(msg);
17608
a8b1159fd95b Simplified registration callback per request of Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17607
diff changeset
852 if(account->registration_cb)
a8b1159fd95b Simplified registration callback per request of Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17607
diff changeset
853 (account->registration_cb)(account, FALSE, account->registration_cb_user_data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
854 }
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
855 g_free(to);
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
856 if(js->registration)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
857 jabber_connection_schedule_close(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
858 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
859
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
860 static void
18695
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
861 jabber_unregistration_result_cb(JabberStream *js, xmlnode *packet, gpointer data)
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
862 {
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
863 const char *type = xmlnode_get_attrib(packet, "type");
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
864 char *buf;
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
865 char *to = data;
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
866
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
867 if(!strcmp(type, "result")) {
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
868 buf = g_strdup_printf(_("Registration from %s successfully removed"),
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
869 to);
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
870 purple_notify_info(NULL, _("Unregistration Successful"),
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
871 _("Unregistration Successful"), buf);
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
872 g_free(buf);
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
873 } else {
20814
bde477ec6a71 Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents: 20792
diff changeset
874 char *msg = jabber_parse_error(js, packet, NULL);
18695
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
875
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
876 if(!msg)
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
877 msg = g_strdup(_("Unknown Error"));
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
878
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
879 purple_notify_error(NULL, _("Unregistration Failed"),
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
880 _("Unregistration Failed"), msg);
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
881 g_free(msg);
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
882 }
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
883 g_free(to);
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
884 }
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
885
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
886 typedef struct _JabberRegisterCBData {
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
887 JabberStream *js;
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
888 char *who;
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
889 } JabberRegisterCBData;
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
890
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
891 static void
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
892 jabber_register_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fields)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
893 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
894 GList *groups, *flds;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
895 xmlnode *query, *y;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
896 JabberIq *iq;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
897 char *username;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
898
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
899 iq = jabber_iq_new_query(cbdata->js, JABBER_IQ_SET, "jabber:iq:register");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
900 query = xmlnode_get_child(iq->node, "query");
21592
68b036c452f3 The Jabber registration process depends upon having a non-NULL cbdata->who,
Evan Schoenberg <evan.s@dreskin.net>
parents: 21591
diff changeset
901 xmlnode_set_attrib(iq->node, "to", cbdata->who);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
902
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
903 for(groups = purple_request_fields_get_groups(fields); groups;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
904 groups = groups->next) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
905 for(flds = purple_request_field_group_get_fields(groups->data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
906 flds; flds = flds->next) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
907 PurpleRequestField *field = flds->data;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
908 const char *id = purple_request_field_get_id(field);
18695
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
909 if(!strcmp(id,"unregister")) {
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
910 gboolean value = purple_request_field_bool_get_value(field);
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
911 if(value) {
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
912 /* unregister from service. this doesn't include any of the fields, so remove them from the stanza by recreating it
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
913 (there's no "remove child" function for xmlnode) */
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
914 jabber_iq_free(iq);
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
915 iq = jabber_iq_new_query(cbdata->js, JABBER_IQ_SET, "jabber:iq:register");
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
916 query = xmlnode_get_child(iq->node, "query");
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
917 xmlnode_set_attrib(iq->node,"to",cbdata->who);
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
918 xmlnode_new_child(query, "remove");
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
919
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
920 jabber_iq_set_callback(iq, jabber_unregistration_result_cb, cbdata->who);
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
921
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
922 jabber_iq_send(iq);
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
923 g_free(cbdata);
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
924 return;
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
925 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
926 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
927 const char *value = purple_request_field_string_get_value(field);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
928
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
929 if(!strcmp(id, "username")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
930 y = xmlnode_new_child(query, "username");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
931 } else if(!strcmp(id, "password")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
932 y = xmlnode_new_child(query, "password");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
933 } else if(!strcmp(id, "name")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
934 y = xmlnode_new_child(query, "name");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
935 } else if(!strcmp(id, "email")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
936 y = xmlnode_new_child(query, "email");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
937 } else if(!strcmp(id, "nick")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
938 y = xmlnode_new_child(query, "nick");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
939 } else if(!strcmp(id, "first")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
940 y = xmlnode_new_child(query, "first");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
941 } else if(!strcmp(id, "last")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
942 y = xmlnode_new_child(query, "last");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
943 } else if(!strcmp(id, "address")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
944 y = xmlnode_new_child(query, "address");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
945 } else if(!strcmp(id, "city")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
946 y = xmlnode_new_child(query, "city");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
947 } else if(!strcmp(id, "state")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
948 y = xmlnode_new_child(query, "state");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
949 } else if(!strcmp(id, "zip")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
950 y = xmlnode_new_child(query, "zip");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
951 } else if(!strcmp(id, "phone")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
952 y = xmlnode_new_child(query, "phone");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
953 } else if(!strcmp(id, "url")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
954 y = xmlnode_new_child(query, "url");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
955 } else if(!strcmp(id, "date")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
956 y = xmlnode_new_child(query, "date");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
957 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
958 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
959 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
960 xmlnode_insert_data(y, value, -1);
18695
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
961 if(cbdata->js->registration && !strcmp(id, "username")) {
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
962 if(cbdata->js->user->node)
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
963 g_free(cbdata->js->user->node);
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
964 cbdata->js->user->node = g_strdup(value);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
965 }
18695
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
966 if(cbdata->js->registration && !strcmp(id, "password"))
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
967 purple_account_set_password(cbdata->js->gc->account, value);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
968 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
969 }
19696
481749fc0b6b merge of '1c7910841138381c841363256ca3c7905b1f26b0'
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19694 19680
diff changeset
970 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
971
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
972 if(cbdata->js->registration) {
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
973 username = g_strdup_printf("%s@%s/%s", cbdata->js->user->node, cbdata->js->user->domain,
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
974 cbdata->js->user->resource);
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
975 purple_account_set_username(cbdata->js->gc->account, username);
21592
68b036c452f3 The Jabber registration process depends upon having a non-NULL cbdata->who,
Evan Schoenberg <evan.s@dreskin.net>
parents: 21591
diff changeset
976 g_free(username);
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
977 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
978
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
979 jabber_iq_set_callback(iq, jabber_registration_result_cb, cbdata->who);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
980
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
981 jabber_iq_send(iq);
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
982 g_free(cbdata);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
983 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
984
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
985 static void
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
986 jabber_register_cancel_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fields)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
987 {
17607
ca0b86f3dbd2 Implemented a callback for a successful registration, supplying the username and password to the application when available, in the way explained by Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17606
diff changeset
988 PurpleAccount *account = purple_connection_get_account(cbdata->js->gc);
19489
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 19277
diff changeset
989 if(account && cbdata->js->registration) {
17607
ca0b86f3dbd2 Implemented a callback for a successful registration, supplying the username and password to the application when available, in the way explained by Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17606
diff changeset
990 if(account->registration_cb)
17608
a8b1159fd95b Simplified registration callback per request of Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17607
diff changeset
991 (account->registration_cb)(account, FALSE, account->registration_cb_user_data);
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
992 jabber_connection_schedule_close(cbdata->js);
20276
c1d3d25e8c49 Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents: 20187
diff changeset
993 }
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
994 g_free(cbdata->who);
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
995 g_free(cbdata);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
996 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
997
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
998 static void jabber_register_x_data_cb(JabberStream *js, xmlnode *result, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
999 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1000 xmlnode *query;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1001 JabberIq *iq;
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1002 char *to = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1003
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1004 iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1005 query = xmlnode_get_child(iq->node, "query");
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1006 xmlnode_set_attrib(iq->node,"to",to);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1007
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1008 xmlnode_insert_child(query, result);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1009
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1010 jabber_iq_set_callback(iq, jabber_registration_result_cb, to);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1011 jabber_iq_send(iq);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1012 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1013
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1014 void jabber_register_parse(JabberStream *js, xmlnode *packet)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1015 {
17607
ca0b86f3dbd2 Implemented a callback for a successful registration, supplying the username and password to the application when available, in the way explained by Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17606
diff changeset
1016 PurpleAccount *account = purple_connection_get_account(js->gc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1017 const char *type;
21592
68b036c452f3 The Jabber registration process depends upon having a non-NULL cbdata->who,
Evan Schoenberg <evan.s@dreskin.net>
parents: 21591
diff changeset
1018 const char *from;
21326
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1019 PurpleRequestFields *fields;
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1020 PurpleRequestFieldGroup *group;
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1021 PurpleRequestField *field;
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1022 xmlnode *query, *x, *y;
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1023 char *instructions;
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1024 JabberRegisterCBData *cbdata;
18695
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
1025 gboolean registered = FALSE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1026
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1027 if(!(type = xmlnode_get_attrib(packet, "type")) || strcmp(type, "result"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1028 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1029
21592
68b036c452f3 The Jabber registration process depends upon having a non-NULL cbdata->who,
Evan Schoenberg <evan.s@dreskin.net>
parents: 21591
diff changeset
1030 from = xmlnode_get_attrib(packet, "from");
68b036c452f3 The Jabber registration process depends upon having a non-NULL cbdata->who,
Evan Schoenberg <evan.s@dreskin.net>
parents: 21591
diff changeset
1031 if (!from)
68b036c452f3 The Jabber registration process depends upon having a non-NULL cbdata->who,
Evan Schoenberg <evan.s@dreskin.net>
parents: 21591
diff changeset
1032 from = js->serverFQDN;
68b036c452f3 The Jabber registration process depends upon having a non-NULL cbdata->who,
Evan Schoenberg <evan.s@dreskin.net>
parents: 21591
diff changeset
1033 g_return_if_fail(from != NULL);
68b036c452f3 The Jabber registration process depends upon having a non-NULL cbdata->who,
Evan Schoenberg <evan.s@dreskin.net>
parents: 21591
diff changeset
1034
21326
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1035 if(js->registration) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1036 /* get rid of the login thingy */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1037 purple_connection_set_state(js->gc, PURPLE_CONNECTED);
21326
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1038 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1039
21326
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1040 query = xmlnode_get_child(packet, "query");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1041
21326
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1042 if(xmlnode_get_child(query, "registered")) {
18695
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
1043 registered = TRUE;
21326
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1044
17607
ca0b86f3dbd2 Implemented a callback for a successful registration, supplying the username and password to the application when available, in the way explained by Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17606
diff changeset
1045 if(js->registration) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1046 purple_notify_error(NULL, _("Already Registered"),
21326
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1047 _("Already Registered"), NULL);
17607
ca0b86f3dbd2 Implemented a callback for a successful registration, supplying the username and password to the application when available, in the way explained by Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17606
diff changeset
1048 if(account->registration_cb)
17608
a8b1159fd95b Simplified registration callback per request of Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17607
diff changeset
1049 (account->registration_cb)(account, FALSE, account->registration_cb_user_data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1050 jabber_connection_schedule_close(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1051 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1052 }
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1053 }
21326
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1054
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1055 if((x = xmlnode_get_child_with_namespace(packet, "x", "jabber:x:data"))) {
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1056 jabber_x_data_request(js, x, jabber_register_x_data_cb, g_strdup(from));
21326
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1057 return;
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1058
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1059 } else if((x = xmlnode_get_child_with_namespace(packet, "x", "jabber:x:oob"))) {
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1060 xmlnode *url;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1061
21326
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1062 if((url = xmlnode_get_child(x, "url"))) {
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1063 char *href;
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1064 if((href = xmlnode_get_data(url))) {
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1065 purple_notify_uri(NULL, href);
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1066 g_free(href);
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1067
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1068 if(js->registration) {
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1069 js->gc->wants_to_die = TRUE;
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1070 if(account->registration_cb) /* succeeded, but we have no login info */
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1071 (account->registration_cb)(account, TRUE, account->registration_cb_user_data);
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1072 jabber_connection_schedule_close(js);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1073 }
21326
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1074 return;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1075 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1076 }
21326
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1077 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1078
21326
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1079 /* as a last resort, use the old jabber:iq:register syntax */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1080
21326
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1081 fields = purple_request_fields_new();
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1082 group = purple_request_field_group_new(NULL);
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1083 purple_request_fields_add_group(fields, group);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1084
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1085 if(js->registration)
21326
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1086 field = purple_request_field_string_new("username", _("Username"), js->user->node, FALSE);
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1087 else
21326
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1088 field = purple_request_field_string_new("username", _("Username"), NULL, FALSE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1089
21326
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1090 purple_request_field_group_add_field(group, field);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1091
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1092 if(js->registration)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1093 field = purple_request_field_string_new("password", _("Password"),
21326
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1094 purple_connection_get_password(js->gc), FALSE);
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1095 else
21326
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1096 field = purple_request_field_string_new("password", _("Password"), NULL, FALSE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1097
21326
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1098 purple_request_field_string_set_masked(field, TRUE);
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1099 purple_request_field_group_add_field(group, field);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1100
21326
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1101 if(xmlnode_get_child(query, "name")) {
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1102 if(js->registration)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1103 field = purple_request_field_string_new("name", _("Name"),
21326
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1104 purple_account_get_alias(js->gc->account), FALSE);
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1105 else
21326
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1106 field = purple_request_field_string_new("name", _("Name"), NULL, FALSE);
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1107 purple_request_field_group_add_field(group, field);
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1108 }
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1109 if(xmlnode_get_child(query, "email")) {
23182
e0bcb8cfda74 Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@wiktel.com>
parents: 22933
diff changeset
1110 field = purple_request_field_string_new("email", _("Email"), NULL, FALSE);
21326
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1111 purple_request_field_group_add_field(group, field);
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1112 }
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1113 if(xmlnode_get_child(query, "nick")) {
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1114 field = purple_request_field_string_new("nick", _("Nickname"), NULL, FALSE);
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1115 purple_request_field_group_add_field(group, field);
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1116 }
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1117 if(xmlnode_get_child(query, "first")) {
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1118 field = purple_request_field_string_new("first", _("First name"), NULL, FALSE);
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1119 purple_request_field_group_add_field(group, field);
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1120 }
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1121 if(xmlnode_get_child(query, "last")) {
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1122 field = purple_request_field_string_new("last", _("Last name"), NULL, FALSE);
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1123 purple_request_field_group_add_field(group, field);
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1124 }
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1125 if(xmlnode_get_child(query, "address")) {
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1126 field = purple_request_field_string_new("address", _("Address"), NULL, FALSE);
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1127 purple_request_field_group_add_field(group, field);
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1128 }
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1129 if(xmlnode_get_child(query, "city")) {
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1130 field = purple_request_field_string_new("city", _("City"), NULL, FALSE);
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1131 purple_request_field_group_add_field(group, field);
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1132 }
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1133 if(xmlnode_get_child(query, "state")) {
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1134 field = purple_request_field_string_new("state", _("State"), NULL, FALSE);
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1135 purple_request_field_group_add_field(group, field);
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1136 }
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1137 if(xmlnode_get_child(query, "zip")) {
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1138 field = purple_request_field_string_new("zip", _("Postal code"), NULL, FALSE);
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1139 purple_request_field_group_add_field(group, field);
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1140 }
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1141 if(xmlnode_get_child(query, "phone")) {
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1142 field = purple_request_field_string_new("phone", _("Phone"), NULL, FALSE);
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1143 purple_request_field_group_add_field(group, field);
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1144 }
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1145 if(xmlnode_get_child(query, "url")) {
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1146 field = purple_request_field_string_new("url", _("URL"), NULL, FALSE);
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1147 purple_request_field_group_add_field(group, field);
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1148 }
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1149 if(xmlnode_get_child(query, "date")) {
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1150 field = purple_request_field_string_new("date", _("Date"), NULL, FALSE);
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1151 purple_request_field_group_add_field(group, field);
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1152 }
18695
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
1153 if(registered) {
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
1154 field = purple_request_field_bool_new("unregister", _("Unregister"), FALSE);
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
1155 purple_request_field_group_add_field(group, field);
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
1156 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1157
20276
c1d3d25e8c49 Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents: 20187
diff changeset
1158 if((y = xmlnode_get_child(query, "instructions")))
c1d3d25e8c49 Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents: 20187
diff changeset
1159 instructions = xmlnode_get_data(y);
18695
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
1160 else if(registered)
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
1161 instructions = g_strdup(_("Please fill out the information below "
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
1162 "to change your account registration."));
20276
c1d3d25e8c49 Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents: 20187
diff changeset
1163 else
c1d3d25e8c49 Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents: 20187
diff changeset
1164 instructions = g_strdup(_("Please fill out the information below "
c1d3d25e8c49 Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents: 20187
diff changeset
1165 "to register your new account."));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1166
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1167 cbdata = g_new0(JabberRegisterCBData, 1);
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1168 cbdata->js = js;
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1169 cbdata->who = g_strdup(from);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1170
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1171 if(js->registration)
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
1172 purple_request_fields(js->gc, _("Register New XMPP Account"),
16915
56042b2f8b64 s/Jabber/XMPP in user-visible places.
Richard Laager <rlaager@wiktel.com>
parents: 16822
diff changeset
1173 _("Register New XMPP Account"), instructions, fields,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1174 _("Register"), G_CALLBACK(jabber_register_cb),
16442
08db93bbd798 Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents: 16240
diff changeset
1175 _("Cancel"), G_CALLBACK(jabber_register_cancel_cb),
08db93bbd798 Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents: 16240
diff changeset
1176 purple_connection_get_account(js->gc), NULL, NULL,
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
1177 cbdata);
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1178 else {
18695
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
1179 char *title = registered?g_strdup_printf(_("Change Account Registration at %s"), from)
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
1180 :g_strdup_printf(_("Register New Account at %s"), from);
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
1181 purple_request_fields(js->gc, title,
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1182 title, instructions, fields,
21326
6ba02326c9e1 Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21284
diff changeset
1183 (registered ? _("Change Registration") : _("Register")), G_CALLBACK(jabber_register_cb),
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1184 _("Cancel"), G_CALLBACK(jabber_register_cancel_cb),
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1185 purple_connection_get_account(js->gc), NULL, NULL,
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
1186 cbdata);
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1187 g_free(title);
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1188 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1189
20276
c1d3d25e8c49 Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents: 20187
diff changeset
1190 g_free(instructions);
c1d3d25e8c49 Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents: 20187
diff changeset
1191 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1192
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1193 void jabber_register_start(JabberStream *js)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1194 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1195 JabberIq *iq;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1196
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1197 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:register");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1198 jabber_iq_send(iq);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1199 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1200
17599
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1201 void jabber_register_gateway(JabberStream *js, const char *gateway) {
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1202 JabberIq *iq;
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1203
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1204 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:register");
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1205 xmlnode_set_attrib(iq->node, "to", gateway);
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1206 jabber_iq_send(iq);
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1207 }
8c3fbc353a9c Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17596
diff changeset
1208
16240
547c76fe2e7a This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@gmail.com>
parents: 16068
diff changeset
1209 void jabber_register_account(PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1210 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1211 PurpleConnection *gc = purple_account_get_connection(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1212 JabberStream *js;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1213 JabberBuddy *my_jb = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1214 const char *connect_server = purple_account_get_string(account,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1215 "connect_server", "");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1216 const char *server;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1217
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1218 js = gc->proto_data = g_new0(JabberStream, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1219 js->gc = gc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1220 js->registration = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1221 js->iq_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1222 g_free, g_free);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1223 js->disco_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1224 g_free, g_free);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1225 js->user = jabber_id_new(purple_account_get_username(account));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1226 js->next_id = g_random_int();
21978
cacc01b50a23 Fixes for incorrectly displaying user tune emblem and empty current media.
Stu Tomlinson <stu@nosnilmot.com>
parents: 21973
diff changeset
1227 js->old_length = 0;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1228
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1229 if(!js->user) {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
1230 purple_connection_error_reason (gc,
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
1231 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS,
20117
f24a2cacacd1 Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents: 20076
diff changeset
1232 _("Invalid XMPP ID"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1233 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1234 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1235
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1236 js->write_buffer = purple_circ_buffer_new(512);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1237
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1238 if((my_jb = jabber_buddy_find(js, purple_account_get_username(account), TRUE)))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1239 my_jb->subscription |= JABBER_SUB_BOTH;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1240
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1241 server = connect_server[0] ? connect_server : js->user->domain;
22034
d63892ade0a6 Now checking the hostname supplied by the user, or the host-part of the JID when no host name is given against the CN of the domain. This makes libpurple comply to the RFC. Fixes http://trac.adiumx.com/ticket/8787
Andreas Monitzer <pidgin@monitzer.com>
parents: 22000
diff changeset
1242 js->certificate_CN = g_strdup(server);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1243
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1244 jabber_stream_set_state(js, JABBER_STREAM_CONNECTING);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1245
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1246 if(purple_account_get_bool(account, "old_ssl", FALSE)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1247 if(purple_ssl_is_supported()) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1248 js->gsc = purple_ssl_connect(account, server,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1249 purple_account_get_int(account, "port", 5222),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1250 jabber_login_callback_ssl, jabber_ssl_connect_failure, gc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1251 } else {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
1252 purple_connection_error_reason (gc,
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
1253 PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT,
20117
f24a2cacacd1 Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents: 20076
diff changeset
1254 _("SSL support unavailable"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1255 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1256 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1257
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1258 if(!js->gsc) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1259 if (connect_server[0]) {
17007
37a2d6eadd34 fix #699
Nathan Walp <nwalp@pidgin.im>
parents: 16963
diff changeset
1260 jabber_login_connect(js, js->user->domain, server,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1261 purple_account_get_int(account,
23643
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
1262 "port", 5222), TRUE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1263 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1264 js->srv_query_data = purple_srv_resolve("xmpp-client",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1265 "tcp",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1266 js->user->domain,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1267 srv_resolved_cb,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1268 js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1269 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1270 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1271 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1272
18703
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1273 static void jabber_unregister_account_iq_cb(JabberStream *js, xmlnode *packet, gpointer data) {
18920
2a9d60d7af82 Implemented a callback for unregistering, mirroring the registration callback. Since this is a new API, I can do it properly by passing it right in the unregister function call, instead of having a separate function for setting it.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18919
diff changeset
1274 PurpleAccount *account = purple_connection_get_account(js->gc);
18703
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1275 const char *type = xmlnode_get_attrib(packet,"type");
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1276 if(!strcmp(type,"error")) {
20814
bde477ec6a71 Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents: 20792
diff changeset
1277 char *msg = jabber_parse_error(js, packet, NULL);
18703
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1278
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1279 purple_notify_error(js->gc, _("Error unregistering account"),
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1280 _("Error unregistering account"), msg);
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1281 g_free(msg);
18920
2a9d60d7af82 Implemented a callback for unregistering, mirroring the registration callback. Since this is a new API, I can do it properly by passing it right in the unregister function call, instead of having a separate function for setting it.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18919
diff changeset
1282 if(js->unregistration_cb)
18921
ba3b22cd280b Mixed up TRUE and FALSE.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18920
diff changeset
1283 js->unregistration_cb(account, FALSE, js->unregistration_user_data);
18703
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1284 } else if(!strcmp(type,"result")) {
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1285 purple_notify_info(js->gc, _("Account successfully unregistered"),
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1286 _("Account successfully unregistered"), NULL);
18920
2a9d60d7af82 Implemented a callback for unregistering, mirroring the registration callback. Since this is a new API, I can do it properly by passing it right in the unregister function call, instead of having a separate function for setting it.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18919
diff changeset
1287 if(js->unregistration_cb)
18921
ba3b22cd280b Mixed up TRUE and FALSE.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18920
diff changeset
1288 js->unregistration_cb(account, TRUE, js->unregistration_user_data);
18703
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1289 }
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1290 }
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1291
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1292 static void jabber_unregister_account_cb(JabberStream *js) {
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1293 JabberIq *iq;
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1294 xmlnode *query;
20000
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1295
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1296 g_return_if_fail(js->unregistration);
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1297
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1298 iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register");
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1299
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1300 query = xmlnode_get_child_with_namespace(iq->node, "query", "jabber:iq:register");
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1301
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1302 xmlnode_new_child(query, "remove");
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1303 xmlnode_set_attrib(iq->node, "to", js->user->domain);
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1304
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1305 jabber_iq_set_callback(iq, jabber_unregister_account_iq_cb, NULL);
18703
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1306 jabber_iq_send(iq);
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1307 }
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1308
18920
2a9d60d7af82 Implemented a callback for unregistering, mirroring the registration callback. Since this is a new API, I can do it properly by passing it right in the unregister function call, instead of having a separate function for setting it.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18919
diff changeset
1309 void jabber_unregister_account(PurpleAccount *account, PurpleAccountUnregistrationCb cb, void *user_data) {
18703
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1310 PurpleConnection *gc = purple_account_get_connection(account);
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1311 JabberStream *js;
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1312
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1313 if(gc->state != PURPLE_CONNECTED) {
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1314 if(gc->state != PURPLE_CONNECTING)
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1315 jabber_login(account);
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1316 js = gc->proto_data;
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1317 js->unregistration = TRUE;
18920
2a9d60d7af82 Implemented a callback for unregistering, mirroring the registration callback. Since this is a new API, I can do it properly by passing it right in the unregister function call, instead of having a separate function for setting it.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18919
diff changeset
1318 js->unregistration_cb = cb;
2a9d60d7af82 Implemented a callback for unregistering, mirroring the registration callback. Since this is a new API, I can do it properly by passing it right in the unregister function call, instead of having a separate function for setting it.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18919
diff changeset
1319 js->unregistration_user_data = user_data;
18703
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1320 return;
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1321 }
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1322
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1323 js = gc->proto_data;
20000
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1324
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1325 if (js->unregistration) {
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1326 purple_debug_error("jabber", "Unregistration in process; ignoring duplicate request.\n");
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1327 return;
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1328 }
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1329
18703
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1330 js->unregistration = TRUE;
18920
2a9d60d7af82 Implemented a callback for unregistering, mirroring the registration callback. Since this is a new API, I can do it properly by passing it right in the unregister function call, instead of having a separate function for setting it.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18919
diff changeset
1331 js->unregistration_cb = cb;
2a9d60d7af82 Implemented a callback for unregistering, mirroring the registration callback. Since this is a new API, I can do it properly by passing it right in the unregister function call, instead of having a separate function for setting it.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18919
diff changeset
1332 js->unregistration_user_data = user_data;
20000
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1333
18703
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1334 jabber_unregister_account_cb(js);
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1335 }
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18695
diff changeset
1336
16240
547c76fe2e7a This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@gmail.com>
parents: 16068
diff changeset
1337 void jabber_close(PurpleConnection *gc)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1338 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1339 JabberStream *js = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1340
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1341 /* Don't perform any actions on the ssl connection
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1342 * if we were forcibly disconnected because it will crash
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1343 * on some SSL backends.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1344 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1345 if (!gc->disconnect_timeout)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1346 jabber_send_raw(js, "</stream:stream>", -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1347
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1348 if (js->srv_query_data)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1349 purple_srv_cancel(js->srv_query_data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1350
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1351 if(js->gsc) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1352 #ifdef HAVE_OPENSSL
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1353 if (!gc->disconnect_timeout)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1354 #endif
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1355 purple_ssl_close(js->gsc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1356 } else if (js->fd > 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1357 if(js->gc->inpa)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1358 purple_input_remove(js->gc->inpa);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1359 close(js->fd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1360 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1361
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1362 jabber_buddy_remove_all_pending_buddy_info_requests(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1363
17603
7a3a66c6530a Fixed a leak: The XML parser was never cleaned up on disconnect.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17599
diff changeset
1364 jabber_parser_free(js);
7a3a66c6530a Fixed a leak: The XML parser was never cleaned up on disconnect.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17599
diff changeset
1365
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1366 if(js->iq_callbacks)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1367 g_hash_table_destroy(js->iq_callbacks);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1368 if(js->disco_callbacks)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1369 g_hash_table_destroy(js->disco_callbacks);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1370 if(js->buddies)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1371 g_hash_table_destroy(js->buddies);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1372 if(js->chats)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1373 g_hash_table_destroy(js->chats);
21603
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21592
diff changeset
1374
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1375 while(js->chat_servers) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1376 g_free(js->chat_servers->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1377 js->chat_servers = g_list_delete_link(js->chat_servers, js->chat_servers);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1378 }
21603
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21592
diff changeset
1379
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1380 while(js->user_directories) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1381 g_free(js->user_directories->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1382 js->user_directories = g_list_delete_link(js->user_directories, js->user_directories);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1383 }
21603
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21592
diff changeset
1384
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21592
diff changeset
1385 while(js->bs_proxies) {
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21592
diff changeset
1386 JabberBytestreamsStreamhost *sh = js->bs_proxies->data;
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21592
diff changeset
1387 g_free(sh->jid);
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21592
diff changeset
1388 g_free(sh->host);
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21592
diff changeset
1389 g_free(sh->zeroconf);
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21592
diff changeset
1390 g_free(sh);
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21592
diff changeset
1391 js->bs_proxies = g_list_delete_link(js->bs_proxies, js->bs_proxies);
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21592
diff changeset
1392 }
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21592
diff changeset
1393
23744
3c3032be12de Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23644
diff changeset
1394 while(js->url_datas) {
3c3032be12de Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23644
diff changeset
1395 purple_util_fetch_url_cancel(js->url_datas->data);
3c3032be12de Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23644
diff changeset
1396 js->url_datas = g_slist_delete_link(js->url_datas, js->url_datas);
3c3032be12de Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23644
diff changeset
1397 }
3c3032be12de Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23644
diff changeset
1398
21603
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21592
diff changeset
1399 g_free(js->stream_id);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1400 if(js->user)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1401 jabber_id_free(js->user);
21603
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21592
diff changeset
1402 g_free(js->avatar_hash);
25742
4040da08a733 Entity Capabilities must be per-JabberStream
Paul Aurich <paul@darkrain42.org>
parents: 25741
diff changeset
1403 g_free(js->caps_hash);
21603
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21592
diff changeset
1404
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1405 purple_circ_buffer_destroy(js->write_buffer);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1406 if(js->writeh)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1407 purple_input_remove(js->writeh);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1408 #ifdef HAVE_CYRUS_SASL
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1409 if(js->sasl)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1410 sasl_dispose(&js->sasl);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1411 if(js->sasl_mechs)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1412 g_string_free(js->sasl_mechs, TRUE);
21603
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21592
diff changeset
1413 g_free(js->sasl_cb);
18929
67cb28c0ec89 applied changes from e52b685d84ca8874da6e3e71199829e513500642
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18163
diff changeset
1414 #endif
21603
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21592
diff changeset
1415 g_free(js->serverFQDN);
17610
9a19c46adf66 The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17608
diff changeset
1416 while(js->commands) {
9a19c46adf66 The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17608
diff changeset
1417 JabberAdHocCommands *cmd = js->commands->data;
9a19c46adf66 The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17608
diff changeset
1418 g_free(cmd->jid);
9a19c46adf66 The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17608
diff changeset
1419 g_free(cmd->node);
17620
11dd7969dd4b Fixed copy/paste error.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17617
diff changeset
1420 g_free(cmd->name);
17610
9a19c46adf66 The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17608
diff changeset
1421 g_free(cmd);
9a19c46adf66 The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17608
diff changeset
1422 js->commands = g_list_delete_link(js->commands, js->commands);
9a19c46adf66 The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17608
diff changeset
1423 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1424 g_free(js->server_name);
22034
d63892ade0a6 Now checking the hostname supplied by the user, or the host-part of the JID when no host name is given against the CN of the domain. This makes libpurple comply to the RFC. Fixes http://trac.adiumx.com/ticket/8787
Andreas Monitzer <pidgin@monitzer.com>
parents: 22000
diff changeset
1425 g_free(js->certificate_CN);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1426 g_free(js->gmail_last_time);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1427 g_free(js->gmail_last_tid);
21603
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21592
diff changeset
1428 g_free(js->old_msg);
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21592
diff changeset
1429 g_free(js->old_avatarhash);
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21592
diff changeset
1430 g_free(js->old_artist);
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21592
diff changeset
1431 g_free(js->old_title);
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21592
diff changeset
1432 g_free(js->old_source);
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21592
diff changeset
1433 g_free(js->old_uri);
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21592
diff changeset
1434 g_free(js->old_track);
22933
9dc7e1d4da15 patch from Andrew Gaul to fix another memleak
Ka-Hing Cheung <khc@hxbc.us>
parents: 22602
diff changeset
1435 g_free(js->expected_rspauth);
21603
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21592
diff changeset
1436
21964
eaaac273d80c Keep track of the keepalive timeout source so it can be removed when the account disconnects. This prevents a possible crash if the timeout fired after the account disconnected.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21948
diff changeset
1437 if (js->keepalive_timeout != -1)
eaaac273d80c Keep track of the keepalive timeout source so it can be removed when the account disconnects. This prevents a possible crash if the timeout fired after the account disconnected.
Evan Schoenberg <evan.s@dreskin.net>
parents: 21948
diff changeset
1438 purple_timeout_remove(js->keepalive_timeout);
23643
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
1439
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
1440 g_free(js->srv_rec);
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
1441 js->srv_rec = NULL;
224169be5830 Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23398
diff changeset
1442
23644
fa8567fa0ca0 Fix a stupid mistake in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23643
diff changeset
1443 g_free(js);
fa8567fa0ca0 Fix a stupid mistake in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23643
diff changeset
1444
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1445 gc->proto_data = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1446 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1447
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1448 void jabber_stream_set_state(JabberStream *js, JabberStreamState state)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1449 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1450 js->state = state;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1451 switch(state) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1452 case JABBER_STREAM_OFFLINE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1453 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1454 case JABBER_STREAM_CONNECTING:
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1455 purple_connection_update_progress(js->gc, _("Connecting"), 1,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1456 JABBER_CONNECT_STEPS);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1457 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1458 case JABBER_STREAM_INITIALIZING:
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1459 purple_connection_update_progress(js->gc, _("Initializing Stream"),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1460 js->gsc ? 5 : 2, JABBER_CONNECT_STEPS);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1461 jabber_stream_init(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1462 break;
17606
108f3b42976f Introduced an additional connection stage to the jabber connection progress in order to be able to tell in the application, whether SSL/TLS is enabled, so it can display a lock icon next to the connection.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17603
diff changeset
1463 case JABBER_STREAM_INITIALIZING_ENCRYPTION:
108f3b42976f Introduced an additional connection stage to the jabber connection progress in order to be able to tell in the application, whether SSL/TLS is enabled, so it can display a lock icon next to the connection.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17603
diff changeset
1464 purple_connection_update_progress(js->gc, _("Initializing SSL/TLS"),
108f3b42976f Introduced an additional connection stage to the jabber connection progress in order to be able to tell in the application, whether SSL/TLS is enabled, so it can display a lock icon next to the connection.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17603
diff changeset
1465 6, JABBER_CONNECT_STEPS);
108f3b42976f Introduced an additional connection stage to the jabber connection progress in order to be able to tell in the application, whether SSL/TLS is enabled, so it can display a lock icon next to the connection.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17603
diff changeset
1466 break;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1467 case JABBER_STREAM_AUTHENTICATING:
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1468 purple_connection_update_progress(js->gc, _("Authenticating"),
17606
108f3b42976f Introduced an additional connection stage to the jabber connection progress in order to be able to tell in the application, whether SSL/TLS is enabled, so it can display a lock icon next to the connection.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17603
diff changeset
1469 js->gsc ? 7 : 3, JABBER_CONNECT_STEPS);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1470 if(js->protocol_version == JABBER_PROTO_0_9 && js->registration) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1471 jabber_register_start(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1472 } else if(js->auth_type == JABBER_AUTH_IQ_AUTH) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1473 jabber_auth_start_old(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1474 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1475 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1476 case JABBER_STREAM_REINITIALIZING:
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1477 purple_connection_update_progress(js->gc, _("Re-initializing Stream"),
17606
108f3b42976f Introduced an additional connection stage to the jabber connection progress in order to be able to tell in the application, whether SSL/TLS is enabled, so it can display a lock icon next to the connection.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17603
diff changeset
1478 (js->gsc ? 8 : 4), JABBER_CONNECT_STEPS);
16822
a77901ef0ebb this should fix jabber buddy icons (but it will re-introduce the behavior of overwriting your vCard whenever you sign in).
Nathan Walp <nwalp@pidgin.im>
parents: 16728
diff changeset
1479
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1480 /* The stream will be reinitialized later, in jabber_recv_cb_ssl() */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1481 js->reinit = TRUE;
16822
a77901ef0ebb this should fix jabber buddy icons (but it will re-introduce the behavior of overwriting your vCard whenever you sign in).
Nathan Walp <nwalp@pidgin.im>
parents: 16728
diff changeset
1482
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1483 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1484 case JABBER_STREAM_CONNECTED:
16822
a77901ef0ebb this should fix jabber buddy icons (but it will re-introduce the behavior of overwriting your vCard whenever you sign in).
Nathan Walp <nwalp@pidgin.im>
parents: 16728
diff changeset
1485 /* now we can alert the core that we're ready to send status */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1486 purple_connection_set_state(js->gc, PURPLE_CONNECTED);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1487 jabber_disco_items_server(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1488 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1489 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1490 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1491
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1492 char *jabber_get_next_id(JabberStream *js)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1493 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1494 return g_strdup_printf("purple%x", js->next_id++);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1495 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1496
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1497
16240
547c76fe2e7a This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@gmail.com>
parents: 16068
diff changeset
1498 void jabber_idle_set(PurpleConnection *gc, int idle)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1499 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1500 JabberStream *js = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1501
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1502 js->idle = idle ? time(NULL) - idle : idle;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1503 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1504
25575
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1505 void jabber_add_feature(const char *namespace, JabberFeatureEnabled cb) {
17576
e49b259fc7dd PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17575
diff changeset
1506 JabberFeature *feat;
20000
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1507
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1508 g_return_if_fail(namespace != NULL);
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1509
17576
e49b259fc7dd PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17575
diff changeset
1510 feat = g_new0(JabberFeature,1);
17572
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1511 feat->namespace = g_strdup(namespace);
17576
e49b259fc7dd PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17575
diff changeset
1512 feat->is_enabled = cb;
17572
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1513
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1514 /* try to remove just in case it already exists in the list */
25575
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1515 jabber_remove_feature(namespace);
17572
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1516
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1517 jabber_features = g_list_append(jabber_features, feat);
17563
95affacf6f82 Added the ability to define extensions to caps
Andreas Monitzer <pidgin@monitzer.com>
parents: 17562
diff changeset
1518 }
95affacf6f82 Added the ability to define extensions to caps
Andreas Monitzer <pidgin@monitzer.com>
parents: 17562
diff changeset
1519
25575
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1520 void jabber_remove_feature(const char *namespace) {
17572
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1521 GList *feature;
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1522 for(feature = jabber_features; feature; feature = feature->next) {
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1523 JabberFeature *feat = (JabberFeature*)feature->data;
25575
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1524 if(!strcmp(feat->namespace, namespace)) {
17572
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1525 g_free(feat->namespace);
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1526 g_free(feature->data);
21538
4e5bef6c3379 Fix #3669
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21418
diff changeset
1527 jabber_features = g_list_delete_link(jabber_features, feature);
17572
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1528 break;
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1529 }
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1530 }
17563
95affacf6f82 Added the ability to define extensions to caps
Andreas Monitzer <pidgin@monitzer.com>
parents: 17562
diff changeset
1531 }
95affacf6f82 Added the ability to define extensions to caps
Andreas Monitzer <pidgin@monitzer.com>
parents: 17562
diff changeset
1532
25763
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1533 static void jabber_features_destroy(void)
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1534 {
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1535 while (jabber_features) {
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1536 JabberFeature *feature = jabber_features->data;
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1537 g_free(feature->namespace);
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1538 g_free(feature);
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1539 jabber_features = g_list_remove_link(jabber_features, jabber_features);
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1540 }
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1541 }
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1542
25760
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
1543 void jabber_add_identity(const gchar *category, const gchar *type, const gchar *lang, const gchar *name) {
25575
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1544 GList *identity;
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1545 JabberIdentity *ident;
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1546 /* both required according to XEP-0030 */
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1547 g_return_if_fail(category != NULL);
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1548 g_return_if_fail(type != NULL);
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1549
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1550 for(identity = jabber_identities; identity; identity = identity->next) {
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1551 JabberIdentity *ident = (JabberIdentity*)identity->data;
25760
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
1552 if (!strcmp(ident->category, category) &&
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
1553 !strcmp(ident->type, type) &&
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
1554 ((!ident->lang && !lang) || (ident->lang && lang && !strcmp(ident->lang, lang)))) {
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
1555 return;
25575
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1556 }
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1557 }
25760
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
1558
25575
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1559 ident = g_new0(JabberIdentity, 1);
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1560 ident->category = g_strdup(category);
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1561 ident->type = g_strdup(type);
25760
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
1562 ident->lang = g_strdup(lang);
25575
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1563 ident->name = g_strdup(name);
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1564 jabber_identities = g_list_append(jabber_identities, ident);
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1565 }
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1566
25763
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1567 static void jabber_identities_destroy(void)
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1568 {
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1569 while (jabber_identities) {
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1570 JabberIdentity *id = jabber_identities->data;
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1571 g_free(id->category);
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1572 g_free(id->type);
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1573 g_free(id->lang);
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1574 g_free(id->name);
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1575 g_free(id);
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1576 jabber_identities = g_list_remove_link(jabber_identities, jabber_identities);
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1577 }
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1578 }
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1579
16240
547c76fe2e7a This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@gmail.com>
parents: 16068
diff changeset
1580 const char *jabber_list_icon(PurpleAccount *a, PurpleBuddy *b)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1581 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1582 return "jabber";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1583 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1584
16240
547c76fe2e7a This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@gmail.com>
parents: 16068
diff changeset
1585 const char* jabber_list_emblem(PurpleBuddy *b)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1586 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1587 JabberStream *js;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1588 JabberBuddy *jb = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1589
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1590 if(!b->account->gc)
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15463
diff changeset
1591 return NULL;
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15463
diff changeset
1592
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1593 js = b->account->gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1594 if(js)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1595 jb = jabber_buddy_find(js, b->name, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1596
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1597 if(!PURPLE_BUDDY_IS_ONLINE(b)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1598 if(jb && (jb->subscription & JABBER_SUB_PENDING ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1599 !(jb->subscription & JABBER_SUB_TO)))
15463
0b6f337a46d5 Emblems in the blist
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
1600 return "not-authorized";
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1601 }
15463
0b6f337a46d5 Emblems in the blist
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
1602 return NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1603 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1604
16240
547c76fe2e7a This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@gmail.com>
parents: 16068
diff changeset
1605 char *jabber_status_text(PurpleBuddy *b)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1606 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1607 char *ret = NULL;
18237
2a5c5d675789 Fix a crash when you have an IM window open on a jabber account and the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18163
diff changeset
1608 JabberBuddy *jb = NULL;
2a5c5d675789 Fix a crash when you have an IM window open on a jabber account and the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18163
diff changeset
1609
2a5c5d675789 Fix a crash when you have an IM window open on a jabber account and the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18163
diff changeset
1610 if (b->account->gc && b->account->gc->proto_data)
2a5c5d675789 Fix a crash when you have an IM window open on a jabber account and the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18163
diff changeset
1611 jb = jabber_buddy_find(b->account->gc->proto_data, b->name, FALSE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1612
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1613 if(jb && !PURPLE_BUDDY_IS_ONLINE(b) && (jb->subscription & JABBER_SUB_PENDING || !(jb->subscription & JABBER_SUB_TO))) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1614 ret = g_strdup(_("Not Authorized"));
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1615 } else if(jb && !PURPLE_BUDDY_IS_ONLINE(b) && jb->error_msg) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1616 ret = g_strdup(jb->error_msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1617 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1618 char *stripped;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1619
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1620 if(!(stripped = purple_markup_strip_html(jabber_buddy_get_status_msg(jb)))) {
20571
c97e3ab9ef11 Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents: 20570
diff changeset
1621 PurplePresence *presence = purple_buddy_get_presence(b);
c97e3ab9ef11 Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents: 20570
diff changeset
1622 if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) {
c97e3ab9ef11 Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents: 20570
diff changeset
1623 PurpleStatus *status = purple_presence_get_status(presence, "tune");
c97e3ab9ef11 Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents: 20570
diff changeset
1624 stripped = g_strdup(purple_status_get_attr_string(status, PURPLE_TUNE_TITLE));
c97e3ab9ef11 Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents: 20570
diff changeset
1625 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1626 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1627
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1628 if(stripped) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1629 ret = g_markup_escape_text(stripped, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1630 g_free(stripped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1631 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1632 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1633
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1634 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1635 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1636
16240
547c76fe2e7a This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@gmail.com>
parents: 16068
diff changeset
1637 void jabber_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1638 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1639 JabberBuddy *jb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1640
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1641 g_return_if_fail(b != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1642 g_return_if_fail(b->account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1643 g_return_if_fail(b->account->gc != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1644 g_return_if_fail(b->account->gc->proto_data != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1645
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1646 jb = jabber_buddy_find(b->account->gc->proto_data, b->name,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1647 FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1648
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1649 if(jb) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1650 JabberBuddyResource *jbr = NULL;
20571
c97e3ab9ef11 Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents: 20570
diff changeset
1651 PurplePresence *presence = purple_buddy_get_presence(b);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1652 const char *sub;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1653 GList *l;
19722
eedf2918aace Don't put "Mood: \(null\) \(null\)" on XMPP buddies
Sean Egan <seanegan@gmail.com>
parents: 19696
diff changeset
1654 const char *mood;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1655
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1656 if (full) {
17573
2f067d8fb19a Fixed a few small mistakes I discovered while testing user mood in Adium.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17572
diff changeset
1657 PurpleStatus *status;
23271
e7b6767f263b The status type says that mood and moodtext are strings, so we don't
Mark Doliner <mark@kingant.net>
parents: 23182
diff changeset
1658
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1659 if(jb->subscription & JABBER_SUB_FROM) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1660 if(jb->subscription & JABBER_SUB_TO)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1661 sub = _("Both");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1662 else if(jb->subscription & JABBER_SUB_PENDING)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1663 sub = _("From (To pending)");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1664 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1665 sub = _("From");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1666 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1667 if(jb->subscription & JABBER_SUB_TO)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1668 sub = _("To");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1669 else if(jb->subscription & JABBER_SUB_PENDING)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1670 sub = _("None (To pending)");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1671 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1672 sub = _("None");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1673 }
23271
e7b6767f263b The status type says that mood and moodtext are strings, so we don't
Mark Doliner <mark@kingant.net>
parents: 23182
diff changeset
1674
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1675 purple_notify_user_info_add_pair(user_info, _("Subscription"), sub);
23271
e7b6767f263b The status type says that mood and moodtext are strings, so we don't
Mark Doliner <mark@kingant.net>
parents: 23182
diff changeset
1676
20571
c97e3ab9ef11 Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents: 20570
diff changeset
1677 status = purple_presence_get_active_status(presence);
23271
e7b6767f263b The status type says that mood and moodtext are strings, so we don't
Mark Doliner <mark@kingant.net>
parents: 23182
diff changeset
1678 mood = purple_status_get_attr_string(status, "mood");
e7b6767f263b The status type says that mood and moodtext are strings, so we don't
Mark Doliner <mark@kingant.net>
parents: 23182
diff changeset
1679 if(mood != NULL) {
e7b6767f263b The status type says that mood and moodtext are strings, so we don't
Mark Doliner <mark@kingant.net>
parents: 23182
diff changeset
1680 const char *moodtext;
e7b6767f263b The status type says that mood and moodtext are strings, so we don't
Mark Doliner <mark@kingant.net>
parents: 23182
diff changeset
1681 moodtext = purple_status_get_attr_string(status, "moodtext");
e7b6767f263b The status type says that mood and moodtext are strings, so we don't
Mark Doliner <mark@kingant.net>
parents: 23182
diff changeset
1682 if(moodtext != NULL) {
e7b6767f263b The status type says that mood and moodtext are strings, so we don't
Mark Doliner <mark@kingant.net>
parents: 23182
diff changeset
1683 char *moodplustext = g_strdup_printf("%s (%s)", mood, moodtext);
e7b6767f263b The status type says that mood and moodtext are strings, so we don't
Mark Doliner <mark@kingant.net>
parents: 23182
diff changeset
1684
17573
2f067d8fb19a Fixed a few small mistakes I discovered while testing user mood in Adium.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17572
diff changeset
1685 purple_notify_user_info_add_pair(user_info, _("Mood"), moodplustext);
2f067d8fb19a Fixed a few small mistakes I discovered while testing user mood in Adium.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17572
diff changeset
1686 g_free(moodplustext);
2f067d8fb19a Fixed a few small mistakes I discovered while testing user mood in Adium.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17572
diff changeset
1687 } else
2f067d8fb19a Fixed a few small mistakes I discovered while testing user mood in Adium.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17572
diff changeset
1688 purple_notify_user_info_add_pair(user_info, _("Mood"), mood);
20571
c97e3ab9ef11 Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents: 20570
diff changeset
1689 }
22000
af0426c34c27 Utility functions to set and format song information. Closes #4398.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21978
diff changeset
1690 if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) {
20571
c97e3ab9ef11 Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents: 20570
diff changeset
1691 PurpleStatus *tune = purple_presence_get_status(presence, "tune");
c97e3ab9ef11 Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents: 20570
diff changeset
1692 const char *title = purple_status_get_attr_string(tune, PURPLE_TUNE_TITLE);
22000
af0426c34c27 Utility functions to set and format song information. Closes #4398.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21978
diff changeset
1693 const char *artist = purple_status_get_attr_string(tune, PURPLE_TUNE_ARTIST);
af0426c34c27 Utility functions to set and format song information. Closes #4398.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21978
diff changeset
1694 const char *album = purple_status_get_attr_string(tune, PURPLE_TUNE_ALBUM);
af0426c34c27 Utility functions to set and format song information. Closes #4398.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21978
diff changeset
1695 char *playing = purple_util_format_song_info(title, artist, album, NULL);
af0426c34c27 Utility functions to set and format song information. Closes #4398.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21978
diff changeset
1696 if (playing) {
af0426c34c27 Utility functions to set and format song information. Closes #4398.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21978
diff changeset
1697 purple_notify_user_info_add_pair(user_info, _("Now Listening"), playing);
af0426c34c27 Utility functions to set and format song information. Closes #4398.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21978
diff changeset
1698 g_free(playing);
af0426c34c27 Utility functions to set and format song information. Closes #4398.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21978
diff changeset
1699 }
20571
c97e3ab9ef11 Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents: 20570
diff changeset
1700 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1701 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1702
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1703 for(l=jb->resources; l; l = l->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1704 char *text = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1705 char *res = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1706 char *label, *value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1707 const char *state;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1708
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1709 jbr = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1710
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1711 if(jbr->status) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1712 char *tmp;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1713 text = purple_strreplace(jbr->status, "\n", "<br />\n");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1714 tmp = purple_markup_strip_html(text);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1715 g_free(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1716 text = g_markup_escape_text(tmp, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1717 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1718 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1719
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1720 if(jbr->name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1721 res = g_strdup_printf(" (%s)", jbr->name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1722
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1723 state = jabber_buddy_state_get_name(jbr->state);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1724 if (text != NULL && !purple_utf8_strcasecmp(state, text)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1725 g_free(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1726 text = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1727 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1728
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1729 label = g_strdup_printf("%s%s",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1730 _("Status"), (res ? res : ""));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1731 value = g_strdup_printf("%s%s%s",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1732 state,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1733 (text ? ": " : ""),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1734 (text ? text : ""));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1735
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1736 purple_notify_user_info_add_pair(user_info, label, value);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1737
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1738 g_free(label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1739 g_free(value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1740 g_free(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1741 g_free(res);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1742 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1743
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1744 if(!PURPLE_BUDDY_IS_ONLINE(b) && jb->error_msg) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1745 purple_notify_user_info_add_pair(user_info, _("Error"), jb->error_msg);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1746 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1747 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1748 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1749
16240
547c76fe2e7a This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@gmail.com>
parents: 16068
diff changeset
1750 GList *jabber_status_types(PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1751 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1752 PurpleStatusType *type;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1753 GList *types = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1754 PurpleValue *priority_value;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1755
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1756 priority_value = purple_value_new(PURPLE_TYPE_INT);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1757 purple_value_set_int(priority_value, 1);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1758 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1759 jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_ONLINE),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1760 NULL, TRUE, TRUE, FALSE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1761 "priority", _("Priority"), priority_value,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1762 "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING),
17572
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1763 "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING),
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1764 "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING),
17596
6842cc73b1b7 Implemented XEP-0172: User Nickname, fixed some potential crashers in the other PEP callbacks.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17593
diff changeset
1765 "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING),
17617
935005186312 Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17616
diff changeset
1766 "buzz", _("Allow Buzz"), purple_value_new(PURPLE_TYPE_BOOLEAN),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1767 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1768 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1769
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1770 priority_value = purple_value_new(PURPLE_TYPE_INT);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1771 purple_value_set_int(priority_value, 1);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1772 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1773 jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_CHAT),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1774 _("Chatty"), TRUE, TRUE, FALSE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1775 "priority", _("Priority"), priority_value,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1776 "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING),
17572
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1777 "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING),
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1778 "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING),
17596
6842cc73b1b7 Implemented XEP-0172: User Nickname, fixed some potential crashers in the other PEP callbacks.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17593
diff changeset
1779 "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING),
17617
935005186312 Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17616
diff changeset
1780 "buzz", _("Allow Buzz"), purple_value_new(PURPLE_TYPE_BOOLEAN),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1781 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1782 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1783
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1784 priority_value = purple_value_new(PURPLE_TYPE_INT);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1785 purple_value_set_int(priority_value, 0);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1786 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1787 jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_AWAY),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1788 NULL, TRUE, TRUE, FALSE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1789 "priority", _("Priority"), priority_value,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1790 "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING),
17572
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1791 "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING),
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1792 "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING),
17596
6842cc73b1b7 Implemented XEP-0172: User Nickname, fixed some potential crashers in the other PEP callbacks.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17593
diff changeset
1793 "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING),
17617
935005186312 Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17616
diff changeset
1794 "buzz", _("Allow Buzz"), purple_value_new(PURPLE_TYPE_BOOLEAN),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1795 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1796 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1797
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1798 priority_value = purple_value_new(PURPLE_TYPE_INT);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1799 purple_value_set_int(priority_value, 0);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1800 type = purple_status_type_new_with_attrs(PURPLE_STATUS_EXTENDED_AWAY,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1801 jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_XA),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1802 NULL, TRUE, TRUE, FALSE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1803 "priority", _("Priority"), priority_value,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1804 "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING),
17572
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1805 "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING),
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1806 "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING),
17596
6842cc73b1b7 Implemented XEP-0172: User Nickname, fixed some potential crashers in the other PEP callbacks.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17593
diff changeset
1807 "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING),
17617
935005186312 Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17616
diff changeset
1808 "buzz", _("Allow Buzz"), purple_value_new(PURPLE_TYPE_BOOLEAN),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1809 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1810 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1811
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1812 priority_value = purple_value_new(PURPLE_TYPE_INT);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1813 purple_value_set_int(priority_value, 0);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1814 type = purple_status_type_new_with_attrs(PURPLE_STATUS_UNAVAILABLE,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1815 jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_DND),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1816 _("Do Not Disturb"), TRUE, TRUE, FALSE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1817 "priority", _("Priority"), priority_value,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1818 "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING),
17572
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1819 "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING),
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1820 "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING),
17596
6842cc73b1b7 Implemented XEP-0172: User Nickname, fixed some potential crashers in the other PEP callbacks.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17593
diff changeset
1821 "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING),
17617
935005186312 Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17616
diff changeset
1822 "buzz", _("Allow Buzz"), purple_value_new(PURPLE_TYPE_BOOLEAN),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1823 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1824 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1825
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1826 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1827 if(js->protocol_version == JABBER_PROTO_0_9)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1828 m = g_list_append(m, _("Invisible"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1829 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1830
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1831 type = purple_status_type_new_with_attrs(PURPLE_STATUS_OFFLINE,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1832 jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_UNAVAILABLE),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1833 NULL, FALSE, TRUE, FALSE,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1834 "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1835 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1836 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1837
20570
5913725cbcd6 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20076
diff changeset
1838 type = purple_status_type_new_with_attrs(PURPLE_STATUS_TUNE,
24409
3a3d36791a47 I don't know why we'd want the TUNE status to be saveable.
Richard Laager <rlaager@wiktel.com>
parents: 24155
diff changeset
1839 "tune", NULL, FALSE, TRUE, TRUE,
20570
5913725cbcd6 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20076
diff changeset
1840 PURPLE_TUNE_ARTIST, _("Tune Artist"), purple_value_new(PURPLE_TYPE_STRING),
5913725cbcd6 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20076
diff changeset
1841 PURPLE_TUNE_TITLE, _("Tune Title"), purple_value_new(PURPLE_TYPE_STRING),
5913725cbcd6 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20076
diff changeset
1842 PURPLE_TUNE_ALBUM, _("Tune Album"), purple_value_new(PURPLE_TYPE_STRING),
5913725cbcd6 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20076
diff changeset
1843 PURPLE_TUNE_GENRE, _("Tune Genre"), purple_value_new(PURPLE_TYPE_STRING),
5913725cbcd6 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20076
diff changeset
1844 PURPLE_TUNE_COMMENT, _("Tune Comment"), purple_value_new(PURPLE_TYPE_STRING),
5913725cbcd6 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20076
diff changeset
1845 PURPLE_TUNE_TRACK, _("Tune Track"), purple_value_new(PURPLE_TYPE_STRING),
5913725cbcd6 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20076
diff changeset
1846 PURPLE_TUNE_TIME, _("Tune Time"), purple_value_new(PURPLE_TYPE_INT),
5913725cbcd6 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20076
diff changeset
1847 PURPLE_TUNE_YEAR, _("Tune Year"), purple_value_new(PURPLE_TYPE_INT),
5913725cbcd6 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20076
diff changeset
1848 PURPLE_TUNE_URL, _("Tune URL"), purple_value_new(PURPLE_TYPE_STRING),
5913725cbcd6 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20076
diff changeset
1849 NULL);
5913725cbcd6 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20076
diff changeset
1850 types = g_list_append(types, type);
5913725cbcd6 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20076
diff changeset
1851
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1852 return types;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1853 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1854
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1855 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1856 jabber_password_change_result_cb(JabberStream *js, xmlnode *packet,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1857 gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1858 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1859 const char *type;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1860
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1861 type = xmlnode_get_attrib(packet, "type");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1862
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1863 if(type && !strcmp(type, "result")) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1864 purple_notify_info(js->gc, _("Password Changed"), _("Password Changed"),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1865 _("Your password has been changed."));
21058
647b841ea945 This patch prevents changing the saved account password for XMPP accounts
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21000
diff changeset
1866
647b841ea945 This patch prevents changing the saved account password for XMPP accounts
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21000
diff changeset
1867 purple_account_set_password(js->gc->account, (char *)data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1868 } else {
20814
bde477ec6a71 Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents: 20792
diff changeset
1869 char *msg = jabber_parse_error(js, packet, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1870
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1871 purple_notify_error(js->gc, _("Error changing password"),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1872 _("Error changing password"), msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1873 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1874 }
21058
647b841ea945 This patch prevents changing the saved account password for XMPP accounts
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21000
diff changeset
1875
647b841ea945 This patch prevents changing the saved account password for XMPP accounts
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21000
diff changeset
1876 g_free(data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1877 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1878
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1879 static void jabber_password_change_cb(JabberStream *js,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1880 PurpleRequestFields *fields)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1881 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1882 const char *p1, *p2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1883 JabberIq *iq;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1884 xmlnode *query, *y;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1885
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1886 p1 = purple_request_fields_get_string(fields, "password1");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1887 p2 = purple_request_fields_get_string(fields, "password2");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1888
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1889 if(strcmp(p1, p2)) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1890 purple_notify_error(js->gc, NULL, _("New passwords do not match."), NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1891 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1892 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1893
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1894 iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1895
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1896 xmlnode_set_attrib(iq->node, "to", js->user->domain);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1897
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1898 query = xmlnode_get_child(iq->node, "query");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1899
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1900 y = xmlnode_new_child(query, "username");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1901 xmlnode_insert_data(y, js->user->node, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1902 y = xmlnode_new_child(query, "password");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1903 xmlnode_insert_data(y, p1, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1904
21058
647b841ea945 This patch prevents changing the saved account password for XMPP accounts
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21000
diff changeset
1905 jabber_iq_set_callback(iq, jabber_password_change_result_cb, g_strdup(p1));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1906
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1907 jabber_iq_send(iq);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1908 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1909
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1910 static void jabber_password_change(PurplePluginAction *action)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1911 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1912
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1913 PurpleConnection *gc = (PurpleConnection *) action->context;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1914 JabberStream *js = gc->proto_data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1915 PurpleRequestFields *fields;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1916 PurpleRequestFieldGroup *group;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1917 PurpleRequestField *field;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1918
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1919 fields = purple_request_fields_new();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1920 group = purple_request_field_group_new(NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1921 purple_request_fields_add_group(fields, group);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1922
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1923 field = purple_request_field_string_new("password1", _("Password"),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1924 "", FALSE);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1925 purple_request_field_string_set_masked(field, TRUE);
18323
e3df2f61d03d Make password fileds in Jabber's Change Password dialog required. Fixes #1907
Sean Egan <seanegan@gmail.com>
parents: 18237
diff changeset
1926 purple_request_field_set_required(field, TRUE);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1927 purple_request_field_group_add_field(group, field);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1928
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1929 field = purple_request_field_string_new("password2", _("Password (again)"),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1930 "", FALSE);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1931 purple_request_field_string_set_masked(field, TRUE);
18323
e3df2f61d03d Make password fileds in Jabber's Change Password dialog required. Fixes #1907
Sean Egan <seanegan@gmail.com>
parents: 18237
diff changeset
1932 purple_request_field_set_required(field, TRUE);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1933 purple_request_field_group_add_field(group, field);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1934
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
1935 purple_request_fields(js->gc, _("Change XMPP Password"),
16915
56042b2f8b64 s/Jabber/XMPP in user-visible places.
Richard Laager <rlaager@wiktel.com>
parents: 16822
diff changeset
1936 _("Change XMPP Password"), _("Please enter your new password"),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1937 fields, _("OK"), G_CALLBACK(jabber_password_change_cb),
16442
08db93bbd798 Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents: 16240
diff changeset
1938 _("Cancel"), NULL,
19999
da29f5c7dc1a Clear the password when we get an auth. error and we're not saving passwords so that you don't need to go into the account settings to reset it. Fix #3083.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19722
diff changeset
1939 purple_connection_get_account(gc), NULL, NULL,
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
1940 js);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1941 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1942
16240
547c76fe2e7a This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@gmail.com>
parents: 16068
diff changeset
1943 GList *jabber_actions(PurplePlugin *plugin, gpointer context)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1944 {
17575
5fc8a8a25008 Implemented a mood menu action (non-functional right now for some reason)
Andreas Monitzer <pidgin@monitzer.com>
parents: 17573
diff changeset
1945 PurpleConnection *gc = (PurpleConnection *) context;
5fc8a8a25008 Implemented a mood menu action (non-functional right now for some reason)
Andreas Monitzer <pidgin@monitzer.com>
parents: 17573
diff changeset
1946 JabberStream *js = gc->proto_data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1947 GList *m = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1948 PurplePluginAction *act;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1949
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1950 act = purple_plugin_action_new(_("Set User Info..."),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1951 jabber_setup_set_info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1952 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1953
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1954 /* if (js->protocol_options & CHANGE_PASSWORD) { */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1955 act = purple_plugin_action_new(_("Change Password..."),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1956 jabber_password_change);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1957 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1958 /* } */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1959
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1960 act = purple_plugin_action_new(_("Search for Users..."),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1961 jabber_user_search_begin);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1962 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1963
17576
e49b259fc7dd PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17575
diff changeset
1964 purple_debug_info("jabber", "jabber_actions: have pep: %s\n", js->pep?"YES":"NO");
e49b259fc7dd PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17575
diff changeset
1965
17575
5fc8a8a25008 Implemented a mood menu action (non-functional right now for some reason)
Andreas Monitzer <pidgin@monitzer.com>
parents: 17573
diff changeset
1966 if(js->pep)
5fc8a8a25008 Implemented a mood menu action (non-functional right now for some reason)
Andreas Monitzer <pidgin@monitzer.com>
parents: 17573
diff changeset
1967 jabber_pep_init_actions(&m);
17610
9a19c46adf66 The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17608
diff changeset
1968
9a19c46adf66 The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17608
diff changeset
1969 if(js->commands)
9a19c46adf66 The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17608
diff changeset
1970 jabber_adhoc_init_server_commands(js, &m);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1971
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1972 return m;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1973 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1974
16240
547c76fe2e7a This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@gmail.com>
parents: 16068
diff changeset
1975 PurpleChat *jabber_find_blist_chat(PurpleAccount *account, const char *name)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1976 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1977 PurpleBlistNode *gnode, *cnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1978 JabberID *jid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1979
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1980 if(!(jid = jabber_id_new(name)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1981 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1982
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1983 for(gnode = purple_get_blist()->root; gnode; gnode = gnode->next) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1984 for(cnode = gnode->child; cnode; cnode = cnode->next) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1985 PurpleChat *chat = (PurpleChat*)cnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1986 const char *room, *server;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1987 if(!PURPLE_BLIST_NODE_IS_CHAT(cnode))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1988 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1989
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1990 if(chat->account != account)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1991 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1992
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1993 if(!(room = g_hash_table_lookup(chat->components, "room")))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1994 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1995 if(!(server = g_hash_table_lookup(chat->components, "server")))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1996 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1997
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1998 if(jid->node && jid->domain &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1999 !g_utf8_collate(room, jid->node) && !g_utf8_collate(server, jid->domain)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2000 jabber_id_free(jid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2001 return chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2002 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2003 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2004 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2005 jabber_id_free(jid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2006 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2007 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2008
16240
547c76fe2e7a This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@gmail.com>
parents: 16068
diff changeset
2009 void jabber_convo_closed(PurpleConnection *gc, const char *who)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2010 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2011 JabberStream *js = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2012 JabberID *jid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2013 JabberBuddy *jb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2014 JabberBuddyResource *jbr;
23988
305fac6af8f9 Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents: 23986
diff changeset
2015
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2016 if(!(jid = jabber_id_new(who)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2017 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2018
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2019 if((jb = jabber_buddy_find(js, who, TRUE)) &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2020 (jbr = jabber_buddy_find_resource(jb, jid->resource))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2021 if(jbr->thread_id) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2022 g_free(jbr->thread_id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2023 jbr->thread_id = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2024 }
15648
193456f03b9c Sending XEP 85 'gone' messages
Sean Egan <seanegan@gmail.com>
parents: 15607
diff changeset
2025 if(jbr->chat_states == JABBER_CHAT_STATES_SUPPORTED)
193456f03b9c Sending XEP 85 'gone' messages
Sean Egan <seanegan@gmail.com>
parents: 15607
diff changeset
2026 jabber_message_conv_closed(js, who);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2027 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2028
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2029 jabber_id_free(jid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2030 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2031
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2032
20814
bde477ec6a71 Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents: 20792
diff changeset
2033 char *jabber_parse_error(JabberStream *js,
bde477ec6a71 Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents: 20792
diff changeset
2034 xmlnode *packet,
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
2035 PurpleConnectionError *reason)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2036 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2037 xmlnode *error;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2038 const char *code = NULL, *text = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2039 const char *xmlns = xmlnode_get_namespace(packet);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2040 char *cdata = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2041
20814
bde477ec6a71 Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents: 20792
diff changeset
2042 #define SET_REASON(x) \
bde477ec6a71 Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents: 20792
diff changeset
2043 if(reason != NULL) { *reason = x; }
bde477ec6a71 Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents: 20792
diff changeset
2044
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2045 if((error = xmlnode_get_child(packet, "error"))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2046 cdata = xmlnode_get_data(error);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2047 code = xmlnode_get_attrib(error, "code");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2048
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2049 /* Stanza errors */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2050 if(xmlnode_get_child(error, "bad-request")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2051 text = _("Bad Request");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2052 } else if(xmlnode_get_child(error, "conflict")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2053 text = _("Conflict");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2054 } else if(xmlnode_get_child(error, "feature-not-implemented")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2055 text = _("Feature Not Implemented");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2056 } else if(xmlnode_get_child(error, "forbidden")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2057 text = _("Forbidden");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2058 } else if(xmlnode_get_child(error, "gone")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2059 text = _("Gone");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2060 } else if(xmlnode_get_child(error, "internal-server-error")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2061 text = _("Internal Server Error");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2062 } else if(xmlnode_get_child(error, "item-not-found")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2063 text = _("Item Not Found");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2064 } else if(xmlnode_get_child(error, "jid-malformed")) {
16915
56042b2f8b64 s/Jabber/XMPP in user-visible places.
Richard Laager <rlaager@wiktel.com>
parents: 16822
diff changeset
2065 text = _("Malformed XMPP ID");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2066 } else if(xmlnode_get_child(error, "not-acceptable")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2067 text = _("Not Acceptable");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2068 } else if(xmlnode_get_child(error, "not-allowed")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2069 text = _("Not Allowed");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2070 } else if(xmlnode_get_child(error, "not-authorized")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2071 text = _("Not Authorized");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2072 } else if(xmlnode_get_child(error, "payment-required")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2073 text = _("Payment Required");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2074 } else if(xmlnode_get_child(error, "recipient-unavailable")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2075 text = _("Recipient Unavailable");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2076 } else if(xmlnode_get_child(error, "redirect")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2077 /* XXX */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2078 } else if(xmlnode_get_child(error, "registration-required")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2079 text = _("Registration Required");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2080 } else if(xmlnode_get_child(error, "remote-server-not-found")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2081 text = _("Remote Server Not Found");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2082 } else if(xmlnode_get_child(error, "remote-server-timeout")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2083 text = _("Remote Server Timeout");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2084 } else if(xmlnode_get_child(error, "resource-constraint")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2085 text = _("Server Overloaded");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2086 } else if(xmlnode_get_child(error, "service-unavailable")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2087 text = _("Service Unavailable");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2088 } else if(xmlnode_get_child(error, "subscription-required")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2089 text = _("Subscription Required");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2090 } else if(xmlnode_get_child(error, "unexpected-request")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2091 text = _("Unexpected Request");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2092 } else if(xmlnode_get_child(error, "undefined-condition")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2093 text = _("Unknown Error");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2094 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2095 } else if(xmlns && !strcmp(xmlns, "urn:ietf:params:xml:ns:xmpp-sasl")) {
20814
bde477ec6a71 Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents: 20792
diff changeset
2096 /* Most common reason can be the default */
21363
b4833db5eed0 Having read the XMPP SASL specification, these errors seem more accurate.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21360
diff changeset
2097 SET_REASON(PURPLE_CONNECTION_ERROR_NETWORK_ERROR);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2098 if(xmlnode_get_child(packet, "aborted")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2099 text = _("Authorization Aborted");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2100 } else if(xmlnode_get_child(packet, "incorrect-encoding")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2101 text = _("Incorrect encoding in authorization");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2102 } else if(xmlnode_get_child(packet, "invalid-authzid")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2103 text = _("Invalid authzid");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2104 } else if(xmlnode_get_child(packet, "invalid-mechanism")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2105 text = _("Invalid Authorization Mechanism");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2106 } else if(xmlnode_get_child(packet, "mechanism-too-weak")) {
21363
b4833db5eed0 Having read the XMPP SASL specification, these errors seem more accurate.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21360
diff changeset
2107 SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2108 text = _("Authorization mechanism too weak");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2109 } else if(xmlnode_get_child(packet, "not-authorized")) {
21363
b4833db5eed0 Having read the XMPP SASL specification, these errors seem more accurate.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21360
diff changeset
2110 SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED);
19999
da29f5c7dc1a Clear the password when we get an auth. error and we're not saving passwords so that you don't need to go into the account settings to reset it. Fix #3083.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19722
diff changeset
2111 /* Clear the pasword if it isn't being saved */
da29f5c7dc1a Clear the password when we get an auth. error and we're not saving passwords so that you don't need to go into the account settings to reset it. Fix #3083.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19722
diff changeset
2112 if (!purple_account_get_remember_password(js->gc->account))
da29f5c7dc1a Clear the password when we get an auth. error and we're not saving passwords so that you don't need to go into the account settings to reset it. Fix #3083.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19722
diff changeset
2113 purple_account_set_password(js->gc->account, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2114 text = _("Not Authorized");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2115 } else if(xmlnode_get_child(packet, "temporary-auth-failure")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2116 text = _("Temporary Authentication Failure");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2117 } else {
21363
b4833db5eed0 Having read the XMPP SASL specification, these errors seem more accurate.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21360
diff changeset
2118 SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2119 text = _("Authentication Failure");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2120 }
15918
4be5d38ee117 Correctly handle the Jabber disconnection error for signing onto the
Mark Doliner <mark@kingant.net>
parents: 15916
diff changeset
2121 } else if(!strcmp(packet->name, "stream:error") ||
20851
4888d00c50f0 Make sure that the xmlns isn't null before dereferencing it to fix CID 320.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20740
diff changeset
2122 (!strcmp(packet->name, "error") && xmlns &&
15919
26593bef6568 Minor code cleanup
Mark Doliner <mark@kingant.net>
parents: 15918
diff changeset
2123 !strcmp(xmlns, "http://etherx.jabber.org/streams"))) {
20814
bde477ec6a71 Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents: 20792
diff changeset
2124 /* Most common reason as default: */
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
2125 SET_REASON(PURPLE_CONNECTION_ERROR_NETWORK_ERROR);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2126 if(xmlnode_get_child(packet, "bad-format")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2127 text = _("Bad Format");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2128 } else if(xmlnode_get_child(packet, "bad-namespace-prefix")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2129 text = _("Bad Namespace Prefix");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2130 } else if(xmlnode_get_child(packet, "conflict")) {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
2131 SET_REASON(PURPLE_CONNECTION_ERROR_NAME_IN_USE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2132 text = _("Resource Conflict");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2133 } else if(xmlnode_get_child(packet, "connection-timeout")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2134 text = _("Connection Timeout");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2135 } else if(xmlnode_get_child(packet, "host-gone")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2136 text = _("Host Gone");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2137 } else if(xmlnode_get_child(packet, "host-unknown")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2138 text = _("Host Unknown");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2139 } else if(xmlnode_get_child(packet, "improper-addressing")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2140 text = _("Improper Addressing");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2141 } else if(xmlnode_get_child(packet, "internal-server-error")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2142 text = _("Internal Server Error");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2143 } else if(xmlnode_get_child(packet, "invalid-id")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2144 text = _("Invalid ID");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2145 } else if(xmlnode_get_child(packet, "invalid-namespace")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2146 text = _("Invalid Namespace");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2147 } else if(xmlnode_get_child(packet, "invalid-xml")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2148 text = _("Invalid XML");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2149 } else if(xmlnode_get_child(packet, "nonmatching-hosts")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2150 text = _("Non-matching Hosts");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2151 } else if(xmlnode_get_child(packet, "not-authorized")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2152 text = _("Not Authorized");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2153 } else if(xmlnode_get_child(packet, "policy-violation")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2154 text = _("Policy Violation");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2155 } else if(xmlnode_get_child(packet, "remote-connection-failed")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2156 text = _("Remote Connection Failed");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2157 } else if(xmlnode_get_child(packet, "resource-constraint")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2158 text = _("Resource Constraint");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2159 } else if(xmlnode_get_child(packet, "restricted-xml")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2160 text = _("Restricted XML");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2161 } else if(xmlnode_get_child(packet, "see-other-host")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2162 text = _("See Other Host");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2163 } else if(xmlnode_get_child(packet, "system-shutdown")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2164 text = _("System Shutdown");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2165 } else if(xmlnode_get_child(packet, "undefined-condition")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2166 text = _("Undefined Condition");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2167 } else if(xmlnode_get_child(packet, "unsupported-encoding")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2168 text = _("Unsupported Encoding");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2169 } else if(xmlnode_get_child(packet, "unsupported-stanza-type")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2170 text = _("Unsupported Stanza Type");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2171 } else if(xmlnode_get_child(packet, "unsupported-version")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2172 text = _("Unsupported Version");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2173 } else if(xmlnode_get_child(packet, "xml-not-well-formed")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2174 text = _("XML Not Well Formed");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2175 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2176 text = _("Stream Error");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2177 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2178 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2179
20814
bde477ec6a71 Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents: 20792
diff changeset
2180 #undef SET_REASON
bde477ec6a71 Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents: 20792
diff changeset
2181
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2182 if(text || cdata) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2183 char *ret = g_strdup_printf("%s%s%s", code ? code : "",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2184 code ? ": " : "", text ? text : cdata);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2185 g_free(cdata);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2186 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2187 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2188 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2189 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2190 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2191
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2192 static PurpleCmdRet jabber_cmd_chat_config(PurpleConversation *conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2193 const char *cmd, char **args, char **error, void *data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2194 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2195 JabberChat *chat = jabber_chat_find_by_conv(conv);
18711
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2196
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2197 if (!chat)
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2198 return PURPLE_CMD_RET_FAILED;
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2199
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2200 jabber_chat_request_room_configure(chat);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2201 return PURPLE_CMD_RET_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2202 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2203
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2204 static PurpleCmdRet jabber_cmd_chat_register(PurpleConversation *conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2205 const char *cmd, char **args, char **error, void *data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2206 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2207 JabberChat *chat = jabber_chat_find_by_conv(conv);
18711
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2208
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2209 if (!chat)
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2210 return PURPLE_CMD_RET_FAILED;
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2211
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2212 jabber_chat_register(chat);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2213 return PURPLE_CMD_RET_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2214 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2215
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2216 static PurpleCmdRet jabber_cmd_chat_topic(PurpleConversation *conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2217 const char *cmd, char **args, char **error, void *data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2218 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2219 JabberChat *chat = jabber_chat_find_by_conv(conv);
18711
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2220
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2221 if (!chat)
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2222 return PURPLE_CMD_RET_FAILED;
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2223
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2224 jabber_chat_change_topic(chat, args ? args[0] : NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2225 return PURPLE_CMD_RET_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2226 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2227
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2228 static PurpleCmdRet jabber_cmd_chat_nick(PurpleConversation *conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2229 const char *cmd, char **args, char **error, void *data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2230 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2231 JabberChat *chat = jabber_chat_find_by_conv(conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2232
18711
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2233 if(!chat || !args || !args[0])
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2234 return PURPLE_CMD_RET_FAILED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2235
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2236 jabber_chat_change_nick(chat, args[0]);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2237 return PURPLE_CMD_RET_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2238 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2239
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2240 static PurpleCmdRet jabber_cmd_chat_part(PurpleConversation *conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2241 const char *cmd, char **args, char **error, void *data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2242 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2243 JabberChat *chat = jabber_chat_find_by_conv(conv);
18711
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2244
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2245 if (!chat)
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2246 return PURPLE_CMD_RET_FAILED;
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2247
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2248 jabber_chat_part(chat, args ? args[0] : NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2249 return PURPLE_CMD_RET_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2250 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2251
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2252 static PurpleCmdRet jabber_cmd_chat_ban(PurpleConversation *conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2253 const char *cmd, char **args, char **error, void *data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2254 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2255 JabberChat *chat = jabber_chat_find_by_conv(conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2256
18711
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2257 if(!chat || !args || !args[0])
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2258 return PURPLE_CMD_RET_FAILED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2259
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2260 if(!jabber_chat_ban_user(chat, args[0], args[1])) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2261 *error = g_strdup_printf(_("Unable to ban user %s"), args[0]);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2262 return PURPLE_CMD_RET_FAILED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2263 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2264
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2265 return PURPLE_CMD_RET_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2266 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2267
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2268 static PurpleCmdRet jabber_cmd_chat_affiliate(PurpleConversation *conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2269 const char *cmd, char **args, char **error, void *data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2270 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2271 JabberChat *chat = jabber_chat_find_by_conv(conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2272
18711
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2273 if (!chat || !args || !args[0] || !args[1])
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2274 return PURPLE_CMD_RET_FAILED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2275
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2276 if (strcmp(args[1], "owner") != 0 &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2277 strcmp(args[1], "admin") != 0 &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2278 strcmp(args[1], "member") != 0 &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2279 strcmp(args[1], "outcast") != 0 &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2280 strcmp(args[1], "none") != 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2281 *error = g_strdup_printf(_("Unknown affiliation: \"%s\""), args[1]);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2282 return PURPLE_CMD_RET_FAILED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2283 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2284
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2285 if (!jabber_chat_affiliate_user(chat, args[0], args[1])) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2286 *error = g_strdup_printf(_("Unable to affiliate user %s as \"%s\""), args[0], args[1]);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2287 return PURPLE_CMD_RET_FAILED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2288 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2289
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2290 return PURPLE_CMD_RET_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2291 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2292
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2293 static PurpleCmdRet jabber_cmd_chat_role(PurpleConversation *conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2294 const char *cmd, char **args, char **error, void *data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2295 {
18855
28a7c9dbbc2b Fix uninitialized variable access.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18711
diff changeset
2296 JabberChat *chat = jabber_chat_find_by_conv(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2297
18711
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2298 if (!chat || !args || !args[0] || !args[1])
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2299 return PURPLE_CMD_RET_FAILED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2300
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2301 if (strcmp(args[1], "moderator") != 0 &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2302 strcmp(args[1], "participant") != 0 &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2303 strcmp(args[1], "visitor") != 0 &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2304 strcmp(args[1], "none") != 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2305 *error = g_strdup_printf(_("Unknown role: \"%s\""), args[1]);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2306 return PURPLE_CMD_RET_FAILED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2307 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2308
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2309 if (!jabber_chat_role_user(chat, args[0], args[1])) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2310 *error = g_strdup_printf(_("Unable to set role \"%s\" for user: %s"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2311 args[1], args[0]);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2312 return PURPLE_CMD_RET_FAILED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2313 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2314
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2315 return PURPLE_CMD_RET_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2316 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2317
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2318 static PurpleCmdRet jabber_cmd_chat_invite(PurpleConversation *conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2319 const char *cmd, char **args, char **error, void *data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2320 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2321 if(!args || !args[0])
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2322 return PURPLE_CMD_RET_FAILED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2323
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2324 jabber_chat_invite(purple_conversation_get_gc(conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2325 purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), args[1] ? args[1] : "",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2326 args[0]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2327
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2328 return PURPLE_CMD_RET_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2329 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2330
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2331 static PurpleCmdRet jabber_cmd_chat_join(PurpleConversation *conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2332 const char *cmd, char **args, char **error, void *data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2333 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2334 JabberChat *chat = jabber_chat_find_by_conv(conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2335 GHashTable *components;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2336
18711
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2337 if(!chat || !args || !args[0])
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2338 return PURPLE_CMD_RET_FAILED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2339
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2340 components = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2341
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2342 g_hash_table_replace(components, "room", args[0]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2343 g_hash_table_replace(components, "server", chat->server);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2344 g_hash_table_replace(components, "handle", chat->handle);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2345 if(args[1])
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2346 g_hash_table_replace(components, "password", args[1]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2347
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2348 jabber_chat_join(purple_conversation_get_gc(conv), components);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2349
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2350 g_hash_table_destroy(components);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2351 return PURPLE_CMD_RET_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2352 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2353
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2354 static PurpleCmdRet jabber_cmd_chat_kick(PurpleConversation *conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2355 const char *cmd, char **args, char **error, void *data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2356 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2357 JabberChat *chat = jabber_chat_find_by_conv(conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2358
18711
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2359 if(!chat || !args || !args[0])
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2360 return PURPLE_CMD_RET_FAILED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2361
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2362 if(!jabber_chat_kick_user(chat, args[0], args[1])) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2363 *error = g_strdup_printf(_("Unable to kick user %s"), args[0]);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2364 return PURPLE_CMD_RET_FAILED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2365 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2366
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2367 return PURPLE_CMD_RET_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2368 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2369
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2370 static PurpleCmdRet jabber_cmd_chat_msg(PurpleConversation *conv,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2371 const char *cmd, char **args, char **error, void *data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2372 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2373 JabberChat *chat = jabber_chat_find_by_conv(conv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2374 char *who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2375
18711
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2376 if (!chat)
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2377 return PURPLE_CMD_RET_FAILED;
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2378
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2379 who = g_strdup_printf("%s@%s/%s", chat->room, chat->server, args[0]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2380
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2381 jabber_message_send_im(purple_conversation_get_gc(conv), who, args[1], 0);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2382
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2383 g_free(who);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2384 return PURPLE_CMD_RET_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2385 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2386
17562
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
2387 static PurpleCmdRet jabber_cmd_ping(PurpleConversation *conv,
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
2388 const char *cmd, char **args, char **error, void *data)
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
2389 {
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
2390 if(!args || !args[0])
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
2391 return PURPLE_CMD_RET_FAILED;
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
2392
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
2393 if(!jabber_ping_jid(conv, args[0])) {
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
2394 *error = g_strdup_printf(_("Unable to ping user %s"), args[0]);
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
2395 return PURPLE_CMD_RET_FAILED;
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
2396 }
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
2397
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
2398 return PURPLE_CMD_RET_OK;
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
2399 }
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
2400
20852
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2401 static gboolean _jabber_send_buzz(JabberStream *js, const char *username, char **error) {
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2402
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2403 JabberBuddy *jb;
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2404 JabberBuddyResource *jbr;
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2405
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2406 if(!username)
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2407 return FALSE;
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2408
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2409 jb = jabber_buddy_find(js, username, FALSE);
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2410 if(!jb) {
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2411 *error = g_strdup_printf(_("Unable to buzz, because there is nothing known about user %s."), username);
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2412 return FALSE;
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2413 }
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2414
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2415 jbr = jabber_buddy_find_resource(jb, NULL);
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2416 if(!jbr) {
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2417 *error = g_strdup_printf(_("Unable to buzz, because user %s might be offline."), username);
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2418 return FALSE;
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2419 }
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2420
25770
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2421 /* Is this message sufficiently useful to not just fold it in with the tail error condition below? */
20852
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2422 if(!jbr->caps) {
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2423 *error = g_strdup_printf(_("Unable to buzz, because there is nothing known about user %s."), username);
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2424 return FALSE;
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2425 }
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2426
25770
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2427 if (jabber_resource_has_capability(jbr, "http://www.xmpp.org/extensions/xep-0224.html#ns")) {
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2428 xmlnode *buzz, *msg = xmlnode_new("message");
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2429 gchar *to;
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2430
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2431 to = g_strdup_printf("%s/%s", username, jbr->name);
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2432 xmlnode_set_attrib(msg, "to", to);
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2433 g_free(to);
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2434
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2435 /* avoid offline storage */
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2436 xmlnode_set_attrib(msg, "type", "headline");
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2437
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2438 buzz = xmlnode_new_child(msg, "attention");
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2439 xmlnode_set_namespace(buzz, "http://www.xmpp.org/extensions/xep-0224.html#ns");
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2440
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2441 jabber_send(js, msg);
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2442 xmlnode_free(msg);
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2443
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2444 return TRUE;
20852
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2445 }
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2446
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2447 *error = g_strdup_printf(_("Unable to buzz, because the user %s does not support it."), username);
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2448 return FALSE;
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2449 }
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2450
17615
cca457b9158b disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents: 17614
diff changeset
2451 static PurpleCmdRet jabber_cmd_buzz(PurpleConversation *conv,
cca457b9158b disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents: 17614
diff changeset
2452 const char *cmd, char **args, char **error, void *data)
cca457b9158b disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents: 17614
diff changeset
2453 {
cca457b9158b disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents: 17614
diff changeset
2454 JabberStream *js = conv->account->gc->proto_data;
cca457b9158b disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents: 17614
diff changeset
2455
cca457b9158b disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents: 17614
diff changeset
2456 if(!args || !args[0])
cca457b9158b disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents: 17614
diff changeset
2457 return PURPLE_CMD_RET_FAILED;
20852
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2458
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2459 return _jabber_send_buzz(js, args[0], error) ? PURPLE_CMD_RET_OK : PURPLE_CMD_RET_FAILED;
17615
cca457b9158b disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents: 17614
diff changeset
2460 }
cca457b9158b disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents: 17614
diff changeset
2461
20149
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2462 GList *jabber_attention_types(PurpleAccount *account)
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2463 {
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2464 static GList *types = NULL;
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2465
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2466 if (!types) {
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22034
diff changeset
2467 types = g_list_append(types, purple_attention_type_new("Buzz", _("Buzz"),
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22034
diff changeset
2468 _("%s has buzzed you!"), _("Buzzing %s...")));
20149
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2469 }
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2470
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2471 return types;
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2472 }
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2473
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2474 gboolean jabber_send_attention(PurpleConnection *gc, const char *username, guint code)
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2475 {
20852
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2476 JabberStream *js = gc->proto_data;
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2477 gchar *error = NULL;
20149
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2478
20852
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2479 if (!_jabber_send_buzz(js, username, &error)) {
20149
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2480 purple_debug_error("jabber", "jabber_send_attention: jabber_cmd_buzz failed with error: %s\n", error ? error : "(NULL)");
20852
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2481 g_free(error);
20149
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2482 return FALSE;
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2483 }
20852
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2484
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2485 return TRUE;
20149
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2486 }
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2487
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2488
16240
547c76fe2e7a This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@gmail.com>
parents: 16068
diff changeset
2489 gboolean jabber_offline_message(const PurpleBuddy *buddy)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2490 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2491 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2492 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2493
16240
547c76fe2e7a This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@gmail.com>
parents: 16068
diff changeset
2494 void jabber_register_commands(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2495 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2496 purple_cmd_register("config", "", PURPLE_CMD_P_PRPL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2497 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2498 "prpl-jabber", jabber_cmd_chat_config,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2499 _("config: Configure a chat room."), NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2500 purple_cmd_register("configure", "", PURPLE_CMD_P_PRPL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2501 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2502 "prpl-jabber", jabber_cmd_chat_config,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2503 _("configure: Configure a chat room."), NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2504 purple_cmd_register("nick", "s", PURPLE_CMD_P_PRPL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2505 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2506 "prpl-jabber", jabber_cmd_chat_nick,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2507 _("nick &lt;new nickname&gt;: Change your nickname."),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2508 NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2509 purple_cmd_register("part", "s", PURPLE_CMD_P_PRPL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2510 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2511 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2512 jabber_cmd_chat_part, _("part [room]: Leave the room."),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2513 NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2514 purple_cmd_register("register", "", PURPLE_CMD_P_PRPL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2515 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2516 "prpl-jabber", jabber_cmd_chat_register,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2517 _("register: Register with a chat room."), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2518 /* XXX: there needs to be a core /topic cmd, methinks */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2519 purple_cmd_register("topic", "s", PURPLE_CMD_P_PRPL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2520 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2521 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2522 jabber_cmd_chat_topic,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2523 _("topic [new topic]: View or change the topic."),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2524 NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2525 purple_cmd_register("ban", "ws", PURPLE_CMD_P_PRPL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2526 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2527 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2528 jabber_cmd_chat_ban,
22602
9a84976c8e76 Correct some help strings for Jabber slash commands
Mark Doliner <mark@kingant.net>
parents: 22448
diff changeset
2529 _("ban &lt;user&gt; [reason]: Ban a user from the room."),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2530 NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2531 purple_cmd_register("affiliate", "ws", PURPLE_CMD_P_PRPL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2532 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2533 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2534 jabber_cmd_chat_affiliate,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2535 _("affiliate &lt;user&gt; &lt;owner|admin|member|outcast|none&gt;: Set a user's affiliation with the room."),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2536 NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2537 purple_cmd_register("role", "ws", PURPLE_CMD_P_PRPL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2538 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2539 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2540 jabber_cmd_chat_role,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2541 _("role &lt;user&gt; &lt;moderator|participant|visitor|none&gt;: Set a user's role in the room."),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2542 NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2543 purple_cmd_register("invite", "ws", PURPLE_CMD_P_PRPL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2544 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2545 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2546 jabber_cmd_chat_invite,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2547 _("invite &lt;user&gt; [message]: Invite a user to the room."),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2548 NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2549 purple_cmd_register("join", "ws", PURPLE_CMD_P_PRPL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2550 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2551 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2552 jabber_cmd_chat_join,
22602
9a84976c8e76 Correct some help strings for Jabber slash commands
Mark Doliner <mark@kingant.net>
parents: 22448
diff changeset
2553 _("join: &lt;room&gt; [password]: Join a chat on this server."),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2554 NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2555 purple_cmd_register("kick", "ws", PURPLE_CMD_P_PRPL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2556 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2557 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2558 jabber_cmd_chat_kick,
22602
9a84976c8e76 Correct some help strings for Jabber slash commands
Mark Doliner <mark@kingant.net>
parents: 22448
diff changeset
2559 _("kick &lt;user&gt; [reason]: Kick a user from the room."),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2560 NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2561 purple_cmd_register("msg", "ws", PURPLE_CMD_P_PRPL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2562 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2563 "prpl-jabber", jabber_cmd_chat_msg,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2564 _("msg &lt;user&gt; &lt;message&gt;: Send a private message to another user."),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2565 NULL);
17562
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
2566 purple_cmd_register("ping", "w", PURPLE_CMD_P_PRPL,
17572
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
2567 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM |
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
2568 PURPLE_CMD_FLAG_PRPL_ONLY,
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
2569 "prpl-jabber", jabber_cmd_ping,
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
2570 _("ping &lt;jid&gt;: Ping a user/component/server."),
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
2571 NULL);
17615
cca457b9158b disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents: 17614
diff changeset
2572 purple_cmd_register("buzz", "s", PURPLE_CMD_P_PRPL,
cca457b9158b disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents: 17614
diff changeset
2573 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY,
cca457b9158b disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents: 17614
diff changeset
2574 "prpl-jabber", jabber_cmd_buzz,
cca457b9158b disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents: 17614
diff changeset
2575 _("buzz: Buzz a user to get their attention"), NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2576 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2577
25760
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2578 /* IPC functions */
25587
2bf9bf49cea8 * adding documentation for IPC function contact_has_feature
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25586
diff changeset
2579
25760
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2580 /**
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2581 * IPC function for determining if a contact supports a certain feature.
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2582 *
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2583 * @param account The PurpleAccount
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2584 * @param jid The full JID of the contact.
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2585 * @param feature The feature's namespace.
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2586 *
25587
2bf9bf49cea8 * adding documentation for IPC function contact_has_feature
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25586
diff changeset
2587 * @return TRUE if supports feature; else FALSE.
2bf9bf49cea8 * adding documentation for IPC function contact_has_feature
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25586
diff changeset
2588 */
25586
e6f92c0f9770 * adding IPC function 'contact_has_feature'
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25585
diff changeset
2589 static gboolean
25760
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2590 jabber_ipc_contact_has_feature(PurpleAccount *account, const gchar *jid,
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2591 const gchar *feature)
25586
e6f92c0f9770 * adding IPC function 'contact_has_feature'
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25585
diff changeset
2592 {
25760
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2593 PurpleConnection *gc = purple_account_get_connection(account);
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2594 JabberStream *js;
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2595 JabberBuddy *jb;
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2596 JabberBuddyResource *jbr;
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2597 gchar *resource;
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2598
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2599 if (!purple_account_is_connected(account))
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2600 return FALSE;
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2601 js = gc->proto_data;
25747
504c98a90ef5 constify, ifdef out an old-caps remnant, and rewrite a little
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
2602
25760
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2603 if (!(resource = jabber_get_resource(jid)) ||
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2604 !(jb = jabber_buddy_find(js, jid, FALSE)) ||
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2605 !(jbr = jabber_buddy_find_resource(jb, resource))) {
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2606 g_free(resource);
25747
504c98a90ef5 constify, ifdef out an old-caps remnant, and rewrite a little
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
2607 return FALSE;
25760
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2608 }
25747
504c98a90ef5 constify, ifdef out an old-caps remnant, and rewrite a little
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
2609
25760
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2610 g_free(resource);
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2611
25770
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2612 return jabber_resource_has_capability(jbr, feature);
25585
45816181b7de * fixing a bug in jabber_caps_compare()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25575
diff changeset
2613 }
45816181b7de * fixing a bug in jabber_caps_compare()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25575
diff changeset
2614
25588
61f37abc8a70 * removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25587
diff changeset
2615 static void
25747
504c98a90ef5 constify, ifdef out an old-caps remnant, and rewrite a little
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
2616 jabber_ipc_add_feature(const gchar *feature)
25588
61f37abc8a70 * removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25587
diff changeset
2617 {
25747
504c98a90ef5 constify, ifdef out an old-caps remnant, and rewrite a little
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
2618 if (!feature)
504c98a90ef5 constify, ifdef out an old-caps remnant, and rewrite a little
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
2619 return;
25589
3f719eaa7fd1 * IPC work
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25588
diff changeset
2620 jabber_add_feature(feature, 0);
25747
504c98a90ef5 constify, ifdef out an old-caps remnant, and rewrite a little
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
2621
504c98a90ef5 constify, ifdef out an old-caps remnant, and rewrite a little
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
2622 /* send presence with new caps info for all connected accounts */
25590
7f6558c7a0a3 * implemented jabber_caps_broadcast_change() and finished jabber_ipc_add_feature() IPC function
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25589
diff changeset
2623 jabber_caps_broadcast_change();
25588
61f37abc8a70 * removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25587
diff changeset
2624 }
61f37abc8a70 * removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25587
diff changeset
2625
16240
547c76fe2e7a This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@gmail.com>
parents: 16068
diff changeset
2626 void
547c76fe2e7a This does the ol' AIM/ICQ split trick on Jabber, creating an XMPP prpl. This can be used, later, to create a Bonjour plugin that reuses libjabber
Sean Egan <seanegan@gmail.com>
parents: 16068
diff changeset
2627 jabber_init_plugin(PurplePlugin *plugin)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2628 {
25575
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
2629 my_protocol = plugin;
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
2630
25760
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2631 jabber_add_identity("client", "pc", NULL, PACKAGE);
25575
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
2632
25586
e6f92c0f9770 * adding IPC function 'contact_has_feature'
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25585
diff changeset
2633 /* initialize jabber_features list */
25575
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
2634 jabber_add_feature("jabber:iq:last", 0);
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
2635 jabber_add_feature("jabber:iq:oob", 0);
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
2636 jabber_add_feature("jabber:iq:time", 0);
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
2637 jabber_add_feature("xmpp:urn:time", 0);
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
2638 jabber_add_feature("jabber:iq:version", 0);
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
2639 jabber_add_feature("jabber:x:conference", 0);
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
2640 jabber_add_feature("http://jabber.org/protocol/bytestreams", 0);
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
2641 jabber_add_feature("http://jabber.org/protocol/disco#info", 0);
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
2642 jabber_add_feature("http://jabber.org/protocol/disco#items", 0);
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
2643 #if 0
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
2644 jabber_add_feature("http://jabber.org/protocol/ibb", 0);
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
2645 #endif
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
2646 jabber_add_feature("http://jabber.org/protocol/muc", 0);
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
2647 jabber_add_feature("http://jabber.org/protocol/muc#user", 0);
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
2648 jabber_add_feature("http://jabber.org/protocol/si", 0);
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
2649 jabber_add_feature("http://jabber.org/protocol/si/profile/file-transfer", 0);
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
2650 jabber_add_feature("http://jabber.org/protocol/xhtml-im", 0);
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
2651 jabber_add_feature("urn:xmpp:ping", 0);
25585
45816181b7de * fixing a bug in jabber_caps_compare()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25575
diff changeset
2652
25586
e6f92c0f9770 * adding IPC function 'contact_has_feature'
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25585
diff changeset
2653 /* IPC functions */
e6f92c0f9770 * adding IPC function 'contact_has_feature'
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25585
diff changeset
2654 purple_plugin_ipc_register(plugin, "contact_has_feature", PURPLE_CALLBACK(jabber_ipc_contact_has_feature),
25760
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2655 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER,
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2656 purple_value_new(PURPLE_TYPE_BOOLEAN), 3,
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2657 purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_ACCOUNT),
25586
e6f92c0f9770 * adding IPC function 'contact_has_feature'
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25585
diff changeset
2658 purple_value_new(PURPLE_TYPE_STRING),
e6f92c0f9770 * adding IPC function 'contact_has_feature'
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25585
diff changeset
2659 purple_value_new(PURPLE_TYPE_STRING));
25589
3f719eaa7fd1 * IPC work
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25588
diff changeset
2660 purple_plugin_ipc_register(plugin, "add_feature", PURPLE_CALLBACK(jabber_ipc_add_feature),
3f719eaa7fd1 * IPC work
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25588
diff changeset
2661 purple_marshal_VOID__POINTER,
3f719eaa7fd1 * IPC work
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25588
diff changeset
2662 NULL, 1,
3f719eaa7fd1 * IPC work
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25588
diff changeset
2663 purple_value_new(PURPLE_TYPE_STRING));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2664 }
25763
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
2665
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
2666 void
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
2667 jabber_uninit_plugin(void)
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
2668 {
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
2669 jabber_features_destroy();
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
2670 jabber_identities_destroy();
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
2671 }