annotate libpurple/protocols/jabber/jabber.c @ 25989:035ba9355361

IBB is now in im.pidgin.pidgin
author Paul Aurich <paul@darkrain42.org>
date Sat, 07 Mar 2009 02:23:14 +0000
parents c4fd9222dda1
children 6d7d360687bd
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"
24820
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
34 #include "privacy.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 #include "proxy.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 #include "prpl.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 #include "request.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 #include "server.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 #include "util.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40 #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
41 #include "xmlnode.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42
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"
25987
c4fd9222dda1 propagate from branch 'im.pidgin.pidgin' (head 303af74a38e7b313d4fb0be4d4054a16cb13d819)
Paul Aurich <paul@darkrain42.org>
parents: 25443 25835
diff changeset
45 #include "caps.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46 #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
47 #include "data.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 #include "disco.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49 #include "google.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 #include "iq.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 #include "jutil.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 #include "message.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 #include "parser.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54 #include "presence.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55 #include "jabber.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56 #include "roster.h"
17562
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
57 #include "ping.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 #include "si.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 #include "xdata.h"
17561
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents: 17560
diff changeset
60 #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
61 #include "adhoccommands.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
62
23445
4ac5db6e39f3 Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents: 23182
diff changeset
63
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
64 #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
65
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
66 static PurplePlugin *my_protocol = NULL;
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")) {
25826
af2b883df9a3 Wait until receiving the roster to tell the core we're logged in
Paul Aurich <paul@darkrain42.org>
parents: 25825
diff changeset
94 jabber_disco_items_server(js);
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) {
25097
43055addf135 Grab only the "short" hostname on systems (like Fedora/RedHat, but others too)
mcepl@redhat.com
parents: 25066
diff changeset
153 char hostname[256], /* current hostname */
43055addf135 Grab only the "short" hostname on systems (like Fedora/RedHat, but others too)
mcepl@redhat.com
parents: 25066
diff changeset
154 *dot = NULL;
24500
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
155
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
156 /* Empty resource == don't send any */
24834
41e69c65b006 Slightly modified version of a fix fqueze proposed for a crash with the empty
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24820
diff changeset
157 if (input == NULL || *input == '\0')
24500
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
158 return NULL;
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
159
24514
6b9552b09de0 Avoid needlessly calling gethostname() if __HOSTNAME__ doesn't appear in the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24508
diff changeset
160 if (strstr(input, "__HOSTNAME__") == NULL)
24531
fb5a11ec8be6 darkrain again
Ka-Hing Cheung <khc@hxbc.us>
parents: 24514
diff changeset
161 return g_strdup(input);
24514
6b9552b09de0 Avoid needlessly calling gethostname() if __HOSTNAME__ doesn't appear in the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24508
diff changeset
162
24500
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
163 /* Replace __HOSTNAME__ with hostname */
24505
9bb624e345aa me likes this better, References #5565
Ka-Hing Cheung <khc@hxbc.us>
parents: 24501
diff changeset
164 if (gethostname(hostname, sizeof(hostname) - 1)) {
9bb624e345aa me likes this better, References #5565
Ka-Hing Cheung <khc@hxbc.us>
parents: 24501
diff changeset
165 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
166 /* 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
167 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
168 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
169 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
170 instead
9bb624e345aa me likes this better, References #5565
Ka-Hing Cheung <khc@hxbc.us>
parents: 24501
diff changeset
171 */
24500
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
172 strcpy(hostname, "localhost");
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
173 }
24505
9bb624e345aa me likes this better, References #5565
Ka-Hing Cheung <khc@hxbc.us>
parents: 24501
diff changeset
174 hostname[sizeof(hostname) - 1] = '\0';
24500
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
175
25097
43055addf135 Grab only the "short" hostname on systems (like Fedora/RedHat, but others too)
mcepl@redhat.com
parents: 25066
diff changeset
176 /* We want only the short hostname, not the FQDN - this will prevent the
43055addf135 Grab only the "short" hostname on systems (like Fedora/RedHat, but others too)
mcepl@redhat.com
parents: 25066
diff changeset
177 * resource string from being unreasonably long on systems which stuff the
43055addf135 Grab only the "short" hostname on systems (like Fedora/RedHat, but others too)
mcepl@redhat.com
parents: 25066
diff changeset
178 * whole FQDN in the hostname */
43055addf135 Grab only the "short" hostname on systems (like Fedora/RedHat, but others too)
mcepl@redhat.com
parents: 25066
diff changeset
179 if((dot = strchr(hostname, '.')))
43055addf135 Grab only the "short" hostname on systems (like Fedora/RedHat, but others too)
mcepl@redhat.com
parents: 25066
diff changeset
180 dot = '\0';
43055addf135 Grab only the "short" hostname on systems (like Fedora/RedHat, but others too)
mcepl@redhat.com
parents: 25066
diff changeset
181
24500
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
182 return purple_strreplace(input, "__HOSTNAME__", hostname);
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
183 }
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
184
25607
f775f6021654 * using libpurple's internal SASL mechanisms during BOSH authentication phase
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25602
diff changeset
185 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
186 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187 if(xmlnode_get_child(packet, "starttls")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188 if(jabber_process_starttls(js, packet))
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
189
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
190 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
191 } 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
192 purple_connection_error_reason (js->gc,
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
193 PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR,
20117
f24a2cacacd1 Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents: 20076
diff changeset
194 _("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
195 return;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
198 if(js->registration) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199 jabber_register_start(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
200 } else if(xmlnode_get_child(packet, "mechanisms")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201 jabber_auth_start(js, packet);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202 } else if(xmlnode_get_child(packet, "bind")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
203 xmlnode *bind, *resource;
24500
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
204 char *requested_resource;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205 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
206 bind = xmlnode_new_child(iq->node, "bind");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
207 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
208 requested_resource = jabber_prep_resource(js->user->resource);
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
209
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
210 if (requested_resource != NULL) {
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
211 resource = xmlnode_new_child(bind, "resource");
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
212 xmlnode_insert_data(resource, requested_resource, -1);
24614
641fe4c2b2a5 Use g_free instead of free.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24531
diff changeset
213 g_free(requested_resource);
24500
7ec139c84d36 Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents: 24409
diff changeset
214 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216 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
217
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218 jabber_iq_send(iq);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 } 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
220 /* 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
221 * 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
222 * 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
223 * connecting to an XMPP server. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224 js->auth_type = JABBER_AUTH_IQ_AUTH;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225 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
226 }
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 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
230 {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
231 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
232 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
233
20814
bde477ec6a71 Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents: 20792
diff changeset
234 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
235
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239 static void tls_init(JabberStream *js);
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 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
242 {
15919
26593bef6568 Minor code cleanup
Mark Doliner <mark@kingant.net>
parents: 15918
diff changeset
243 const char *xmlns;
26593bef6568 Minor code cleanup
Mark Doliner <mark@kingant.net>
parents: 15918
diff changeset
244
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
245 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
246
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
247 /* 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
248 if(NULL == *packet)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
249 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
250
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
251 xmlns = xmlnode_get_namespace(*packet);
15919
26593bef6568 Minor code cleanup
Mark Doliner <mark@kingant.net>
parents: 15918
diff changeset
252
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 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
254 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
255 } 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
256 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
257 } 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
258 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
259 } 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
260 jabber_stream_features_parse(js, *packet);
21538
4e5bef6c3379 Fix #3669
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21418
diff changeset
261 } else if (!strcmp((*packet)->name, "features") && xmlns &&
15919
26593bef6568 Minor code cleanup
Mark Doliner <mark@kingant.net>
parents: 15918
diff changeset
262 !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
263 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
264 } else if(!strcmp((*packet)->name, "stream:error") ||
21538
4e5bef6c3379 Fix #3669
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21418
diff changeset
265 (!strcmp((*packet)->name, "error") && xmlns &&
15919
26593bef6568 Minor code cleanup
Mark Doliner <mark@kingant.net>
parents: 15918
diff changeset
266 !strcmp(xmlns, "http://etherx.jabber.org/streams")))
26593bef6568 Minor code cleanup
Mark Doliner <mark@kingant.net>
parents: 15918
diff changeset
267 {
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
268 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
269 } else if(!strcmp((*packet)->name, "challenge")) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270 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
271 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
272 } else if(!strcmp((*packet)->name, "success")) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
273 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
274 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
275 } else if(!strcmp((*packet)->name, "failure")) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
276 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
277 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
278 } else if(!strcmp((*packet)->name, "proceed")) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
279 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
280 tls_init(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
281 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
282 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
283 (*packet)->name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
284 }
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
287 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
288 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
289 int ret;
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 if (js->gsc)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
292 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
293 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
294 ret = write(js->fd, data, len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
295
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
296 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
297 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
298
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
299 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
300 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301 JabberStream *js = data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302 int ret, writelen;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
303 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
304
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
305 if (writelen == 0) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
306 purple_input_remove(js->writeh);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307 js->writeh = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
308 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309 }
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 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
312
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
313 if (ret < 0 && errno == EAGAIN)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
314 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
315 else if (ret <= 0) {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
316 purple_connection_error_reason (js->gc,
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
317 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
20117
f24a2cacacd1 Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents: 20076
diff changeset
318 _("Write error"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
319 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
320 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
321
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
322 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
323 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
324
23378
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
325 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
326 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
327 int ret;
23378
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
328 gboolean success = TRUE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
329
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
330 if (len == -1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
331 len = strlen(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
332
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
333 if (js->writeh == 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
334 ret = jabber_do_send(js, data, len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
335 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
336 ret = -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
337 errno = EAGAIN;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
338 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
339
23378
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
340 if (ret < 0 && errno != EAGAIN) {
20117
f24a2cacacd1 Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents: 20076
diff changeset
341 purple_connection_error_reason (js->gc,
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
342 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
20117
f24a2cacacd1 Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents: 20076
diff changeset
343 _("Write error"));
23378
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
344 success = FALSE;
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
345 } else if (ret < len) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
346 if (ret < 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
347 ret = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
348 if (js->writeh == 0)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
349 js->writeh = purple_input_add(
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
350 js->gsc ? js->gsc->fd : js->fd,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
351 PURPLE_INPUT_WRITE, jabber_send_cb, js);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
352 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
353 data + ret, len - ret);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
354 }
23378
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
355
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
356 return success;
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
357 }
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
358
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
359 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
360 {
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
361
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
362 /* because printing a tab to debug every minute gets old */
24858
3a4070656d61 Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents: 24834
diff changeset
363 if(strcmp(data, "\t")) {
3a4070656d61 Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents: 24834
diff changeset
364 char *text = NULL, *last_part = NULL, *tag_start = NULL;
3a4070656d61 Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents: 24834
diff changeset
365
3a4070656d61 Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents: 24834
diff changeset
366 /* Because debug logs with plaintext passwords make me sad */
3a4070656d61 Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents: 24834
diff changeset
367 if(js->state != JABBER_STREAM_CONNECTED &&
3a4070656d61 Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents: 24834
diff changeset
368 /* Either <auth> or <query><password>... */
3a4070656d61 Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents: 24834
diff changeset
369 (((tag_start = strstr(data, "<auth ")) &&
3a4070656d61 Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents: 24834
diff changeset
370 strstr(data, "xmlns='urn:ietf:params:xml:ns:xmpp-sasl'")) ||
3a4070656d61 Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents: 24834
diff changeset
371 ((tag_start = strstr(data, "<query ")) &&
3a4070656d61 Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents: 24834
diff changeset
372 strstr(data, "xmlns='jabber:iq:auth'>") &&
3a4070656d61 Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents: 24834
diff changeset
373 (tag_start = strstr(tag_start, "<password>"))))) {
3a4070656d61 Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents: 24834
diff changeset
374 char *data_start, *tag_end = strchr(tag_start, '>');
3a4070656d61 Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents: 24834
diff changeset
375 text = g_strdup(data);
3a4070656d61 Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents: 24834
diff changeset
376
3a4070656d61 Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents: 24834
diff changeset
377 data_start = text + (tag_end - data) + 1;
3a4070656d61 Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents: 24834
diff changeset
378
3a4070656d61 Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents: 24834
diff changeset
379 last_part = strchr(data_start, '<');
3a4070656d61 Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents: 24834
diff changeset
380 *data_start = '\0';
3a4070656d61 Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents: 24834
diff changeset
381 }
3a4070656d61 Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents: 24834
diff changeset
382
3a4070656d61 Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents: 24834
diff changeset
383 purple_debug(PURPLE_DEBUG_MISC, "jabber", "Sending%s: %s%s%s\n",
3a4070656d61 Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents: 24834
diff changeset
384 js->gsc ? " (ssl)" : "", text ? text : data,
3a4070656d61 Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents: 24834
diff changeset
385 last_part ? "password removed" : "",
3a4070656d61 Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents: 24834
diff changeset
386 last_part ? last_part : "");
3a4070656d61 Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents: 24834
diff changeset
387
3a4070656d61 Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents: 24834
diff changeset
388 g_free(text);
3a4070656d61 Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents: 24834
diff changeset
389 }
23378
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
390
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
391 /* 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
392 * 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
393
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
394 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
395 if (data == NULL)
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
396 return;
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
397
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
398 #ifdef HAVE_CYRUS_SASL
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
399 if (js->sasl_maxbuf>0) {
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
400 int pos = 0;
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
401
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
402 if (!js->gsc && js->fd<0)
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
403 return;
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
404
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
405 if (len == -1)
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
406 len = strlen(data);
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
407
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
408 while (pos < len) {
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
409 int towrite;
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
410 const char *out;
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
411 unsigned olen;
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
412
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
413 towrite = MIN((len - pos), js->sasl_maxbuf);
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
414
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
415 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
416 pos += towrite;
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
417
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
418 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
419 break;
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
420 }
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
421 return;
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
422 }
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
423 #endif
e12600d6b902 Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23287
diff changeset
424
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
425 if (len == -1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
426 len = strlen(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427
25777
17b60b844803 Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents: 25776
diff changeset
428 if (js->use_bosh)
17b60b844803 Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents: 25776
diff changeset
429 jabber_bosh_connection_send_raw(js->bosh, data, len);
17b60b844803 Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents: 25776
diff changeset
430 else
25717
907ca9a36fe0 explicit merge of '714a7c7f903d11c96ffade34966121da549d998f'
Paul Aurich <paul@darkrain42.org>
parents: 25608 25716
diff changeset
431 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
432 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
433
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
434 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
435 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
436 JabberStream *js = (JabberStream*)gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
437 jabber_send_raw(js, buf, len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
438 return len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
439 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
440
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
441 void jabber_send(JabberStream *js, xmlnode *packet)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
442 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
443 char *txt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
444 int len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
445
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
446 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
447
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
448 /* 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
449 if(NULL == packet)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
451
25777
17b60b844803 Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents: 25776
diff changeset
452 if (js->use_bosh)
17b60b844803 Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents: 25776
diff changeset
453 jabber_bosh_connection_send(js->bosh, packet);
17b60b844803 Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents: 25776
diff changeset
454 else {
17b60b844803 Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents: 25776
diff changeset
455 txt = xmlnode_to_str(packet, &len);
17b60b844803 Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents: 25776
diff changeset
456 jabber_send_raw(js, txt, len);
17b60b844803 Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents: 25776
diff changeset
457 g_free(txt);
17b60b844803 Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents: 25776
diff changeset
458 }
15374
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
23379
6c728443b426 We only allow one keepalive timeout, so simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23378
diff changeset
461 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
462 {
23379
6c728443b426 We only allow one keepalive timeout, so simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23378
diff changeset
463 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
464 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
465 }
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
466
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
467 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
468 {
21973
966f98d4b04b Masca noticed that dc6923294f5f33ff7a52a998e1b9e9ad47be0211 made jabber.c not
Will Thompson <will.thompson@collabora.co.uk>
parents: 21964
diff changeset
469 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
470 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
471 _("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
472 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
473 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
474 }
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
475
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
476 void jabber_keepalive(PurpleConnection *gc)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
477 {
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
478 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
479
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
480 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
481 JabberIq *iq = jabber_iq_new(js, JABBER_IQ_GET);
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
482
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
483 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
484 xmlnode_set_namespace(ping, "urn:xmpp:ping");
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
485
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
486 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
487 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
488 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
489 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
490 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
491
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
492 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
493 jabber_recv_cb_ssl(gpointer data, PurpleSslConnection *gsc,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
494 PurpleInputCondition cond)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
495 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
496 PurpleConnection *gc = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
497 JabberStream *js = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
498 int len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
499 static char buf[4096];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
500
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
501 /* 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
502 if(!PURPLE_CONNECTION_IS_VALID(gc)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
503 purple_ssl_close(gsc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
504 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
505 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
506
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
507 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
508 gc->last_received = time(NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
509 buf[len] = '\0';
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
510 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
511 jabber_parser_process(js, buf, len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
512 if(js->reinit)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
513 jabber_stream_init(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
514 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
515
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
516 if(len < 0 && errno == EAGAIN)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
517 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
518 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
519 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
520 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
521 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
522 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
523 purple_connection_error_reason (js->gc,
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
524 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
20117
f24a2cacacd1 Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents: 20076
diff changeset
525 _("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
526 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
527 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
528
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
529 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
530 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
531 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
532 PurpleConnection *gc = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
533 JabberStream *js = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
534 int len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
535 static char buf[4096];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
536
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
537 if(!PURPLE_CONNECTION_IS_VALID(gc))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
538 return;
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 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
541 gc->last_received = time(NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
542 #ifdef HAVE_CYRUS_SASL
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
543 if (js->sasl_maxbuf>0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
544 const char *out;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
545 unsigned int olen;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
546 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
547 if (olen>0) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
548 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
549 jabber_parser_process(js,out,olen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
550 if(js->reinit)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
551 jabber_stream_init(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
552 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
553 return;
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 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
556 buf[len] = '\0';
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
557 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
558 jabber_parser_process(js, buf, len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
559 if(js->reinit)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
560 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
561 } else if(len < 0 && errno == EAGAIN) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
562 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
563 } 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
564 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
565 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
566 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
567 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
568 purple_connection_error_reason (js->gc,
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
569 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
20117
f24a2cacacd1 Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents: 20076
diff changeset
570 _("Read Error"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
571 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
572 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
573
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
574 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
575 jabber_login_callback_ssl(gpointer data, PurpleSslConnection *gsc,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
576 PurpleInputCondition cond)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
577 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
578 PurpleConnection *gc = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
579 JabberStream *js;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
580
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
581 /* 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
582 if(!PURPLE_CONNECTION_IS_VALID(gc)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
583 purple_ssl_close(gsc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
584 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
585 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
586
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
587 js = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
588
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
589 if(js->state == JABBER_STREAM_CONNECTING)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
590 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
591 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
592 purple_ssl_input_add(gsc, jabber_recv_cb_ssl, gc);
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
593
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
594 /* 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
595 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
596 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
597
25600
1cbe5a9f6efb * adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25597
diff changeset
598 static void
1cbe5a9f6efb * adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25597
diff changeset
599 jabber_bosh_login_callback(PurpleBOSHConnection *conn)
1cbe5a9f6efb * adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25597
diff changeset
600 {
1cbe5a9f6efb * adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25597
diff changeset
601 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
602 }
1cbe5a9f6efb * adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25597
diff changeset
603
25596
7768cad83127 * looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25593
diff changeset
604 static void
7768cad83127 * looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25593
diff changeset
605 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
606 {
25776
7de1f124f95a Jabber BOSH: Many fixes
Paul Aurich <paul@darkrain42.org>
parents: 25775
diff changeset
607 JabberStream *js = data;
25596
7768cad83127 * looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25593
diff changeset
608 int n;
7768cad83127 * looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25593
diff changeset
609
25775
1516525c86fa Track the TXT query in the js object so it will be cancelleable
Paul Aurich <paul@darkrain42.org>
parents: 25774
diff changeset
610 js->srv_query_data = NULL;
1516525c86fa Track the TXT query in the js object so it will be cancelleable
Paul Aurich <paul@darkrain42.org>
parents: 25774
diff changeset
611
25597
9f8951284a2e * small bugfix in jabber_ipc_add_feature()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25596
diff changeset
612 if (results == 0) {
25596
7768cad83127 * looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25593
diff changeset
613 gchar *tmp;
7768cad83127 * looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25593
diff changeset
614 tmp = g_strdup_printf(_("Could not find alternative XMPP connection methods after failing to connect directly.\n"));
25776
7de1f124f95a Jabber BOSH: Many fixes
Paul Aurich <paul@darkrain42.org>
parents: 25775
diff changeset
615 purple_connection_error_reason (js->gc,
25596
7768cad83127 * looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25593
diff changeset
616 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
617 g_free(tmp);
1cbe5a9f6efb * adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25597
diff changeset
618 return;
25596
7768cad83127 * looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25593
diff changeset
619 }
7768cad83127 * looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25593
diff changeset
620
7768cad83127 * looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25593
diff changeset
621 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
622 gchar **token;
9f8951284a2e * small bugfix in jabber_ipc_add_feature()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25596
diff changeset
623 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
624 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
625 purple_debug_info("jabber","Found alternative connection method using %s at %s.\n", token[0], token[1]);
25776
7de1f124f95a Jabber BOSH: Many fixes
Paul Aurich <paul@darkrain42.org>
parents: 25775
diff changeset
626 js->bosh = jabber_bosh_connection_init(js, token[1]);
25777
17b60b844803 Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents: 25776
diff changeset
627 js->use_bosh = TRUE;
25597
9f8951284a2e * small bugfix in jabber_ipc_add_feature()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25596
diff changeset
628 g_strfreev(token);
9f8951284a2e * small bugfix in jabber_ipc_add_feature()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25596
diff changeset
629 break;
9f8951284a2e * small bugfix in jabber_ipc_add_feature()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25596
diff changeset
630 }
9f8951284a2e * small bugfix in jabber_ipc_add_feature()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25596
diff changeset
631 g_strfreev(token);
25596
7768cad83127 * looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25593
diff changeset
632 }
25776
7de1f124f95a Jabber BOSH: Many fixes
Paul Aurich <paul@darkrain42.org>
parents: 25775
diff changeset
633 if (js->bosh) {
7de1f124f95a Jabber BOSH: Many fixes
Paul Aurich <paul@darkrain42.org>
parents: 25775
diff changeset
634 jabber_bosh_connection_connect(js->bosh);
25600
1cbe5a9f6efb * adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25597
diff changeset
635 } else {
1cbe5a9f6efb * adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25597
diff changeset
636 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
637 }
25596
7768cad83127 * looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25593
diff changeset
638 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
639
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
640 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
641 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
642 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
643 PurpleConnection *gc = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
644 JabberStream *js = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
645
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
646 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
647 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
648 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
649 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
650 } else {
25716
ba362a67278c propagate from branch 'im.pidgin.pidgin' (head 2747d5e0324ca6b81e83bbb8b75e1efebcbbad6e)
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23644 25597
diff changeset
651 purple_debug_info("jabber","Couldn't connect directly to %s. Trying to find alternative connection methods, like BOSH.\n", js->user->domain);
25776
7de1f124f95a Jabber BOSH: Many fixes
Paul Aurich <paul@darkrain42.org>
parents: 25775
diff changeset
652 js->srv_query_data = purple_txt_resolve("_xmppconnect", js->user->domain, txt_resolved_cb, 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
653 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
654 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
655 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
656
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
657 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
658 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
659
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
660 js->fd = source;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
661
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
662 if(js->state == JABBER_STREAM_CONNECTING)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
663 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
664
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
665 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
666 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
667 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
668
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
669 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
670 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
671 gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
672 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
673 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
674 JabberStream *js;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
675
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
676 /* 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
677 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
678 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
679
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
680 js = gc->proto_data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
681 js->gsc = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
682
20117
f24a2cacacd1 Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents: 20076
diff changeset
683 purple_connection_ssl_error (gc, error);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
684 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
685
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
686 static void tls_init(JabberStream *js)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
687 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
688 purple_input_remove(js->gc->inpa);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
689 js->gc->inpa = 0;
18929
67cb28c0ec89 applied changes from e52b685d84ca8874da6e3e71199829e513500642
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18163
diff changeset
690 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
691 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
692 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
693
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
694 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
695 gboolean fatal_failure)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
696 {
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
697 /* 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
698 * 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
699 * 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
700 * 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
701 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
702 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
703 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
704 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
705 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
706
17007
37a2d6eadd34 fix #699
Nathan Walp <nwalp@pidgin.im>
parents: 16963
diff changeset
707 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
708 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
709 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
710 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
711 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
712 _("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
713 }
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
714
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
715 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
716 }
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
717
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
718 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
719 }
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
720
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
721 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
722 {
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
723 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
724 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
725 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
726 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
727 }
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
728
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
729 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
730 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
731
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
732 /* 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
733 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
734 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
735 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
736
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
737 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
738 {
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
739 JabberStream *js = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
740 js->srv_query_data = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
741
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
742 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
743 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
744 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
745 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
746 try_srv_connect(js);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
747 } else {
17007
37a2d6eadd34 fix #699
Nathan Walp <nwalp@pidgin.im>
parents: 16963
diff changeset
748 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
749 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
750 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
751 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
752
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
753 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
754 jabber_login(PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
755 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
756 PurpleConnection *gc = purple_account_get_connection(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
757 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
758 "connect_server", "");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
759 JabberStream *js;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
760 JabberBuddy *my_jb = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
761
23445
4ac5db6e39f3 Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents: 23182
diff changeset
762 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
763 PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
764 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
765 js->gc = gc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
766 js->fd = -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
767 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
768 g_free, g_free);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
769 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
770 g_free, g_free);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
771 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
772 g_free, (GDestroyNotify)jabber_buddy_free);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
773 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
774 g_free, (GDestroyNotify)jabber_chat_free);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
775 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
776 js->next_id = g_random_int();
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
777 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
778 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
779 js->keepalive_timeout = -1;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
780
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
781 if(!js->user) {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
782 purple_connection_error_reason (gc,
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
783 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS,
20117
f24a2cacacd1 Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents: 20076
diff changeset
784 _("Invalid XMPP ID"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
785 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
786 }
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
787
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
788 if (!js->user->domain || *(js->user->domain) == '\0') {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
789 purple_connection_error_reason (gc,
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
790 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS,
20117
f24a2cacacd1 Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents: 20076
diff changeset
791 _("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
792 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
793 }
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
794
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
795 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
796 my_jb->subscription |= JABBER_SUB_BOTH;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
797
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
798 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
799
25834
7d2e85f78aec Allow the user to specify their own BOSH url in the Connect Server option
Paul Aurich <paul@darkrain42.org>
parents: 25833
diff changeset
800 /* TODO: Just use purple_url_parse? */
7d2e85f78aec Allow the user to specify their own BOSH url in the Connect Server option
Paul Aurich <paul@darkrain42.org>
parents: 25833
diff changeset
801 if (!g_ascii_strncasecmp(connect_server, "http://", 7) || !g_ascii_strncasecmp(connect_server, "https://", 8)) {
7d2e85f78aec Allow the user to specify their own BOSH url in the Connect Server option
Paul Aurich <paul@darkrain42.org>
parents: 25833
diff changeset
802 js->use_bosh = TRUE;
7d2e85f78aec Allow the user to specify their own BOSH url in the Connect Server option
Paul Aurich <paul@darkrain42.org>
parents: 25833
diff changeset
803 js->bosh = jabber_bosh_connection_init(js, connect_server);
7d2e85f78aec Allow the user to specify their own BOSH url in the Connect Server option
Paul Aurich <paul@darkrain42.org>
parents: 25833
diff changeset
804 if (!js->bosh) {
7d2e85f78aec Allow the user to specify their own BOSH url in the Connect Server option
Paul Aurich <paul@darkrain42.org>
parents: 25833
diff changeset
805 purple_connection_error_reason (js->gc,
7d2e85f78aec Allow the user to specify their own BOSH url in the Connect Server option
Paul Aurich <paul@darkrain42.org>
parents: 25833
diff changeset
806 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS,
7d2e85f78aec Allow the user to specify their own BOSH url in the Connect Server option
Paul Aurich <paul@darkrain42.org>
parents: 25833
diff changeset
807 _("Malformed BOSH Connect Server"));
7d2e85f78aec Allow the user to specify their own BOSH url in the Connect Server option
Paul Aurich <paul@darkrain42.org>
parents: 25833
diff changeset
808 return;
7d2e85f78aec Allow the user to specify their own BOSH url in the Connect Server option
Paul Aurich <paul@darkrain42.org>
parents: 25833
diff changeset
809 }
7d2e85f78aec Allow the user to specify their own BOSH url in the Connect Server option
Paul Aurich <paul@darkrain42.org>
parents: 25833
diff changeset
810 jabber_bosh_connection_connect(js->bosh);
25774
514051f3b6cf Add option for forcing BOSH (useful for debugging)
Paul Aurich <paul@darkrain42.org>
parents: 25772
diff changeset
811 return;
25834
7d2e85f78aec Allow the user to specify their own BOSH url in the Connect Server option
Paul Aurich <paul@darkrain42.org>
parents: 25833
diff changeset
812 } else {
7d2e85f78aec Allow the user to specify their own BOSH url in the Connect Server option
Paul Aurich <paul@darkrain42.org>
parents: 25833
diff changeset
813 js->certificate_CN = g_strdup(connect_server[0] ? connect_server : js->user->domain);
25774
514051f3b6cf Add option for forcing BOSH (useful for debugging)
Paul Aurich <paul@darkrain42.org>
parents: 25772
diff changeset
814 }
514051f3b6cf Add option for forcing BOSH (useful for debugging)
Paul Aurich <paul@darkrain42.org>
parents: 25772
diff changeset
815
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
816 /* 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
817 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
818 if(purple_ssl_is_supported()) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
819 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
820 js->certificate_CN,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
821 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
822 jabber_ssl_connect_failure, js->gc);
25835
97a4d71e0c3d Don't fallback (under any conditions) from old-style SSL to other connections
Paul Aurich <paul@darkrain42.org>
parents: 25834
diff changeset
823 if (!js->gsc) {
97a4d71e0c3d Don't fallback (under any conditions) from old-style SSL to other connections
Paul Aurich <paul@darkrain42.org>
parents: 25834
diff changeset
824 purple_connection_error_reason (js->gc,
97a4d71e0c3d Don't fallback (under any conditions) from old-style SSL to other connections
Paul Aurich <paul@darkrain42.org>
parents: 25834
diff changeset
825 PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT,
97a4d71e0c3d Don't fallback (under any conditions) from old-style SSL to other connections
Paul Aurich <paul@darkrain42.org>
parents: 25834
diff changeset
826 _("Unable to establish SSL connection"));
97a4d71e0c3d Don't fallback (under any conditions) from old-style SSL to other connections
Paul Aurich <paul@darkrain42.org>
parents: 25834
diff changeset
827 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
828 } else {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
829 purple_connection_error_reason (js->gc,
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
830 PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT,
20117
f24a2cacacd1 Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents: 20076
diff changeset
831 _("SSL support unavailable"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
832 }
25835
97a4d71e0c3d Don't fallback (under any conditions) from old-style SSL to other connections
Paul Aurich <paul@darkrain42.org>
parents: 25834
diff changeset
833
97a4d71e0c3d Don't fallback (under any conditions) from old-style SSL to other connections
Paul Aurich <paul@darkrain42.org>
parents: 25834
diff changeset
834 return;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
835 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
836
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
837 /* 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
838 * invoke the magic of SRV lookups, to figure out host and port */
25987
c4fd9222dda1 propagate from branch 'im.pidgin.pidgin' (head 303af74a38e7b313d4fb0be4d4054a16cb13d819)
Paul Aurich <paul@darkrain42.org>
parents: 25443 25835
diff changeset
839 if(connect_server[0]) {
25835
97a4d71e0c3d Don't fallback (under any conditions) from old-style SSL to other connections
Paul Aurich <paul@darkrain42.org>
parents: 25834
diff changeset
840 jabber_login_connect(js, js->user->domain, connect_server, purple_account_get_int(account, "port", 5222), TRUE);
97a4d71e0c3d Don't fallback (under any conditions) from old-style SSL to other connections
Paul Aurich <paul@darkrain42.org>
parents: 25834
diff changeset
841 } else {
97a4d71e0c3d Don't fallback (under any conditions) from old-style SSL to other connections
Paul Aurich <paul@darkrain42.org>
parents: 25834
diff changeset
842 js->srv_query_data = purple_srv_resolve("xmpp-client",
97a4d71e0c3d Don't fallback (under any conditions) from old-style SSL to other connections
Paul Aurich <paul@darkrain42.org>
parents: 25834
diff changeset
843 "tcp", js->user->domain, srv_resolved_cb, js);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
844 }
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
847
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
848 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
849 conn_close_cb(gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
850 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
851 JabberStream *js = data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
852 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
853
17603
7a3a66c6530a Fixed a leak: The XML parser was never cleaned up on disconnect.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17599
diff changeset
854 jabber_parser_free(js);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
855
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
856 purple_account_disconnect(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
857
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
858 return FALSE;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
861 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
862 jabber_connection_schedule_close(JabberStream *js)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
863 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
864 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
865 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
866
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
867 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
868 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
869 {
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
870 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
871 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
872 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
873 char *to = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
874
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
875 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
876 if(js->registration) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
877 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
878 js->user->node, js->user->domain);
17608
a8b1159fd95b Simplified registration callback per request of Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17607
diff changeset
879 if(account->registration_cb)
a8b1159fd95b Simplified registration callback per request of Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17607
diff changeset
880 (account->registration_cb)(account, TRUE, account->registration_cb_user_data);
25101
b90c26f391b0 Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <paul@darkrain42.org>
parents: 25097
diff changeset
881 } else {
b90c26f391b0 Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <paul@darkrain42.org>
parents: 25097
diff changeset
882 g_return_if_fail(to != NULL);
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
883 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
884 to);
25101
b90c26f391b0 Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <paul@darkrain42.org>
parents: 25097
diff changeset
885 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
886 purple_notify_info(NULL, _("Registration Successful"),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
887 _("Registration Successful"), buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
888 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
889 } 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
890 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
891
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
892 if(!msg)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
893 msg = g_strdup(_("Unknown Error"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
894
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
895 purple_notify_error(NULL, _("Registration Failed"),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
896 _("Registration Failed"), msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
897 g_free(msg);
17608
a8b1159fd95b Simplified registration callback per request of Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17607
diff changeset
898 if(account->registration_cb)
a8b1159fd95b Simplified registration callback per request of Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17607
diff changeset
899 (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
900 }
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
901 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
902 if(js->registration)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
903 jabber_connection_schedule_close(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
904 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
905
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
906 static void
18695
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
907 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
908 {
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
909 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
910 char *buf;
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
911 char *to = data;
25101
b90c26f391b0 Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <paul@darkrain42.org>
parents: 25097
diff changeset
912
b90c26f391b0 Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <paul@darkrain42.org>
parents: 25097
diff changeset
913 /* This function is never called for unregistering our XMPP account from
b90c26f391b0 Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <paul@darkrain42.org>
parents: 25097
diff changeset
914 * the server, so there should always be a 'to' address. */
b90c26f391b0 Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <paul@darkrain42.org>
parents: 25097
diff changeset
915 g_return_if_fail(to != NULL);
b90c26f391b0 Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <paul@darkrain42.org>
parents: 25097
diff changeset
916
18695
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
917 if(!strcmp(type, "result")) {
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
918 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
919 to);
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
920 purple_notify_info(NULL, _("Unregistration Successful"),
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
921 _("Unregistration Successful"), buf);
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
922 g_free(buf);
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
923 } 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
924 char *msg = jabber_parse_error(js, packet, NULL);
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
925
18695
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
926 if(!msg)
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
927 msg = g_strdup(_("Unknown Error"));
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
928
18695
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
929 purple_notify_error(NULL, _("Unregistration Failed"),
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
930 _("Unregistration Failed"), msg);
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
931 g_free(msg);
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
932 }
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
933 g_free(to);
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
934 }
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
935
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
936 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
937 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
938 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
939 } 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
940
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
941 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
942 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
943 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
944 GList *groups, *flds;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
945 xmlnode *query, *y;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
946 JabberIq *iq;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
947 char *username;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
948
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
949 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
950 query = xmlnode_get_child(iq->node, "query");
25101
b90c26f391b0 Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <paul@darkrain42.org>
parents: 25097
diff changeset
951 if (cbdata->who)
b90c26f391b0 Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <paul@darkrain42.org>
parents: 25097
diff changeset
952 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
953
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
954 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
955 groups = groups->next) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
956 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
957 flds; flds = flds->next) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
958 PurpleRequestField *field = flds->data;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
959 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
960 if(!strcmp(id,"unregister")) {
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
961 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
962 if(value) {
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
963 /* 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
964 (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
965 jabber_iq_free(iq);
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
966 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
967 query = xmlnode_get_child(iq->node, "query");
25101
b90c26f391b0 Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <paul@darkrain42.org>
parents: 25097
diff changeset
968 if (cbdata->who)
b90c26f391b0 Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <paul@darkrain42.org>
parents: 25097
diff changeset
969 xmlnode_set_attrib(iq->node,"to",cbdata->who);
18695
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
970 xmlnode_new_child(query, "remove");
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
971
18695
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
972 jabber_iq_set_callback(iq, jabber_unregistration_result_cb, cbdata->who);
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
973
18695
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
974 jabber_iq_send(iq);
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
975 g_free(cbdata);
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
976 return;
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
977 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
978 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
979 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
980
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
981 if(!strcmp(id, "username")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
982 y = xmlnode_new_child(query, "username");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
983 } else if(!strcmp(id, "password")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
984 y = xmlnode_new_child(query, "password");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
985 } else if(!strcmp(id, "name")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
986 y = xmlnode_new_child(query, "name");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
987 } else if(!strcmp(id, "email")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
988 y = xmlnode_new_child(query, "email");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
989 } else if(!strcmp(id, "nick")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
990 y = xmlnode_new_child(query, "nick");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
991 } else if(!strcmp(id, "first")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
992 y = xmlnode_new_child(query, "first");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
993 } else if(!strcmp(id, "last")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
994 y = xmlnode_new_child(query, "last");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
995 } else if(!strcmp(id, "address")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
996 y = xmlnode_new_child(query, "address");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
997 } else if(!strcmp(id, "city")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
998 y = xmlnode_new_child(query, "city");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
999 } else if(!strcmp(id, "state")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1000 y = xmlnode_new_child(query, "state");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1001 } else if(!strcmp(id, "zip")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1002 y = xmlnode_new_child(query, "zip");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1003 } else if(!strcmp(id, "phone")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1004 y = xmlnode_new_child(query, "phone");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1005 } else if(!strcmp(id, "url")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1006 y = xmlnode_new_child(query, "url");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1007 } else if(!strcmp(id, "date")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1008 y = xmlnode_new_child(query, "date");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1009 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1010 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1011 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1012 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
1013 if(cbdata->js->registration && !strcmp(id, "username")) {
25101
b90c26f391b0 Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <paul@darkrain42.org>
parents: 25097
diff changeset
1014 g_free(cbdata->js->user->node);
18695
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
1015 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
1016 }
18695
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
1017 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
1018 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
1019 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1020 }
19696
481749fc0b6b merge of '1c7910841138381c841363256ca3c7905b1f26b0'
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19694 19680
diff changeset
1021 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1022
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
1023 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
1024 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
1025 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
1026 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
1027 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
1028 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1029
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
1030 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
1031
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1032 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
1033 g_free(cbdata);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1034 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1035
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1036 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
1037 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
1038 {
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
1039 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
1040 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
1041 if(account->registration_cb)
17608
a8b1159fd95b Simplified registration callback per request of Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17607
diff changeset
1042 (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
1043 jabber_connection_schedule_close(cbdata->js);
20276
c1d3d25e8c49 Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents: 20187
diff changeset
1044 }
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
1045 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
1046 g_free(cbdata);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1047 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1048
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1049 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
1050 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1051 xmlnode *query;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1052 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
1053 char *to = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1054
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1055 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
1056 query = xmlnode_get_child(iq->node, "query");
25101
b90c26f391b0 Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <paul@darkrain42.org>
parents: 25097
diff changeset
1057 if (to)
b90c26f391b0 Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <paul@darkrain42.org>
parents: 25097
diff changeset
1058 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
1059
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1060 xmlnode_insert_child(query, result);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1061
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
1062 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
1063 jabber_iq_send(iq);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1064 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1065
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1066 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
1067 {
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
1068 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
1069 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
1070 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
1071 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
1072 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
1073 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
1074 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
1075 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
1076 JabberRegisterCBData *cbdata;
18695
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
1077 gboolean registered = FALSE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1078
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1079 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
1080 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1081
21592
68b036c452f3 The Jabber registration process depends upon having a non-NULL cbdata->who,
Evan Schoenberg <evan.s@dreskin.net>
parents: 21591
diff changeset
1082 from = xmlnode_get_attrib(packet, "from");
25101
b90c26f391b0 Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <paul@darkrain42.org>
parents: 25097
diff changeset
1083
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
1084 if(js->registration) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1085 /* get rid of the login thingy */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1086 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
1087 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1088
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
1089 query = xmlnode_get_child(packet, "query");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1090
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
1091 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
1092 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
1093
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
1094 if(js->registration) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1095 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
1096 _("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
1097 if(account->registration_cb)
17608
a8b1159fd95b Simplified registration callback per request of Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17607
diff changeset
1098 (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
1099 jabber_connection_schedule_close(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1100 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1101 }
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 }
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
1103
25066
256fbe98f6be The jabber_register_parse function was looking for the <x> node as a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25050
diff changeset
1104 if((x = xmlnode_get_child_with_namespace(query, "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
1105 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
1106 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
1107
25066
256fbe98f6be The jabber_register_parse function was looking for the <x> node as a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25050
diff changeset
1108 } else if((x = xmlnode_get_child_with_namespace(query, "x", "jabber:x:oob"))) {
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
1109 xmlnode *url;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1110
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 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
1112 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
1113 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
1114 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
1115 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
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(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
1118 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
1119 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
1120 (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
1121 jabber_connection_schedule_close(js);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1122 }
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
1123 return;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1124 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1125 }
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
1126 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1127
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
1128 /* 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
1129
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
1130 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
1131 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
1132 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
1133
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
1134 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
1135 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
1136 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
1137 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
1138
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
1139 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
1140
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
1141 if(js->registration)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1142 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
1143 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
1144 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
1145 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
1146
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
1147 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
1148 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
1149
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
1150 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
1151 if(js->registration)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1152 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
1153 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
1154 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
1155 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
1156 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
1157 }
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
1158 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
1159 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
1160 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
1161 }
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
1162 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
1163 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
1164 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
1165 }
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
1166 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
1167 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
1168 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
1169 }
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
1170 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
1171 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
1172 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
1173 }
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
1174 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
1175 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
1176 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
1177 }
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
1178 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
1179 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
1180 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
1181 }
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
1182 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
1183 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
1184 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
1185 }
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
1186 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
1187 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
1188 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
1189 }
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
1190 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
1191 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
1192 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
1193 }
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
1194 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
1195 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
1196 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
1197 }
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
1198 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
1199 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
1200 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
1201 }
18695
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
1202 if(registered) {
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
1203 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
1204 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
1205 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1206
20276
c1d3d25e8c49 Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents: 20187
diff changeset
1207 if((y = xmlnode_get_child(query, "instructions")))
c1d3d25e8c49 Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents: 20187
diff changeset
1208 instructions = xmlnode_get_data(y);
18695
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
1209 else if(registered)
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
1210 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
1211 "to change your account registration."));
20276
c1d3d25e8c49 Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents: 20187
diff changeset
1212 else
c1d3d25e8c49 Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents: 20187
diff changeset
1213 instructions = g_strdup(_("Please fill out the information below "
c1d3d25e8c49 Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents: 20187
diff changeset
1214 "to register your new account."));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1215
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
1216 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
1217 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
1218 cbdata->who = g_strdup(from);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1219
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
1220 if(js->registration)
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
1221 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
1222 _("Register New XMPP Account"), instructions, fields,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1223 _("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
1224 _("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
1225 purple_connection_get_account(js->gc), NULL, NULL,
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
1226 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
1227 else {
25101
b90c26f391b0 Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <paul@darkrain42.org>
parents: 25097
diff changeset
1228 char *title;
b90c26f391b0 Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <paul@darkrain42.org>
parents: 25097
diff changeset
1229 g_return_if_fail(from != NULL);
b90c26f391b0 Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <paul@darkrain42.org>
parents: 25097
diff changeset
1230 title = registered ? g_strdup_printf(_("Change Account Registration at %s"), from)
18695
91eece1ad9bc Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
1231 :g_strdup_printf(_("Register New Account at %s"), from);
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
1232 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
1233 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
1234 (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
1235 _("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
1236 purple_connection_get_account(js->gc), NULL, NULL,
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
1237 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
1238 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
1239 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1240
20276
c1d3d25e8c49 Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents: 20187
diff changeset
1241 g_free(instructions);
c1d3d25e8c49 Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents: 20187
diff changeset
1242 }
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 void jabber_register_start(JabberStream *js)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1245 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1246 JabberIq *iq;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1247
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1248 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
1249 jabber_iq_send(iq);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1250 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1251
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
1252 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
1253 JabberIq *iq;
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
1254
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
1255 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
1256 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
1257 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
1258 }
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
1259
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
1260 void jabber_register_account(PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1261 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1262 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
1263 JabberStream *js;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1264 JabberBuddy *my_jb = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1265 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
1266 "connect_server", "");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1267 const char *server;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1268
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1269 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
1270 js->gc = gc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1271 js->registration = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1272 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
1273 g_free, g_free);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1274 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
1275 g_free, g_free);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1276 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
1277 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
1278 js->old_length = 0;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1279
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1280 if(!js->user) {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
1281 purple_connection_error_reason (gc,
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
1282 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS,
20117
f24a2cacacd1 Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents: 20076
diff changeset
1283 _("Invalid XMPP ID"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1284 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1285 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1286
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1287 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
1288
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1289 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
1290 my_jb->subscription |= JABBER_SUB_BOTH;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1291
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1292 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
1293 js->certificate_CN = g_strdup(server);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1294
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1295 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
1296
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1297 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
1298 if(purple_ssl_is_supported()) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1299 js->gsc = purple_ssl_connect(account, server,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1300 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
1301 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
1302 } else {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
1303 purple_connection_error_reason (gc,
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
1304 PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT,
20117
f24a2cacacd1 Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents: 20076
diff changeset
1305 _("SSL support unavailable"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1306 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1307 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1308
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1309 if(!js->gsc) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1310 if (connect_server[0]) {
17007
37a2d6eadd34 fix #699
Nathan Walp <nwalp@pidgin.im>
parents: 16963
diff changeset
1311 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
1312 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
1313 "port", 5222), TRUE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1314 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1315 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
1316 "tcp",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1317 js->user->domain,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1318 srv_resolved_cb,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1319 js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1320 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1321 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1322 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1323
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
1324 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
1325 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
1326 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
1327 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
1328 char *msg = jabber_parse_error(js, packet, NULL);
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
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 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
1331 _("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
1332 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
1333 if(js->unregistration_cb)
18921
ba3b22cd280b Mixed up TRUE and FALSE.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18920
diff changeset
1334 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
1335 } 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
1336 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
1337 _("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
1338 if(js->unregistration_cb)
18921
ba3b22cd280b Mixed up TRUE and FALSE.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18920
diff changeset
1339 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
1340 }
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
1341 }
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
1342
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
1343 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
1344 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
1345 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
1346
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1347 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
1348
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1349 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
1350
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1351 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
1352
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1353 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
1354 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
1355
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1356 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
1357 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
1358 }
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
1359
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
1360 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
1361 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
1362 JabberStream *js;
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
1363
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
1364 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
1365 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
1366 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
1367 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
1368 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
1369 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
1370 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
1371 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
1372 }
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
1373
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
1374 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
1375
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1376 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
1377 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
1378 return;
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1379 }
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1380
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
1381 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
1382 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
1383 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
1384
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
1385 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
1386 }
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
1387
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
1388 void jabber_close(PurpleConnection *gc)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1389 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1390 JabberStream *js = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1391
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1392 /* 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
1393 * 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
1394 * on some SSL backends.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1395 */
25777
17b60b844803 Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents: 25776
diff changeset
1396 if (!gc->disconnect_timeout) {
17b60b844803 Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents: 25776
diff changeset
1397 if (js->use_bosh)
17b60b844803 Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents: 25776
diff changeset
1398 jabber_bosh_connection_close(js->bosh);
17b60b844803 Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents: 25776
diff changeset
1399 else
17b60b844803 Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents: 25776
diff changeset
1400 jabber_send_raw(js, "</stream:stream>", -1);
17b60b844803 Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents: 25776
diff changeset
1401 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1402
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1403 if (js->srv_query_data)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1404 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
1405
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1406 if(js->gsc) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1407 #ifdef HAVE_OPENSSL
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1408 if (!gc->disconnect_timeout)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1409 #endif
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1410 purple_ssl_close(js->gsc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1411 } else if (js->fd > 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1412 if(js->gc->inpa)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1413 purple_input_remove(js->gc->inpa);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1414 close(js->fd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1415 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1416
25777
17b60b844803 Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents: 25776
diff changeset
1417 if (js->bosh)
17b60b844803 Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents: 25776
diff changeset
1418 jabber_bosh_connection_destroy(js->bosh);
17b60b844803 Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents: 25776
diff changeset
1419
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1420 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
1421
17603
7a3a66c6530a Fixed a leak: The XML parser was never cleaned up on disconnect.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17599
diff changeset
1422 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
1423
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1424 if(js->iq_callbacks)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1425 g_hash_table_destroy(js->iq_callbacks);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1426 if(js->disco_callbacks)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1427 g_hash_table_destroy(js->disco_callbacks);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1428 if(js->buddies)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1429 g_hash_table_destroy(js->buddies);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1430 if(js->chats)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1431 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
1432
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1433 while(js->chat_servers) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1434 g_free(js->chat_servers->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1435 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
1436 }
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
1437
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1438 while(js->user_directories) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1439 g_free(js->user_directories->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1440 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
1441 }
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
1442
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
1443 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
1444 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
1445 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
1446 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
1447 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
1448 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
1449 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
1450 }
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
1451
23744
3c3032be12de Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23644
diff changeset
1452 while(js->url_datas) {
3c3032be12de Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23644
diff changeset
1453 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
1454 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
1455 }
3c3032be12de Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23644
diff changeset
1456
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
1457 g_free(js->stream_id);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1458 if(js->user)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1459 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
1460 g_free(js->avatar_hash);
25742
4040da08a733 Entity Capabilities must be per-JabberStream
Paul Aurich <paul@darkrain42.org>
parents: 25741
diff changeset
1461 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
1462
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1463 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
1464 if(js->writeh)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1465 purple_input_remove(js->writeh);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1466 #ifdef HAVE_CYRUS_SASL
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1467 if(js->sasl)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1468 sasl_dispose(&js->sasl);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1469 if(js->sasl_mechs)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1470 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
1471 g_free(js->sasl_cb);
18929
67cb28c0ec89 applied changes from e52b685d84ca8874da6e3e71199829e513500642
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18163
diff changeset
1472 #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
1473 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
1474 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
1475 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
1476 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
1477 g_free(cmd->node);
17620
11dd7969dd4b Fixed copy/paste error.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17617
diff changeset
1478 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
1479 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
1480 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
1481 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1482 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
1483 g_free(js->certificate_CN);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1484 g_free(js->gmail_last_time);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1485 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
1486 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
1487 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
1488 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
1489 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
1490 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
1491 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
1492 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
1493 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
1494
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
1495 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
1496 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
1497
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
1498 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
1499 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
1500
23644
fa8567fa0ca0 Fix a stupid mistake in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23643
diff changeset
1501 g_free(js);
fa8567fa0ca0 Fix a stupid mistake in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23643
diff changeset
1502
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1503 gc->proto_data = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1504 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1505
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1506 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
1507 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1508 js->state = state;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1509 switch(state) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1510 case JABBER_STREAM_OFFLINE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1511 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1512 case JABBER_STREAM_CONNECTING:
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1513 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
1514 JABBER_CONNECT_STEPS);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1515 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1516 case JABBER_STREAM_INITIALIZING:
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1517 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
1518 js->gsc ? 5 : 2, JABBER_CONNECT_STEPS);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1519 jabber_stream_init(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1520 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
1521 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
1522 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
1523 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
1524 break;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1525 case JABBER_STREAM_AUTHENTICATING:
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1526 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
1527 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
1528 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
1529 jabber_register_start(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1530 } else if(js->auth_type == JABBER_AUTH_IQ_AUTH) {
24772
a0b89076a163 some server(s) don't like empty resource which we now default to. I am not
Ka-Hing Cheung <khc@hxbc.us>
parents: 24614
diff changeset
1531 /* with dreamhost's xmpp server at least, you have to
a0b89076a163 some server(s) don't like empty resource which we now default to. I am not
Ka-Hing Cheung <khc@hxbc.us>
parents: 24614
diff changeset
1532 specify a resource or you will get a "406: Not
a0b89076a163 some server(s) don't like empty resource which we now default to. I am not
Ka-Hing Cheung <khc@hxbc.us>
parents: 24614
diff changeset
1533 Acceptable"
a0b89076a163 some server(s) don't like empty resource which we now default to. I am not
Ka-Hing Cheung <khc@hxbc.us>
parents: 24614
diff changeset
1534 */
a0b89076a163 some server(s) don't like empty resource which we now default to. I am not
Ka-Hing Cheung <khc@hxbc.us>
parents: 24614
diff changeset
1535 if(!js->user->resource || *js->user->resource == '\0') {
a0b89076a163 some server(s) don't like empty resource which we now default to. I am not
Ka-Hing Cheung <khc@hxbc.us>
parents: 24614
diff changeset
1536 g_free(js->user->resource);
a0b89076a163 some server(s) don't like empty resource which we now default to. I am not
Ka-Hing Cheung <khc@hxbc.us>
parents: 24614
diff changeset
1537 js->user->resource = g_strdup("Home");
a0b89076a163 some server(s) don't like empty resource which we now default to. I am not
Ka-Hing Cheung <khc@hxbc.us>
parents: 24614
diff changeset
1538 }
a0b89076a163 some server(s) don't like empty resource which we now default to. I am not
Ka-Hing Cheung <khc@hxbc.us>
parents: 24614
diff changeset
1539
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1540 jabber_auth_start_old(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1541 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1542 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1543 case JABBER_STREAM_REINITIALIZING:
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1544 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
1545 (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
1546
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1547 /* 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
1548 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
1549
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1550 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1551 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
1552 /* 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
1553 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
1554 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1555 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1556 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1557
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1558 char *jabber_get_next_id(JabberStream *js)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1559 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1560 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
1561 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1562
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1563
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
1564 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
1565 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1566 JabberStream *js = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1567
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1568 js->idle = idle ? time(NULL) - idle : idle;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1569 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1570
24820
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1571 static void jabber_blocklist_parse(JabberStream *js, xmlnode *packet, gpointer data)
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1572 {
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1573 xmlnode *blocklist, *item;
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1574 PurpleAccount *account;
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1575
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1576 blocklist = xmlnode_get_child_with_namespace(packet,
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1577 "blocklist", "urn:xmpp:blocking");
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1578 account = purple_connection_get_account(js->gc);
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1579
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1580 if (blocklist == NULL)
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1581 return;
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1582
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1583 item = xmlnode_get_child(blocklist, "item");
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1584 while (item != NULL) {
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1585 const char *jid = xmlnode_get_attrib(item, "jid");
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1586
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1587 purple_privacy_deny_add(account, jid, TRUE);
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1588 item = xmlnode_get_next_twin(item);
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1589 }
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1590 }
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1591
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1592 void jabber_request_block_list(JabberStream *js)
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1593 {
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1594 JabberIq *iq;
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1595 xmlnode *blocklist;
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1596
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1597 iq = jabber_iq_new(js, JABBER_IQ_GET);
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1598
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1599 blocklist = xmlnode_new_child(iq->node, "blocklist");
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1600 xmlnode_set_namespace(blocklist, "urn:xmpp:blocking");
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1601
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1602 jabber_iq_set_callback(iq, jabber_blocklist_parse, NULL);
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1603
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1604 jabber_iq_send(iq);
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1605 }
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1606
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1607 void jabber_add_deny(PurpleConnection *gc, const char *who)
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1608 {
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1609 JabberStream *js;
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1610 JabberIq *iq;
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1611 xmlnode *block, *item;
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1612
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1613 js = gc->proto_data;
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1614 if (js == NULL)
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1615 return;
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1616
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1617 if (js->server_caps & JABBER_CAP_GOOGLE_ROSTER)
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1618 {
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1619 jabber_google_roster_add_deny(gc, who);
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1620 return;
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1621 }
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1622
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1623 if (!(js->server_caps & JABBER_CAP_BLOCKING))
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1624 {
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1625 purple_notify_error(NULL, _("Server doesn't support blocking"),
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1626 _("Server doesn't support blocking"), NULL);
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1627 return;
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1628 }
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1629
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1630 iq = jabber_iq_new(js, JABBER_IQ_SET);
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1631
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1632 block = xmlnode_new_child(iq->node, "block");
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1633 xmlnode_set_namespace(block, "urn:xmpp:blocking");
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1634
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1635 item = xmlnode_new_child(block, "item");
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1636 xmlnode_set_attrib(item, "jid", who);
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1637
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1638 jabber_iq_send(iq);
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1639 }
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1640
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1641 void jabber_rem_deny(PurpleConnection *gc, const char *who)
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1642 {
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1643 JabberStream *js;
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1644 JabberIq *iq;
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1645 xmlnode *unblock, *item;
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1646
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1647 js = gc->proto_data;
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1648 if (js == NULL)
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1649 return;
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1650
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1651 if (js->server_caps & JABBER_CAP_GOOGLE_ROSTER)
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1652 {
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1653 jabber_google_roster_rem_deny(gc, who);
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1654 return;
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1655 }
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1656
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1657 if (!(js->server_caps & JABBER_CAP_BLOCKING))
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1658 return;
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1659
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1660 iq = jabber_iq_new(js, JABBER_IQ_SET);
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1661
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1662 unblock = xmlnode_new_child(iq->node, "unblock");
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1663 xmlnode_set_namespace(unblock, "urn:xmpp:blocking");
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1664
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1665 item = xmlnode_new_child(unblock, "item");
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1666 xmlnode_set_attrib(item, "jid", who);
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1667
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1668 jabber_iq_send(iq);
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1669 }
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 24772
diff changeset
1670
25575
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1671 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
1672 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
1673
ab38146f8f78 There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19999
diff changeset
1674 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
1675
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
1676 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
1677 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
1678 feat->is_enabled = cb;
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
1679
17572
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1680 /* 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
1681 jabber_remove_feature(namespace);
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
1682
17572
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1683 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
1684 }
95affacf6f82 Added the ability to define extensions to caps
Andreas Monitzer <pidgin@monitzer.com>
parents: 17562
diff changeset
1685
25575
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1686 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
1687 GList *feature;
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1688 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
1689 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
1690 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
1691 g_free(feat->namespace);
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1692 g_free(feature->data);
21538
4e5bef6c3379 Fix #3669
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21418
diff changeset
1693 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
1694 break;
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1695 }
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17568
diff changeset
1696 }
17563
95affacf6f82 Added the ability to define extensions to caps
Andreas Monitzer <pidgin@monitzer.com>
parents: 17562
diff changeset
1697 }
95affacf6f82 Added the ability to define extensions to caps
Andreas Monitzer <pidgin@monitzer.com>
parents: 17562
diff changeset
1698
25763
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1699 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
1700 {
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1701 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
1702 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
1703 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
1704 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
1705 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
1706 }
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1707 }
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1708
25760
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
1709 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
1710 GList *identity;
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1711 JabberIdentity *ident;
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1712 /* 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
1713 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
1714 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
1715
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1716 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
1717 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
1718 if (!strcmp(ident->category, category) &&
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
1719 !strcmp(ident->type, type) &&
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
1720 ((!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
1721 return;
25575
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1722 }
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1723 }
25760
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
1724
25575
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1725 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
1726 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
1727 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
1728 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
1729 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
1730 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
1731 }
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
1732
25763
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1733 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
1734 {
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1735 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
1736 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
1737 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
1738 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
1739 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
1740 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
1741 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
1742 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
1743 }
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1744 }
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
1745
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
1746 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
1747 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1748 return "jabber";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1749 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1750
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
1751 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
1752 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1753 JabberStream *js;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1754 JabberBuddy *jb = NULL;
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23988
diff changeset
1755 PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(b));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1756
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23988
diff changeset
1757 if(!gc)
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15463
diff changeset
1758 return NULL;
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15463
diff changeset
1759
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23988
diff changeset
1760 js = gc->proto_data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1761 if(js)
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23988
diff changeset
1762 jb = jabber_buddy_find(js, purple_buddy_get_name(b), FALSE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1763
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1764 if(!PURPLE_BUDDY_IS_ONLINE(b)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1765 if(jb && (jb->subscription & JABBER_SUB_PENDING ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1766 !(jb->subscription & JABBER_SUB_TO)))
15463
0b6f337a46d5 Emblems in the blist
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
1767 return "not-authorized";
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1768 }
15463
0b6f337a46d5 Emblems in the blist
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
1769 return NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1770 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1771
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
1772 char *jabber_status_text(PurpleBuddy *b)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1773 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1774 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
1775 JabberBuddy *jb = NULL;
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23988
diff changeset
1776 PurpleAccount *account = purple_buddy_get_account(b);
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23988
diff changeset
1777 PurpleConnection *gc = purple_account_get_connection(account);
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23988
diff changeset
1778
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23988
diff changeset
1779 if (gc && gc->proto_data)
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23988
diff changeset
1780 jb = jabber_buddy_find(gc->proto_data, purple_buddy_get_name(b), FALSE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1781
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1782 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
1783 ret = g_strdup(_("Not Authorized"));
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1784 } 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
1785 ret = g_strdup(jb->error_msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1786 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1787 char *stripped;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1788
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1789 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
1790 PurplePresence *presence = purple_buddy_get_presence(b);
c97e3ab9ef11 Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents: 20570
diff changeset
1791 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
1792 PurpleStatus *status = purple_presence_get_status(presence, "tune");
c97e3ab9ef11 Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents: 20570
diff changeset
1793 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
1794 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1795 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1796
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1797 if(stripped) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1798 ret = g_markup_escape_text(stripped, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1799 g_free(stripped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1800 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1801 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1802
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1803 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1804 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1805
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
1806 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
1807 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1808 JabberBuddy *jb;
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23988
diff changeset
1809 PurpleAccount *account;
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23988
diff changeset
1810 PurpleConnection *gc;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1811
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1812 g_return_if_fail(b != NULL);
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23988
diff changeset
1813
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23988
diff changeset
1814 account = purple_buddy_get_account(b);
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23988
diff changeset
1815 g_return_if_fail(account != NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1816
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23988
diff changeset
1817 gc = purple_account_get_connection(account);
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23988
diff changeset
1818 g_return_if_fail(gc != NULL);
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23988
diff changeset
1819 g_return_if_fail(gc->proto_data != NULL);
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23988
diff changeset
1820
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23988
diff changeset
1821 jb = jabber_buddy_find(gc->proto_data, purple_buddy_get_name(b), FALSE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1822
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1823 if(jb) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1824 JabberBuddyResource *jbr = NULL;
20571
c97e3ab9ef11 Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents: 20570
diff changeset
1825 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
1826 const char *sub;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1827 GList *l;
19722
eedf2918aace Don't put "Mood: \(null\) \(null\)" on XMPP buddies
Sean Egan <seanegan@gmail.com>
parents: 19696
diff changeset
1828 const char *mood;
15374
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 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
1831 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
1832
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1833 if(jb->subscription & JABBER_SUB_FROM) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1834 if(jb->subscription & JABBER_SUB_TO)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1835 sub = _("Both");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1836 else if(jb->subscription & JABBER_SUB_PENDING)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1837 sub = _("From (To pending)");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1838 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1839 sub = _("From");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1840 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1841 if(jb->subscription & JABBER_SUB_TO)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1842 sub = _("To");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1843 else if(jb->subscription & JABBER_SUB_PENDING)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1844 sub = _("None (To pending)");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1845 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1846 sub = _("None");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1847 }
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
1848
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1849 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
1850
20571
c97e3ab9ef11 Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents: 20570
diff changeset
1851 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
1852 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
1853 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
1854 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
1855 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
1856 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
1857 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
1858
17573
2f067d8fb19a Fixed a few small mistakes I discovered while testing user mood in Adium.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17572
diff changeset
1859 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
1860 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
1861 } else
2f067d8fb19a Fixed a few small mistakes I discovered while testing user mood in Adium.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17572
diff changeset
1862 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
1863 }
22000
af0426c34c27 Utility functions to set and format song information. Closes #4398.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21978
diff changeset
1864 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
1865 PurpleStatus *tune = purple_presence_get_status(presence, "tune");
c97e3ab9ef11 Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents: 20570
diff changeset
1866 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
1867 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
1868 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
1869 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
1870 if (playing) {
af0426c34c27 Utility functions to set and format song information. Closes #4398.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21978
diff changeset
1871 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
1872 g_free(playing);
af0426c34c27 Utility functions to set and format song information. Closes #4398.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21978
diff changeset
1873 }
20571
c97e3ab9ef11 Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents: 20570
diff changeset
1874 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1875 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1876
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1877 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
1878 char *text = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1879 char *res = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1880 char *label, *value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1881 const char *state;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1882
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1883 jbr = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1884
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1885 if(jbr->status) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1886 char *tmp;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1887 text = purple_strreplace(jbr->status, "\n", "<br />\n");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1888 tmp = purple_markup_strip_html(text);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1889 g_free(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1890 text = g_markup_escape_text(tmp, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1891 g_free(tmp);
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 if(jbr->name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1895 res = g_strdup_printf(" (%s)", jbr->name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1896
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1897 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
1898 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
1899 g_free(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1900 text = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1901 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1902
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1903 label = g_strdup_printf("%s%s",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1904 _("Status"), (res ? res : ""));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1905 value = g_strdup_printf("%s%s%s",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1906 state,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1907 (text ? ": " : ""),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1908 (text ? text : ""));
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 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
1911
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1912 g_free(label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1913 g_free(value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1914 g_free(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1915 g_free(res);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1916 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1917
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1918 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
1919 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
1920 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1921 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1922 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1923
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
1924 GList *jabber_status_types(PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1925 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1926 PurpleStatusType *type;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1927 GList *types = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1928 PurpleValue *priority_value;
24122
04d8a514d2bb Updated support for XEP-0224.
Marcus Lundblad <ml@update.uu.se>
parents: 23988
diff changeset
1929 PurpleValue *buzz_enabled;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1930
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1931 priority_value = purple_value_new(PURPLE_TYPE_INT);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1932 purple_value_set_int(priority_value, 1);
24122
04d8a514d2bb Updated support for XEP-0224.
Marcus Lundblad <ml@update.uu.se>
parents: 23988
diff changeset
1933 buzz_enabled = purple_value_new(PURPLE_TYPE_BOOLEAN);
04d8a514d2bb Updated support for XEP-0224.
Marcus Lundblad <ml@update.uu.se>
parents: 23988
diff changeset
1934 purple_value_set_boolean(buzz_enabled, TRUE);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1935 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
1936 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
1937 NULL, TRUE, TRUE, FALSE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1938 "priority", _("Priority"), priority_value,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1939 "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
1940 "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
1941 "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
1942 "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING),
24122
04d8a514d2bb Updated support for XEP-0224.
Marcus Lundblad <ml@update.uu.se>
parents: 23988
diff changeset
1943 "buzz", _("Allow Buzz"), buzz_enabled,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1944 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1945 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1946
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1947 priority_value = purple_value_new(PURPLE_TYPE_INT);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1948 purple_value_set_int(priority_value, 1);
24707
7b93616f7982 Patch from Darkrain42 to avoid a double-free on status values
Marcus Lundblad <ml@update.uu.se>
parents: 24705
diff changeset
1949 buzz_enabled = purple_value_new(PURPLE_TYPE_BOOLEAN);
7b93616f7982 Patch from Darkrain42 to avoid a double-free on status values
Marcus Lundblad <ml@update.uu.se>
parents: 24705
diff changeset
1950 purple_value_set_boolean(buzz_enabled, TRUE);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1951 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
1952 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
1953 _("Chatty"), TRUE, TRUE, FALSE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1954 "priority", _("Priority"), priority_value,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1955 "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
1956 "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
1957 "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
1958 "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING),
24122
04d8a514d2bb Updated support for XEP-0224.
Marcus Lundblad <ml@update.uu.se>
parents: 23988
diff changeset
1959 "buzz", _("Allow Buzz"), buzz_enabled,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1960 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1961 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1962
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1963 priority_value = purple_value_new(PURPLE_TYPE_INT);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1964 purple_value_set_int(priority_value, 0);
24707
7b93616f7982 Patch from Darkrain42 to avoid a double-free on status values
Marcus Lundblad <ml@update.uu.se>
parents: 24705
diff changeset
1965 buzz_enabled = purple_value_new(PURPLE_TYPE_BOOLEAN);
7b93616f7982 Patch from Darkrain42 to avoid a double-free on status values
Marcus Lundblad <ml@update.uu.se>
parents: 24705
diff changeset
1966 purple_value_set_boolean(buzz_enabled, TRUE);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1967 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
1968 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
1969 NULL, TRUE, TRUE, FALSE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1970 "priority", _("Priority"), priority_value,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1971 "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
1972 "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
1973 "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
1974 "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING),
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
1975 "buzz", _("Allow Buzz"), buzz_enabled,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1976 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1977 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1978
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1979 priority_value = purple_value_new(PURPLE_TYPE_INT);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1980 purple_value_set_int(priority_value, 0);
24707
7b93616f7982 Patch from Darkrain42 to avoid a double-free on status values
Marcus Lundblad <ml@update.uu.se>
parents: 24705
diff changeset
1981 buzz_enabled = purple_value_new(PURPLE_TYPE_BOOLEAN);
7b93616f7982 Patch from Darkrain42 to avoid a double-free on status values
Marcus Lundblad <ml@update.uu.se>
parents: 24705
diff changeset
1982 purple_value_set_boolean(buzz_enabled, TRUE);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1983 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
1984 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
1985 NULL, TRUE, TRUE, FALSE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1986 "priority", _("Priority"), priority_value,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1987 "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
1988 "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
1989 "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
1990 "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING),
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
1991 "buzz", _("Allow Buzz"), buzz_enabled,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1992 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1993 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1994
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1995 priority_value = purple_value_new(PURPLE_TYPE_INT);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1996 purple_value_set_int(priority_value, 0);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
1997 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
1998 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
1999 _("Do Not Disturb"), TRUE, TRUE, FALSE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2000 "priority", _("Priority"), priority_value,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2001 "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
2002 "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
2003 "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
2004 "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2005 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2006 types = g_list_append(types, type);
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 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2009 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
2010 m = g_list_append(m, _("Invisible"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2011 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2012
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2013 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
2014 jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_UNAVAILABLE),
25050
b5c82724598c For some reason, all these statuses were set to saveable=FALSE. With the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24858
diff changeset
2015 NULL, TRUE, TRUE, FALSE,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2016 "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
2017 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2018 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2019
20570
5913725cbcd6 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20076
diff changeset
2020 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
2021 "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
2022 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
2023 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
2024 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
2025 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
2026 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
2027 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
2028 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
2029 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
2030 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
2031 NULL);
5913725cbcd6 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20076
diff changeset
2032 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
2033
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2034 return types;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2035 }
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 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2038 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
2039 gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2040 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2041 const char *type;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2042
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2043 type = xmlnode_get_attrib(packet, "type");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2044
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2045 if(type && !strcmp(type, "result")) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2046 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
2047 _("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
2048
647b841ea945 This patch prevents changing the saved account password for XMPP accounts
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21000
diff changeset
2049 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
2050 } 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
2051 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
2052
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2053 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
2054 _("Error changing password"), msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2055 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2056 }
21058
647b841ea945 This patch prevents changing the saved account password for XMPP accounts
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21000
diff changeset
2057
647b841ea945 This patch prevents changing the saved account password for XMPP accounts
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21000
diff changeset
2058 g_free(data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2059 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2060
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2061 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
2062 PurpleRequestFields *fields)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2063 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2064 const char *p1, *p2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2065 JabberIq *iq;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2066 xmlnode *query, *y;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2067
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2068 p1 = purple_request_fields_get_string(fields, "password1");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2069 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
2070
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2071 if(strcmp(p1, p2)) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2072 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
2073 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2074 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2075
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2076 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
2077
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2078 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
2079
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2080 query = xmlnode_get_child(iq->node, "query");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2081
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2082 y = xmlnode_new_child(query, "username");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2083 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
2084 y = xmlnode_new_child(query, "password");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2085 xmlnode_insert_data(y, p1, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2086
21058
647b841ea945 This patch prevents changing the saved account password for XMPP accounts
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21000
diff changeset
2087 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
2088
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2089 jabber_iq_send(iq);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2090 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2091
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2092 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
2093 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2094
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2095 PurpleConnection *gc = (PurpleConnection *) action->context;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2096 JabberStream *js = gc->proto_data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2097 PurpleRequestFields *fields;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2098 PurpleRequestFieldGroup *group;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2099 PurpleRequestField *field;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2100
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2101 fields = purple_request_fields_new();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2102 group = purple_request_field_group_new(NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2103 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
2104
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2105 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
2106 "", FALSE);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2107 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
2108 purple_request_field_set_required(field, TRUE);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2109 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
2110
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2111 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
2112 "", FALSE);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2113 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
2114 purple_request_field_set_required(field, TRUE);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2115 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
2116
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
2117 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
2118 _("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
2119 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
2120 _("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
2121 purple_connection_get_account(gc), NULL, NULL,
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
2122 js);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2123 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2124
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
2125 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
2126 {
17575
5fc8a8a25008 Implemented a mood menu action (non-functional right now for some reason)
Andreas Monitzer <pidgin@monitzer.com>
parents: 17573
diff changeset
2127 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
2128 JabberStream *js = gc->proto_data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2129 GList *m = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2130 PurplePluginAction *act;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2131
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2132 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
2133 jabber_setup_set_info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2134 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2135
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2136 /* if (js->protocol_options & CHANGE_PASSWORD) { */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2137 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
2138 jabber_password_change);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2139 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2140 /* } */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2141
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2142 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
2143 jabber_user_search_begin);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2144 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2145
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
2146 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
2147
17575
5fc8a8a25008 Implemented a mood menu action (non-functional right now for some reason)
Andreas Monitzer <pidgin@monitzer.com>
parents: 17573
diff changeset
2148 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
2149 jabber_pep_init_actions(&m);
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
2150
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
2151 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
2152 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
2153
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2154 return m;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2155 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2156
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
2157 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
2158 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2159 PurpleBlistNode *gnode, *cnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2160 JabberID *jid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2161
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2162 if(!(jid = jabber_id_new(name)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2163 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2164
25289
aa876d48b5b2 Some more struct hiding.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24294
diff changeset
2165 for(gnode = purple_blist_get_root(); gnode;
aa876d48b5b2 Some more struct hiding.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24294
diff changeset
2166 gnode = purple_blist_node_get_sibling_next(gnode)) {
aa876d48b5b2 Some more struct hiding.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24294
diff changeset
2167 for(cnode = purple_blist_node_get_first_child(gnode);
aa876d48b5b2 Some more struct hiding.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24294
diff changeset
2168 cnode;
aa876d48b5b2 Some more struct hiding.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24294
diff changeset
2169 cnode = purple_blist_node_get_sibling_next(cnode)) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2170 PurpleChat *chat = (PurpleChat*)cnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2171 const char *room, *server;
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23988
diff changeset
2172 GHashTable *components;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2173 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
2174 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2175
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23988
diff changeset
2176 if (purple_chat_get_account(chat) != account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2177 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2178
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23988
diff changeset
2179 components = purple_chat_get_components(chat);
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23988
diff changeset
2180 if(!(room = g_hash_table_lookup(components, "room")))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2181 continue;
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23988
diff changeset
2182 if(!(server = g_hash_table_lookup(components, "server")))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2183 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2184
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2185 if(jid->node && jid->domain &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2186 !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
2187 jabber_id_free(jid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2188 return chat;
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2192 jabber_id_free(jid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2193 return NULL;
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
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
2196 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
2197 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2198 JabberStream *js = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2199 JabberID *jid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2200 JabberBuddy *jb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2201 JabberBuddyResource *jbr;
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
2202
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2203 if(!(jid = jabber_id_new(who)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2204 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2205
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2206 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
2207 (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
2208 if(jbr->thread_id) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2209 g_free(jbr->thread_id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2210 jbr->thread_id = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2211 }
15648
193456f03b9c Sending XEP 85 'gone' messages
Sean Egan <seanegan@gmail.com>
parents: 15607
diff changeset
2212 if(jbr->chat_states == JABBER_CHAT_STATES_SUPPORTED)
193456f03b9c Sending XEP 85 'gone' messages
Sean Egan <seanegan@gmail.com>
parents: 15607
diff changeset
2213 jabber_message_conv_closed(js, who);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2216 jabber_id_free(jid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2217 }
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
20814
bde477ec6a71 Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents: 20792
diff changeset
2220 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
2221 xmlnode *packet,
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
2222 PurpleConnectionError *reason)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2223 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2224 xmlnode *error;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2225 const char *code = NULL, *text = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2226 const char *xmlns = xmlnode_get_namespace(packet);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2227 char *cdata = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2228
20814
bde477ec6a71 Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents: 20792
diff changeset
2229 #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
2230 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
2231
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2232 if((error = xmlnode_get_child(packet, "error"))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2233 cdata = xmlnode_get_data(error);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2234 code = xmlnode_get_attrib(error, "code");
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 /* Stanza errors */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2237 if(xmlnode_get_child(error, "bad-request")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2238 text = _("Bad Request");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2239 } else if(xmlnode_get_child(error, "conflict")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2240 text = _("Conflict");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2241 } 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
2242 text = _("Feature Not Implemented");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2243 } else if(xmlnode_get_child(error, "forbidden")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2244 text = _("Forbidden");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2245 } else if(xmlnode_get_child(error, "gone")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2246 text = _("Gone");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2247 } 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
2248 text = _("Internal Server Error");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2249 } 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
2250 text = _("Item Not Found");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2251 } 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
2252 text = _("Malformed XMPP ID");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2253 } 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
2254 text = _("Not Acceptable");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2255 } 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
2256 text = _("Not Allowed");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2257 } 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
2258 text = _("Not Authorized");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2259 } 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
2260 text = _("Payment Required");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2261 } 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
2262 text = _("Recipient Unavailable");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2263 } else if(xmlnode_get_child(error, "redirect")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2264 /* XXX */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2265 } 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
2266 text = _("Registration Required");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2267 } 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
2268 text = _("Remote Server Not Found");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2269 } 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
2270 text = _("Remote Server Timeout");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2271 } 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
2272 text = _("Server Overloaded");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2273 } 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
2274 text = _("Service Unavailable");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2275 } 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
2276 text = _("Subscription Required");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2277 } 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
2278 text = _("Unexpected Request");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2279 } 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
2280 text = _("Unknown Error");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2281 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2282 } 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
2283 /* 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
2284 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
2285 if(xmlnode_get_child(packet, "aborted")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2286 text = _("Authorization Aborted");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2287 } 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
2288 text = _("Incorrect encoding in authorization");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2289 } 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
2290 text = _("Invalid authzid");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2291 } 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
2292 text = _("Invalid Authorization Mechanism");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2293 } 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
2294 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
2295 text = _("Authorization mechanism too weak");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2296 } 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
2297 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
2298 /* 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
2299 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
2300 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
2301 text = _("Not Authorized");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2302 } 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
2303 text = _("Temporary Authentication Failure");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2304 } 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
2305 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
2306 text = _("Authentication Failure");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2307 }
15918
4be5d38ee117 Correctly handle the Jabber disconnection error for signing onto the
Mark Doliner <mark@kingant.net>
parents: 15916
diff changeset
2308 } 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
2309 (!strcmp(packet->name, "error") && xmlns &&
15919
26593bef6568 Minor code cleanup
Mark Doliner <mark@kingant.net>
parents: 15918
diff changeset
2310 !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
2311 /* Most common reason as default: */
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
2312 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
2313 if(xmlnode_get_child(packet, "bad-format")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2314 text = _("Bad Format");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2315 } 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
2316 text = _("Bad Namespace Prefix");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2317 } else if(xmlnode_get_child(packet, "conflict")) {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 21355
diff changeset
2318 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
2319 text = _("Resource Conflict");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2320 } 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
2321 text = _("Connection Timeout");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2322 } 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
2323 text = _("Host Gone");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2324 } 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
2325 text = _("Host Unknown");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2326 } 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
2327 text = _("Improper Addressing");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2328 } 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
2329 text = _("Internal Server Error");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2330 } 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
2331 text = _("Invalid ID");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2332 } 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
2333 text = _("Invalid Namespace");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2334 } 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
2335 text = _("Invalid XML");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2336 } 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
2337 text = _("Non-matching Hosts");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2338 } 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
2339 text = _("Not Authorized");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2340 } 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
2341 text = _("Policy Violation");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2342 } 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
2343 text = _("Remote Connection Failed");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2344 } 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
2345 text = _("Resource Constraint");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2346 } 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
2347 text = _("Restricted XML");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2348 } 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
2349 text = _("See Other Host");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2350 } 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
2351 text = _("System Shutdown");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2352 } 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
2353 text = _("Undefined Condition");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2354 } 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
2355 text = _("Unsupported Encoding");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2356 } 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
2357 text = _("Unsupported Stanza Type");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2358 } 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
2359 text = _("Unsupported Version");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2360 } 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
2361 text = _("XML Not Well Formed");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2362 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2363 text = _("Stream Error");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2364 }
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
20814
bde477ec6a71 Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents: 20792
diff changeset
2367 #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
2368
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2369 if(text || cdata) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2370 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
2371 code ? ": " : "", text ? text : cdata);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2372 g_free(cdata);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2373 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2374 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2375 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2376 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2377 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2378
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2379 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
2380 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
2381 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2382 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
2383
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2384 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
2385 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
2386
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2387 jabber_chat_request_room_configure(chat);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2388 return PURPLE_CMD_RET_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2389 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2390
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2391 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
2392 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
2393 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2394 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
2395
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2396 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
2397 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
2398
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2399 jabber_chat_register(chat);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2400 return PURPLE_CMD_RET_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2401 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2402
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2403 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
2404 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
2405 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2406 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
2407
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2408 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
2409 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
2410
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2411 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
2412 return PURPLE_CMD_RET_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2413 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2414
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2415 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
2416 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
2417 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2418 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
2419
18711
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2420 if(!chat || !args || !args[0])
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2421 return PURPLE_CMD_RET_FAILED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2422
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2423 jabber_chat_change_nick(chat, args[0]);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2424 return PURPLE_CMD_RET_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2425 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2426
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2427 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
2428 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
2429 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2430 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
2431
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2432 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
2433 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
2434
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2435 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
2436 return PURPLE_CMD_RET_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2437 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2438
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2439 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
2440 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
2441 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2442 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
2443
18711
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2444 if(!chat || !args || !args[0])
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2445 return PURPLE_CMD_RET_FAILED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2446
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2447 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
2448 *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
2449 return PURPLE_CMD_RET_FAILED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2450 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2451
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2452 return PURPLE_CMD_RET_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2453 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2454
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2455 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
2456 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
2457 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2458 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
2459
18711
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2460 if (!chat || !args || !args[0] || !args[1])
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2461 return PURPLE_CMD_RET_FAILED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2462
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
2463 if (strcmp(args[1], "owner") != 0 &&
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2464 strcmp(args[1], "admin") != 0 &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2465 strcmp(args[1], "member") != 0 &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2466 strcmp(args[1], "outcast") != 0 &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2467 strcmp(args[1], "none") != 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2468 *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
2469 return PURPLE_CMD_RET_FAILED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2470 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2471
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2472 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
2473 *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
2474 return PURPLE_CMD_RET_FAILED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2475 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2476
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2477 return PURPLE_CMD_RET_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2478 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2479
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2480 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
2481 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
2482 {
18855
28a7c9dbbc2b Fix uninitialized variable access.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18711
diff changeset
2483 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
2484
18711
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2485 if (!chat || !args || !args[0] || !args[1])
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2486 return PURPLE_CMD_RET_FAILED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2487
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2488 if (strcmp(args[1], "moderator") != 0 &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2489 strcmp(args[1], "participant") != 0 &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2490 strcmp(args[1], "visitor") != 0 &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2491 strcmp(args[1], "none") != 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2492 *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
2493 return PURPLE_CMD_RET_FAILED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2494 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2495
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2496 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
2497 *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
2498 args[1], args[0]);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2499 return PURPLE_CMD_RET_FAILED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2500 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2501
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2502 return PURPLE_CMD_RET_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2503 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2504
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2505 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
2506 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
2507 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2508 if(!args || !args[0])
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2509 return PURPLE_CMD_RET_FAILED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2510
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2511 jabber_chat_invite(purple_conversation_get_gc(conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2512 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
2513 args[0]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2514
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2515 return PURPLE_CMD_RET_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2516 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2517
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2518 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
2519 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
2520 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2521 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
2522 GHashTable *components;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2523
18711
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2524 if(!chat || !args || !args[0])
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2525 return PURPLE_CMD_RET_FAILED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2526
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2527 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
2528
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2529 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
2530 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
2531 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
2532 if(args[1])
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2533 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
2534
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2535 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
2536
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2537 g_hash_table_destroy(components);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2538 return PURPLE_CMD_RET_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2539 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2540
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2541 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
2542 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
2543 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2544 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
2545
18711
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2546 if(!chat || !args || !args[0])
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2547 return PURPLE_CMD_RET_FAILED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2548
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2549 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
2550 *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
2551 return PURPLE_CMD_RET_FAILED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2552 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2553
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2554 return PURPLE_CMD_RET_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2555 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2556
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2557 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
2558 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
2559 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2560 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
2561 char *who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2562
18711
259f8635eeff Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents: 18323
diff changeset
2563 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
2564 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
2565
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2566 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
2567
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2568 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
2569
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2570 g_free(who);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2571 return PURPLE_CMD_RET_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2572 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2573
17562
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
2574 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
2575 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
2576 {
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
2577 if(!args || !args[0])
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
2578 return PURPLE_CMD_RET_FAILED;
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
2579
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
2580 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
2581 *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
2582 return PURPLE_CMD_RET_FAILED;
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
2583 }
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
2584
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
2585 return PURPLE_CMD_RET_OK;
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
2586 }
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
2587
20852
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2588 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
2589
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2590 JabberBuddy *jb;
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2591 JabberBuddyResource *jbr;
24153
a64d90cff01f Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <ml@update.uu.se>
parents: 24123
diff changeset
2592 PurpleConnection *gc = js->gc;
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
2593 PurpleBuddy *buddy =
25199
3f4bedafc86e Print alias (if known) in some error/info messages when failing to buzz
Marcus Lundblad <ml@update.uu.se>
parents: 25197
diff changeset
2594 purple_find_buddy(purple_connection_get_account(gc), username);
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
2595 const gchar *alias =
25199
3f4bedafc86e Print alias (if known) in some error/info messages when failing to buzz
Marcus Lundblad <ml@update.uu.se>
parents: 25197
diff changeset
2596 buddy ? purple_buddy_get_contact_alias(buddy) : username;
20852
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2597
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2598 if(!username)
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2599 return FALSE;
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2600
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2601 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
2602 if(!jb) {
25199
3f4bedafc86e Print alias (if known) in some error/info messages when failing to buzz
Marcus Lundblad <ml@update.uu.se>
parents: 25197
diff changeset
2603 *error = g_strdup_printf(_("Unable to buzz, because there is nothing "
3f4bedafc86e Print alias (if known) in some error/info messages when failing to buzz
Marcus Lundblad <ml@update.uu.se>
parents: 25197
diff changeset
2604 "known about %s."), alias);
20852
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2605 return FALSE;
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2606 }
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2607
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2608 jbr = jabber_buddy_find_resource(jb, NULL);
24153
a64d90cff01f Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <ml@update.uu.se>
parents: 24123
diff changeset
2609 if (!jbr) {
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
2610 *error = g_strdup_printf(_("Unable to buzz, because %s might be offline."),
25199
3f4bedafc86e Print alias (if known) in some error/info messages when failing to buzz
Marcus Lundblad <ml@update.uu.se>
parents: 25197
diff changeset
2611 alias);
20852
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2612 return FALSE;
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2613 }
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2614
24153
a64d90cff01f Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <ml@update.uu.se>
parents: 24123
diff changeset
2615 if (jabber_resource_has_capability(jbr, XEP_0224_NAMESPACE)) {
25770
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2616 xmlnode *buzz, *msg = xmlnode_new("message");
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2617 gchar *to;
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2618
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2619 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
2620 xmlnode_set_attrib(msg, "to", to);
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2621 g_free(to);
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2622
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2623 /* avoid offline storage */
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2624 xmlnode_set_attrib(msg, "type", "headline");
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2625
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2626 buzz = xmlnode_new_child(msg, "attention");
24153
a64d90cff01f Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <ml@update.uu.se>
parents: 24123
diff changeset
2627 xmlnode_set_namespace(buzz, XEP_0224_NAMESPACE);
25770
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2628
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2629 jabber_send(js, msg);
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2630 xmlnode_free(msg);
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2631
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2632 return TRUE;
24153
a64d90cff01f Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <ml@update.uu.se>
parents: 24123
diff changeset
2633 } else {
25199
3f4bedafc86e Print alias (if known) in some error/info messages when failing to buzz
Marcus Lundblad <ml@update.uu.se>
parents: 25197
diff changeset
2634 *error = g_strdup_printf(_("Unable to buzz, because %s does "
3f4bedafc86e Print alias (if known) in some error/info messages when failing to buzz
Marcus Lundblad <ml@update.uu.se>
parents: 25197
diff changeset
2635 "not support it or do not wish to receive buzzes now."), alias);
24153
a64d90cff01f Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <ml@update.uu.se>
parents: 24123
diff changeset
2636 return FALSE;
20852
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2637 }
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2638 }
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2639
17615
cca457b9158b disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents: 17614
diff changeset
2640 static PurpleCmdRet jabber_cmd_buzz(PurpleConversation *conv,
cca457b9158b disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents: 17614
diff changeset
2641 const char *cmd, char **args, char **error, void *data)
cca457b9158b disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents: 17614
diff changeset
2642 {
cca457b9158b disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents: 17614
diff changeset
2643 JabberStream *js = conv->account->gc->proto_data;
24153
a64d90cff01f Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <ml@update.uu.se>
parents: 24123
diff changeset
2644 const gchar *who;
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
2645
24153
a64d90cff01f Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <ml@update.uu.se>
parents: 24123
diff changeset
2646 if (!args || !args[0]) {
a64d90cff01f Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <ml@update.uu.se>
parents: 24123
diff changeset
2647 /* use the buddy from conversation, if it's a one-to-one conversation */
a64d90cff01f Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <ml@update.uu.se>
parents: 24123
diff changeset
2648 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
a64d90cff01f Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <ml@update.uu.se>
parents: 24123
diff changeset
2649 who = purple_conversation_get_name(conv);
a64d90cff01f Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <ml@update.uu.se>
parents: 24123
diff changeset
2650 } else {
a64d90cff01f Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <ml@update.uu.se>
parents: 24123
diff changeset
2651 return PURPLE_CMD_RET_FAILED;
a64d90cff01f Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <ml@update.uu.se>
parents: 24123
diff changeset
2652 }
a64d90cff01f Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <ml@update.uu.se>
parents: 24123
diff changeset
2653 } else {
a64d90cff01f Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <ml@update.uu.se>
parents: 24123
diff changeset
2654 who = args[0];
a64d90cff01f Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <ml@update.uu.se>
parents: 24123
diff changeset
2655 }
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
2656
25197
8dee1fb9d8e9 Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <ml@update.uu.se>
parents: 25196
diff changeset
2657 if (_jabber_send_buzz(js, who, error)) {
8dee1fb9d8e9 Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <ml@update.uu.se>
parents: 25196
diff changeset
2658 const gchar *alias;
25199
3f4bedafc86e Print alias (if known) in some error/info messages when failing to buzz
Marcus Lundblad <ml@update.uu.se>
parents: 25197
diff changeset
2659 gchar *str;
25197
8dee1fb9d8e9 Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <ml@update.uu.se>
parents: 25196
diff changeset
2660 PurpleBuddy *buddy =
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
2661 purple_find_buddy(purple_connection_get_account(conv->account->gc),
25197
8dee1fb9d8e9 Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <ml@update.uu.se>
parents: 25196
diff changeset
2662 who);
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
2663
25197
8dee1fb9d8e9 Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <ml@update.uu.se>
parents: 25196
diff changeset
2664 if (buddy != NULL)
8dee1fb9d8e9 Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <ml@update.uu.se>
parents: 25196
diff changeset
2665 alias = purple_buddy_get_contact_alias(buddy);
8dee1fb9d8e9 Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <ml@update.uu.se>
parents: 25196
diff changeset
2666 else
8dee1fb9d8e9 Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <ml@update.uu.se>
parents: 25196
diff changeset
2667 alias = who;
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
2668
25197
8dee1fb9d8e9 Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <ml@update.uu.se>
parents: 25196
diff changeset
2669 str = g_strdup_printf(_("Buzzing %s..."), alias);
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
2670 purple_conversation_write(conv, NULL, str,
25197
8dee1fb9d8e9 Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <ml@update.uu.se>
parents: 25196
diff changeset
2671 PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, time(NULL));
8dee1fb9d8e9 Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <ml@update.uu.se>
parents: 25196
diff changeset
2672 g_free(str);
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
2673
25197
8dee1fb9d8e9 Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <ml@update.uu.se>
parents: 25196
diff changeset
2674 return PURPLE_CMD_RET_OK;
8dee1fb9d8e9 Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <ml@update.uu.se>
parents: 25196
diff changeset
2675 } else {
17615
cca457b9158b disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents: 17614
diff changeset
2676 return PURPLE_CMD_RET_FAILED;
25197
8dee1fb9d8e9 Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <ml@update.uu.se>
parents: 25196
diff changeset
2677 }
17615
cca457b9158b disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents: 17614
diff changeset
2678 }
cca457b9158b disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents: 17614
diff changeset
2679
20149
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2680 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
2681 {
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2682 static GList *types = NULL;
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2683
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2684 if (!types) {
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22034
diff changeset
2685 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
2686 _("%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
2687 }
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2688
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2689 return types;
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2690 }
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2691
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2692 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
2693 {
20852
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2694 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
2695 gchar *error = NULL;
20149
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2696
20852
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2697 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
2698 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
2699 g_free(error);
20149
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2700 return FALSE;
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2701 }
20852
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2702
6cc03752fe59 Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20851
diff changeset
2703 return TRUE;
20149
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2704 }
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2705
be2538a92099 Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 20076
diff changeset
2706
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
2707 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
2708 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2709 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2710 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2711
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
2712 void jabber_register_commands(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2713 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2714 purple_cmd_register("config", "", PURPLE_CMD_P_PRPL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2715 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
2716 "prpl-jabber", jabber_cmd_chat_config,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2717 _("config: Configure a chat room."), NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2718 purple_cmd_register("configure", "", PURPLE_CMD_P_PRPL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2719 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
2720 "prpl-jabber", jabber_cmd_chat_config,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2721 _("configure: Configure a chat room."), NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2722 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
2723 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
2724 "prpl-jabber", jabber_cmd_chat_nick,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2725 _("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
2726 NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2727 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
2728 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
2729 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
2730 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
2731 NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2732 purple_cmd_register("register", "", PURPLE_CMD_P_PRPL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2733 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
2734 "prpl-jabber", jabber_cmd_chat_register,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2735 _("register: Register with a chat room."), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2736 /* 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
2737 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
2738 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
2739 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
2740 jabber_cmd_chat_topic,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2741 _("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
2742 NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2743 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
2744 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
2745 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
2746 jabber_cmd_chat_ban,
22602
9a84976c8e76 Correct some help strings for Jabber slash commands
Mark Doliner <mark@kingant.net>
parents: 22448
diff changeset
2747 _("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
2748 NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2749 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
2750 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
2751 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
2752 jabber_cmd_chat_affiliate,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2753 _("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
2754 NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2755 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
2756 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
2757 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
2758 jabber_cmd_chat_role,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2759 _("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
2760 NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2761 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
2762 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
2763 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
2764 jabber_cmd_chat_invite,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2765 _("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
2766 NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2767 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
2768 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
2769 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
2770 jabber_cmd_chat_join,
22602
9a84976c8e76 Correct some help strings for Jabber slash commands
Mark Doliner <mark@kingant.net>
parents: 22448
diff changeset
2771 _("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
2772 NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2773 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
2774 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
2775 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
2776 jabber_cmd_chat_kick,
22602
9a84976c8e76 Correct some help strings for Jabber slash commands
Mark Doliner <mark@kingant.net>
parents: 22448
diff changeset
2777 _("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
2778 NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15766
diff changeset
2779 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
2780 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
2781 "prpl-jabber", jabber_cmd_chat_msg,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2782 _("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
2783 NULL);
17562
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
2784 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
2785 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
2786 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
2787 "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
2788 _("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
2789 NULL);
24154
b3ab1c23cdf6 Register the /buzz command using PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS.
Marcus Lundblad <ml@update.uu.se>
parents: 24153
diff changeset
2790 purple_cmd_register("buzz", "w", PURPLE_CMD_P_PRPL,
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25442
diff changeset
2791 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY |
24154
b3ab1c23cdf6 Register the /buzz command using PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS.
Marcus Lundblad <ml@update.uu.se>
parents: 24153
diff changeset
2792 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS,
17615
cca457b9158b disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents: 17614
diff changeset
2793 "prpl-jabber", jabber_cmd_buzz,
cca457b9158b disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents: 17614
diff changeset
2794 _("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
2795 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2796
25760
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2797 /* IPC functions */
25587
2bf9bf49cea8 * adding documentation for IPC function contact_has_feature
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25586
diff changeset
2798
25760
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2799 /**
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2800 * 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
2801 *
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2802 * @param account The PurpleAccount
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2803 * @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
2804 * @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
2805 *
25587
2bf9bf49cea8 * adding documentation for IPC function contact_has_feature
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25586
diff changeset
2806 * @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
2807 */
25586
e6f92c0f9770 * adding IPC function 'contact_has_feature'
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25585
diff changeset
2808 static gboolean
25760
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2809 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
2810 const gchar *feature)
25586
e6f92c0f9770 * adding IPC function 'contact_has_feature'
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25585
diff changeset
2811 {
25760
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2812 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
2813 JabberStream *js;
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2814 JabberBuddy *jb;
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2815 JabberBuddyResource *jbr;
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2816 gchar *resource;
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2817
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2818 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
2819 return FALSE;
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2820 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
2821
25760
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2822 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
2823 !(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
2824 !(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
2825 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
2826 return FALSE;
25760
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2827 }
25747
504c98a90ef5 constify, ifdef out an old-caps remnant, and rewrite a little
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
2828
25760
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2829 g_free(resource);
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2830
25770
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25763
diff changeset
2831 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
2832 }
45816181b7de * fixing a bug in jabber_caps_compare()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25575
diff changeset
2833
25588
61f37abc8a70 * removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25587
diff changeset
2834 static void
25747
504c98a90ef5 constify, ifdef out an old-caps remnant, and rewrite a little
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
2835 jabber_ipc_add_feature(const gchar *feature)
25588
61f37abc8a70 * removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25587
diff changeset
2836 {
25747
504c98a90ef5 constify, ifdef out an old-caps remnant, and rewrite a little
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
2837 if (!feature)
504c98a90ef5 constify, ifdef out an old-caps remnant, and rewrite a little
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
2838 return;
25589
3f719eaa7fd1 * IPC work
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25588
diff changeset
2839 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
2840
504c98a90ef5 constify, ifdef out an old-caps remnant, and rewrite a little
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
2841 /* 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
2842 jabber_caps_broadcast_change();
25588
61f37abc8a70 * removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25587
diff changeset
2843 }
61f37abc8a70 * removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25587
diff changeset
2844
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
2845 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
2846 jabber_init_plugin(PurplePlugin *plugin)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2847 {
25575
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
2848 my_protocol = plugin;
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
2849
25760
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25747
diff changeset
2850 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
2851
25586
e6f92c0f9770 * adding IPC function 'contact_has_feature'
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25585
diff changeset
2852 /* 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
2853 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
2854 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
2855 jabber_add_feature("jabber:iq:time", 0);
25825
69495c6f12af Fix advertised capabilities (caps, chatstates, entity time)
Paul Aurich <paul@darkrain42.org>
parents: 25824
diff changeset
2856 jabber_add_feature("urn:xmpp:time", 0);
25575
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
2857 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
2858 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
2859 jabber_add_feature("http://jabber.org/protocol/bytestreams", 0);
25825
69495c6f12af Fix advertised capabilities (caps, chatstates, entity time)
Paul Aurich <paul@darkrain42.org>
parents: 25824
diff changeset
2860 jabber_add_feature("http://jabber.org/protocol/caps", 0);
69495c6f12af Fix advertised capabilities (caps, chatstates, entity time)
Paul Aurich <paul@darkrain42.org>
parents: 25824
diff changeset
2861 jabber_add_feature("http://jabber.org/protocol/chatstates", 0);
25575
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23287
diff changeset
2862 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
2863 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
2864 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
2865 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
2866 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
2867 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
2868 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
2869 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
2870 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
2871
25586
e6f92c0f9770 * adding IPC function 'contact_has_feature'
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25585
diff changeset
2872 /* IPC functions */
e6f92c0f9770 * adding IPC function 'contact_has_feature'
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25585
diff changeset
2873 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
2874 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
2875 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
2876 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
2877 purple_value_new(PURPLE_TYPE_STRING),
e6f92c0f9770 * adding IPC function 'contact_has_feature'
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25585
diff changeset
2878 purple_value_new(PURPLE_TYPE_STRING));
25589
3f719eaa7fd1 * IPC work
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25588
diff changeset
2879 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
2880 purple_marshal_VOID__POINTER,
3f719eaa7fd1 * IPC work
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25588
diff changeset
2881 NULL, 1,
3f719eaa7fd1 * IPC work
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25588
diff changeset
2882 purple_value_new(PURPLE_TYPE_STRING));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2883 }
25763
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
2884
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
2885 void
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
2886 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
2887 {
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25761
diff changeset
2888 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
2889 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
2890 }