Mercurial > pidgin.yaz
annotate libpurple/protocols/jabber/jabber.c @ 28115:3ad2700e7c68
jabber: Add the two Gtalk video features to the disco#info/caps hash
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sat, 01 Aug 2009 02:58:40 +0000 |
parents | 1ea1aee71848 |
children | 784013acc2f3 53f0956f76dc a8b61c00ceda |
rev | line source |
---|---|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /* |
15823 | 2 * purple - Jabber Protocol Plugin |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
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" |
27064
007dff3cb9e4
Fixup after propagating new caps stuff
Marcus Lundblad <ml@update.uu.se>
parents:
27063
diff
changeset
|
26 #include "core.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 #include "cmds.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 #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
|
29 #include "conversation.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 #include "debug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #include "dnssrv.h" |
25817
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
24858
diff
changeset
|
32 #include "imgstore.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 #include "message.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #include "notify.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 #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
|
36 #include "privacy.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 #include "proxy.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 #include "prpl.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 #include "request.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 #include "server.h" |
25963
feea711ac242
Patch from Paul Aurich to fix reporting idle when reconnecting only when we're
Marcus Lundblad <ml@update.uu.se>
parents:
25962
diff
changeset
|
41 #include "status.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 #include "util.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 #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
|
44 #include "xmlnode.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 #include "auth.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 #include "buddy.h" |
25987
c4fd9222dda1
propagate from branch 'im.pidgin.pidgin' (head 303af74a38e7b313d4fb0be4d4054a16cb13d819)
Paul Aurich <paul@darkrain42.org>
diff
changeset
|
48 #include "caps.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 #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
|
50 #include "data.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 #include "disco.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 #include "google.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 #include "iq.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
54 #include "jutil.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 #include "message.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
56 #include "parser.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 #include "presence.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 #include "jabber.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
59 #include "roster.h" |
17562
6ab1089e2101
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents:
17561
diff
changeset
|
60 #include "ping.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 #include "si.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 #include "xdata.h" |
17561
a75079eae085
added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
17560
diff
changeset
|
63 #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
|
64 #include "adhoccommands.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
65 |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25729
diff
changeset
|
66 #include "jingle/jingle.h" |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25729
diff
changeset
|
67 #include "jingle/rtp.h" |
23445
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23182
diff
changeset
|
68 |
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
|
69 #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
|
70 |
27015
f500336f9881
Fix building on Windows and better integrate the new signals with the pre-existing ones.
Etan Reisner <pidgin@unreliablesource.net>
parents:
27014
diff
changeset
|
71 PurplePlugin *jabber_plugin = NULL; |
21538 | 72 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
|
73 GList *jabber_identities = NULL; |
26885
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
74 GSList *jabber_cmds = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
75 |
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
|
76 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
|
77 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
|
78 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 static void jabber_stream_init(JabberStream *js) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
80 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 char *open_stream; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
82 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
83 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
|
84 "xmlns='jabber:client' " |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 "xmlns:stream='http://etherx.jabber.org/streams' " |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
86 "version='1.0'>", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
87 js->user->domain); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
88 /* setup the parser fresh for each stream */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
89 jabber_parser_setup(js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 jabber_send_raw(js, open_stream, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
91 js->reinit = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 g_free(open_stream); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
94 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 static void |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
96 jabber_session_initialized_cb(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
97 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
98 xmlnode *packet, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
99 { |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
100 if (type == JABBER_IQ_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
|
101 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
|
102 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
|
103 jabber_unregister_account_cb(js); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
104 } else { |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
105 purple_connection_error_reason(js->gc, |
21358 | 106 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
20117
f24a2cacacd1
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents:
20076
diff
changeset
|
107 ("Error initializing session")); |
15374
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 } |
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 static void jabber_session_init(JabberStream *js) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 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
|
114 xmlnode *session; |
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 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
|
117 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 session = xmlnode_new_child(iq->node, "session"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
119 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
|
120 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
121 jabber_iq_send(iq); |
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 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
124 static void jabber_bind_result_cb(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
125 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
126 xmlnode *packet, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
128 xmlnode *bind; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
130 if (type == JABBER_IQ_RESULT && |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
131 (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
|
132 xmlnode *jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
133 char *full_jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
134 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
|
135 JabberBuddy *my_jb = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
136 jabber_id_free(js->user); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
137 if(!(js->user = jabber_id_new(full_jid))) { |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
138 purple_connection_error_reason(js->gc, |
21358 | 139 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
140 _("Invalid response from server")); |
15374
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 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
|
143 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
|
144 |
a61c017d3a99
Set the connection display name to the server-assigned full jid for XMPP
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23988
diff
changeset
|
145 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
|
146 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
147 g_free(full_jid); |
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 } else { |
21358 | 150 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
|
151 char *msg = jabber_parse_error(js, packet, &reason); |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
152 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
|
153 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
154 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
155 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
156 jabber_session_init(js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
157 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 |
24500
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
159 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
|
160 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
|
161 *dot = NULL; |
24500
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
162 |
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
163 /* 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
|
164 if (input == NULL || *input == '\0') |
24500
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
165 return NULL; |
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
166 |
24514
6b9552b09de0
Avoid needlessly calling gethostname() if __HOSTNAME__ doesn't appear in the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24508
diff
changeset
|
167 if (strstr(input, "__HOSTNAME__") == NULL) |
24531 | 168 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
|
169 |
24500
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
170 /* Replace __HOSTNAME__ with hostname */ |
24505
9bb624e345aa
me likes this better, References #5565
Ka-Hing Cheung <khc@hxbc.us>
parents:
24501
diff
changeset
|
171 if (gethostname(hostname, sizeof(hostname) - 1)) { |
9bb624e345aa
me likes this better, References #5565
Ka-Hing Cheung <khc@hxbc.us>
parents:
24501
diff
changeset
|
172 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
|
173 /* 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
|
174 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
|
175 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
|
176 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
|
177 instead |
9bb624e345aa
me likes this better, References #5565
Ka-Hing Cheung <khc@hxbc.us>
parents:
24501
diff
changeset
|
178 */ |
24500
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
179 strcpy(hostname, "localhost"); |
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
180 } |
24505
9bb624e345aa
me likes this better, References #5565
Ka-Hing Cheung <khc@hxbc.us>
parents:
24501
diff
changeset
|
181 hostname[sizeof(hostname) - 1] = '\0'; |
24500
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
182 |
25097
43055addf135
Grab only the "short" hostname on systems (like Fedora/RedHat, but others too)
mcepl@redhat.com
parents:
25066
diff
changeset
|
183 /* 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
|
184 * 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
|
185 * 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
|
186 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
|
187 dot = '\0'; |
43055addf135
Grab only the "short" hostname on systems (like Fedora/RedHat, but others too)
mcepl@redhat.com
parents:
25066
diff
changeset
|
188 |
24500
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
189 return purple_strreplace(input, "__HOSTNAME__", hostname); |
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
190 } |
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
191 |
25607
f775f6021654
* using libpurple's internal SASL mechanisms during BOSH authentication phase
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25602
diff
changeset
|
192 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
|
193 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
194 if(xmlnode_get_child(packet, "starttls")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 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
|
196 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
197 return; |
26354
fcee93c74230
BOSH: For authentication purposes, HTTPS is equivalent to a secured JabberStream.
Paul Aurich <paul@darkrain42.org>
parents:
26352
diff
changeset
|
198 } else if(purple_account_get_bool(js->gc->account, "require_tls", FALSE) && !jabber_stream_is_ssl(js)) { |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
199 purple_connection_error_reason(js->gc, |
21358 | 200 PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, |
20117
f24a2cacacd1
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents:
20076
diff
changeset
|
201 _("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
|
202 return; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
205 if(js->registration) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 jabber_register_start(js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 } else if(xmlnode_get_child(packet, "mechanisms")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
208 jabber_auth_start(js, packet); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 } else if(xmlnode_get_child(packet, "bind")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 xmlnode *bind, *resource; |
24500
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
211 char *requested_resource; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
212 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
|
213 bind = xmlnode_new_child(iq->node, "bind"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
214 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
|
215 requested_resource = jabber_prep_resource(js->user->resource); |
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
216 |
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
217 if (requested_resource != NULL) { |
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
218 resource = xmlnode_new_child(bind, "resource"); |
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
219 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
|
220 g_free(requested_resource); |
24500
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
221 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
222 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
223 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
|
224 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
225 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
226 } 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
|
227 /* 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
|
228 * 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
|
229 * 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
|
230 * connecting to an XMPP server. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
231 js->auth_type = JABBER_AUTH_IQ_AUTH; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
232 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
|
233 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
235 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
236 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
|
237 { |
21358 | 238 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
|
239 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
|
240 |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
241 purple_connection_error_reason(js->gc, reason, msg); |
20814
bde477ec6a71
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents:
20792
diff
changeset
|
242 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
244 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
245 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
246 static void tls_init(JabberStream *js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 |
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 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
|
249 { |
15919 | 250 const char *xmlns; |
251 | |
27015
f500336f9881
Fix building on Windows and better integrate the new signals with the pre-existing ones.
Etan Reisner <pidgin@unreliablesource.net>
parents:
27014
diff
changeset
|
252 purple_signal_emit(jabber_plugin, "jabber-receiving-xmlnode", js->gc, packet); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
253 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
254 /* 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
|
255 if(NULL == *packet) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
256 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
257 |
17621
bbd92ee894f2
Fixed a bug in the XMPP parser involving event handlers that replace the xmlnode packet. This caused double frees in this situation. The replacing function must free the xmlnode, since multiple event handlers could do this, and the intermediate xml trees would leak otherwise.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17620
diff
changeset
|
258 xmlns = xmlnode_get_namespace(*packet); |
15919 | 259 |
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
|
260 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
|
261 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
|
262 } 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
|
263 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
|
264 } 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
|
265 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
|
266 } 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
|
267 jabber_stream_features_parse(js, *packet); |
21538 | 268 } else if (!strcmp((*packet)->name, "features") && xmlns && |
15919 | 269 !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
|
270 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
|
271 } else if(!strcmp((*packet)->name, "stream:error") || |
21538 | 272 (!strcmp((*packet)->name, "error") && xmlns && |
15919 | 273 !strcmp(xmlns, "http://etherx.jabber.org/streams"))) |
274 { | |
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
|
275 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
|
276 } else if(!strcmp((*packet)->name, "challenge")) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
277 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
|
278 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
|
279 } else if(!strcmp((*packet)->name, "success")) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
280 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
|
281 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
|
282 } else if(!strcmp((*packet)->name, "failure")) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
283 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
|
284 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
|
285 } else if(!strcmp((*packet)->name, "proceed")) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 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
|
287 tls_init(js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
288 } else { |
15823 | 289 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
|
290 (*packet)->name); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
291 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
292 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
294 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
|
295 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
296 int 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 if (js->gsc) |
15823 | 299 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
|
300 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
301 ret = write(js->fd, data, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
302 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
303 return ret; |
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 |
15823 | 306 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
|
307 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
308 JabberStream *js = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
309 int ret, writelen; |
15823 | 310 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
|
311 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
312 if (writelen == 0) { |
15823 | 313 purple_input_remove(js->writeh); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
314 js->writeh = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
315 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
316 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
317 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
318 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
|
319 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 if (ret < 0 && errno == EAGAIN) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 else if (ret <= 0) { |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
323 gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), |
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
324 g_strerror(errno)); |
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
325 purple_connection_error_reason(js->gc, |
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
326 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
327 g_free(tmp); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
328 return; |
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 |
15823 | 331 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
|
332 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
333 |
23378
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
334 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
|
335 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
336 int ret; |
23378
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
337 gboolean success = TRUE; |
15374
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 if (len == -1) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 len = strlen(data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
341 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
342 if (js->writeh == 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
343 ret = jabber_do_send(js, data, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
344 else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
345 ret = -1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
346 errno = EAGAIN; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
347 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
348 |
23378
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
349 if (ret < 0 && errno != EAGAIN) { |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
350 gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), |
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
351 g_strerror(errno)); |
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
352 purple_connection_error_reason(js->gc, |
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
353 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
354 g_free(tmp); |
23378
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
355 success = FALSE; |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
356 } else if (ret < len) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
357 if (ret < 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
358 ret = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
359 if (js->writeh == 0) |
15823 | 360 js->writeh = purple_input_add( |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
361 js->gsc ? js->gsc->fd : js->fd, |
15823 | 362 PURPLE_INPUT_WRITE, jabber_send_cb, js); |
363 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
|
364 data + ret, len - ret); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
365 } |
23378
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
366 |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
367 return success; |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
368 } |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
369 |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
370 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
|
371 { |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
372 |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
373 /* 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
|
374 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
|
375 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
|
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 /* 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
|
378 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
|
379 /* 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
|
380 (((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
|
381 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
|
382 ((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
|
383 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
|
384 (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
|
385 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
|
386 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
|
387 |
25884
b9a90f34b780
*** Plucked rev b786784e (datallah@pidgin.im):
Paul Aurich <paul@darkrain42.org>
parents:
25872
diff
changeset
|
388 /* Better to print out some wacky debugging than crash |
b9a90f34b780
*** Plucked rev b786784e (datallah@pidgin.im):
Paul Aurich <paul@darkrain42.org>
parents:
25872
diff
changeset
|
389 * due to a plugin sending bad xml */ |
b9a90f34b780
*** Plucked rev b786784e (datallah@pidgin.im):
Paul Aurich <paul@darkrain42.org>
parents:
25872
diff
changeset
|
390 if (tag_end == NULL) |
b9a90f34b780
*** Plucked rev b786784e (datallah@pidgin.im):
Paul Aurich <paul@darkrain42.org>
parents:
25872
diff
changeset
|
391 tag_end = tag_start; |
b9a90f34b780
*** Plucked rev b786784e (datallah@pidgin.im):
Paul Aurich <paul@darkrain42.org>
parents:
25872
diff
changeset
|
392 |
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
|
393 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
|
394 |
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
|
395 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
|
396 *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
|
397 } |
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
|
398 |
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
|
399 purple_debug(PURPLE_DEBUG_MISC, "jabber", "Sending%s: %s%s%s\n", |
26532
e344e2815454
Specify SSL properly in debug messages for BOSH sending debug output
Paul Aurich <paul@darkrain42.org>
parents:
26530
diff
changeset
|
400 jabber_stream_is_ssl(js) ? " (ssl)" : "", text ? text : data, |
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
|
401 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
|
402 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
|
403 |
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
|
404 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
|
405 } |
23378
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
406 |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
407 /* 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
|
408 * 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
|
409 |
27015
f500336f9881
Fix building on Windows and better integrate the new signals with the pre-existing ones.
Etan Reisner <pidgin@unreliablesource.net>
parents:
27014
diff
changeset
|
410 purple_signal_emit(jabber_plugin, "jabber-sending-text", js->gc, &data); |
23378
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
411 if (data == NULL) |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
412 return; |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
413 |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
414 #ifdef HAVE_CYRUS_SASL |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
415 if (js->sasl_maxbuf>0) { |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
416 int pos = 0; |
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 (!js->gsc && js->fd<0) |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
419 return; |
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 if (len == -1) |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
422 len = strlen(data); |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
423 |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
424 while (pos < len) { |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
425 int towrite; |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
426 const char *out; |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
427 unsigned olen; |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
428 |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
429 towrite = MIN((len - pos), js->sasl_maxbuf); |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
430 |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
431 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
|
432 pos += towrite; |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
433 |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
434 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
|
435 break; |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
436 } |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
437 return; |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
438 } |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
439 #endif |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
440 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
441 if (len == -1) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
442 len = strlen(data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
443 |
25777
17b60b844803
Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents:
25776
diff
changeset
|
444 if (js->use_bosh) |
26530
d4af753e0e33
Pass all messages to BOSH as text, so they pass through the sending-text
Paul Aurich <paul@darkrain42.org>
parents:
26529
diff
changeset
|
445 jabber_bosh_connection_send_raw(js->bosh, data); |
25777
17b60b844803
Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents:
25776
diff
changeset
|
446 else |
25717
907ca9a36fe0
explicit merge of '714a7c7f903d11c96ffade34966121da549d998f'
Paul Aurich <paul@darkrain42.org>
diff
changeset
|
447 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
|
448 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
449 |
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
|
450 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
|
451 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
452 JabberStream *js = (JabberStream*)gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
453 jabber_send_raw(js, buf, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
454 return len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
455 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
456 |
27088
d31af94a715d
Use the jabber-sending-xmlnode signal to send all XMPP stanzas.
Paul Aurich <paul@darkrain42.org>
parents:
27086
diff
changeset
|
457 void jabber_send_signal_cb(PurpleConnection *pc, xmlnode **packet, |
d31af94a715d
Use the jabber-sending-xmlnode signal to send all XMPP stanzas.
Paul Aurich <paul@darkrain42.org>
parents:
27086
diff
changeset
|
458 gpointer unused) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
459 { |
27991
e8e056876e39
Set the namespace properly on stanzas for BOSH.
Paul Aurich <paul@darkrain42.org>
parents:
27984
diff
changeset
|
460 JabberStream *js; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
461 char *txt; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
462 int len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
463 |
27088
d31af94a715d
Use the jabber-sending-xmlnode signal to send all XMPP stanzas.
Paul Aurich <paul@darkrain42.org>
parents:
27086
diff
changeset
|
464 if (NULL == packet) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
465 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
466 |
27991
e8e056876e39
Set the namespace properly on stanzas for BOSH.
Paul Aurich <paul@darkrain42.org>
parents:
27984
diff
changeset
|
467 js = purple_connection_get_protocol_data(pc); |
e8e056876e39
Set the namespace properly on stanzas for BOSH.
Paul Aurich <paul@darkrain42.org>
parents:
27984
diff
changeset
|
468 if (js->use_bosh) |
e8e056876e39
Set the namespace properly on stanzas for BOSH.
Paul Aurich <paul@darkrain42.org>
parents:
27984
diff
changeset
|
469 if (g_str_equal((*packet)->name, "message") || |
e8e056876e39
Set the namespace properly on stanzas for BOSH.
Paul Aurich <paul@darkrain42.org>
parents:
27984
diff
changeset
|
470 g_str_equal((*packet)->name, "iq") || |
e8e056876e39
Set the namespace properly on stanzas for BOSH.
Paul Aurich <paul@darkrain42.org>
parents:
27984
diff
changeset
|
471 g_str_equal((*packet)->name, "presence")) |
e8e056876e39
Set the namespace properly on stanzas for BOSH.
Paul Aurich <paul@darkrain42.org>
parents:
27984
diff
changeset
|
472 xmlnode_set_namespace(*packet, "jabber:client"); |
27088
d31af94a715d
Use the jabber-sending-xmlnode signal to send all XMPP stanzas.
Paul Aurich <paul@darkrain42.org>
parents:
27086
diff
changeset
|
473 txt = xmlnode_to_str(*packet, &len); |
27991
e8e056876e39
Set the namespace properly on stanzas for BOSH.
Paul Aurich <paul@darkrain42.org>
parents:
27984
diff
changeset
|
474 jabber_send_raw(js, txt, len); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
475 g_free(txt); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
476 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
477 |
27088
d31af94a715d
Use the jabber-sending-xmlnode signal to send all XMPP stanzas.
Paul Aurich <paul@darkrain42.org>
parents:
27086
diff
changeset
|
478 void jabber_send(JabberStream *js, xmlnode *packet) |
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 { |
27088
d31af94a715d
Use the jabber-sending-xmlnode signal to send all XMPP stanzas.
Paul Aurich <paul@darkrain42.org>
parents:
27086
diff
changeset
|
480 purple_signal_emit(jabber_plugin, "jabber-sending-xmlnode", js->gc, &packet); |
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
|
481 } |
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
|
482 |
25925
42dd7e591031
Make the XMPP keepalive use jabber_ping_jid instead of building it itself.
Paul Aurich <paul@darkrain42.org>
parents:
25050
diff
changeset
|
483 static gboolean jabber_keepalive_timeout(PurpleConnection *gc) |
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
|
484 { |
21973
966f98d4b04b
Masca noticed that dc6923294f5f33ff7a52a998e1b9e9ad47be0211 made jabber.c not
Will Thompson <will.thompson@collabora.co.uk>
parents:
21964
diff
changeset
|
485 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
|
486 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
487 _("Ping timed out")); |
27151
08f5c5b12e7c
The XMPP keepalive timeout handle needs to be a guint.
Paul Aurich <paul@darkrain42.org>
parents:
27137
diff
changeset
|
488 js->keepalive_timeout = 0; |
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
|
489 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
|
490 } |
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
|
491 |
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
|
492 void jabber_keepalive(PurpleConnection *gc) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
493 { |
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
|
494 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
|
495 |
27151
08f5c5b12e7c
The XMPP keepalive timeout handle needs to be a guint.
Paul Aurich <paul@darkrain42.org>
parents:
27137
diff
changeset
|
496 if (js->keepalive_timeout == 0) { |
26999
6b0e150f2276
Stop trying to be clever with XMPP keepalive pings.
Paul Aurich <paul@darkrain42.org>
parents:
26956
diff
changeset
|
497 jabber_keepalive_ping(js); |
25925
42dd7e591031
Make the XMPP keepalive use jabber_ping_jid instead of building it itself.
Paul Aurich <paul@darkrain42.org>
parents:
25050
diff
changeset
|
498 js->keepalive_timeout = purple_timeout_add_seconds(120, |
42dd7e591031
Make the XMPP keepalive use jabber_ping_jid instead of building it itself.
Paul Aurich <paul@darkrain42.org>
parents:
25050
diff
changeset
|
499 (GSourceFunc)(jabber_keepalive_timeout), gc); |
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
|
500 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
501 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
502 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
503 static void |
15823 | 504 jabber_recv_cb_ssl(gpointer data, PurpleSslConnection *gsc, |
505 PurpleInputCondition cond) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
506 { |
15823 | 507 PurpleConnection *gc = data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
508 JabberStream *js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
509 int len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
510 static char buf[4096]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
511 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
512 /* TODO: It should be possible to make this check unnecessary */ |
15823 | 513 if(!PURPLE_CONNECTION_IS_VALID(gc)) { |
514 purple_ssl_close(gsc); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
515 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
516 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
517 |
15823 | 518 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
|
519 gc->last_received = time(NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
520 buf[len] = '\0'; |
15823 | 521 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
|
522 jabber_parser_process(js, buf, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
523 if(js->reinit) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
524 jabber_stream_init(js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
525 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
526 |
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
|
527 if(len < 0 && errno == EAGAIN) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
528 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
|
529 else { |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
530 gchar *tmp; |
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
|
531 if (len == 0) |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
532 tmp = g_strdup_printf(_("Server closed the connection")); |
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
|
533 else |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
534 tmp = g_strdup_printf(_("Lost connection with server: %s"), |
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
535 g_strerror(errno)); |
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
536 purple_connection_error_reason(js->gc, |
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
537 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
538 g_free(tmp); |
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
|
539 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
540 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
541 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
542 static void |
15823 | 543 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
|
544 { |
15823 | 545 PurpleConnection *gc = data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
546 JabberStream *js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
547 int len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
548 static char buf[4096]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
549 |
15823 | 550 if(!PURPLE_CONNECTION_IS_VALID(gc)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
551 return; |
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 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
|
554 gc->last_received = time(NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
555 #ifdef HAVE_CYRUS_SASL |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
556 if (js->sasl_maxbuf>0) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
557 const char *out; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
558 unsigned int olen; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
559 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
|
560 if (olen>0) { |
15823 | 561 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
|
562 jabber_parser_process(js,out,olen); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
563 if(js->reinit) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
564 jabber_stream_init(js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
565 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
566 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
567 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
568 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
569 buf[len] = '\0'; |
15823 | 570 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
|
571 jabber_parser_process(js, buf, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
572 if(js->reinit) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
573 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
|
574 } else if(len < 0 && errno == EAGAIN) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
575 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
576 } else { |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
577 gchar *tmp; |
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
|
578 if (len == 0) |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
579 tmp = g_strdup_printf(_("Server closed the connection")); |
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
|
580 else |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
581 tmp = g_strdup_printf(_("Lost connection with server: %s"), |
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
582 g_strerror(errno)); |
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
583 purple_connection_error_reason(js->gc, |
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
584 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
585 g_free(tmp); |
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 } |
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 static void |
15823 | 590 jabber_login_callback_ssl(gpointer data, PurpleSslConnection *gsc, |
591 PurpleInputCondition cond) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
592 { |
15823 | 593 PurpleConnection *gc = data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
594 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
595 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
596 /* TODO: It should be possible to make this check unnecessary */ |
15823 | 597 if(!PURPLE_CONNECTION_IS_VALID(gc)) { |
598 purple_ssl_close(gsc); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
599 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
|
600 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
601 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
602 js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
603 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
604 if(js->state == JABBER_STREAM_CONNECTING) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
605 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
|
606 jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING); |
15823 | 607 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
|
608 |
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
|
609 /* 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
|
610 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
|
611 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
612 |
27014
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
26999
diff
changeset
|
613 static void |
27431
a71cc338f0fd
A couple more s/GSList/GList/ changes as fallout from the last change.
Etan Reisner <pidgin@unreliablesource.net>
parents:
27429
diff
changeset
|
614 txt_resolved_cb(GList *responses, gpointer data) |
25596
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25593
diff
changeset
|
615 { |
25776
7de1f124f95a
Jabber BOSH: Many fixes
Paul Aurich <paul@darkrain42.org>
parents:
25775
diff
changeset
|
616 JabberStream *js = data; |
26672
acee7d2b1983
Hide PurpleTxtResponse and use a more purple API
Paul Aurich <paul@darkrain42.org>
parents:
26671
diff
changeset
|
617 |
25775
1516525c86fa
Track the TXT query in the js object so it will be cancelleable
Paul Aurich <paul@darkrain42.org>
parents:
25774
diff
changeset
|
618 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
|
619 |
26672
acee7d2b1983
Hide PurpleTxtResponse and use a more purple API
Paul Aurich <paul@darkrain42.org>
parents:
26671
diff
changeset
|
620 if (responses == NULL) { |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
621 purple_connection_error_reason(js->gc, |
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
622 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
623 _("Unable to find alternative XMPP connection " |
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
624 "methods after failing to connect directly.")); |
27014
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
26999
diff
changeset
|
625 return; |
25596
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25593
diff
changeset
|
626 } |
26672
acee7d2b1983
Hide PurpleTxtResponse and use a more purple API
Paul Aurich <paul@darkrain42.org>
parents:
26671
diff
changeset
|
627 |
acee7d2b1983
Hide PurpleTxtResponse and use a more purple API
Paul Aurich <paul@darkrain42.org>
parents:
26671
diff
changeset
|
628 while (responses) { |
acee7d2b1983
Hide PurpleTxtResponse and use a more purple API
Paul Aurich <paul@darkrain42.org>
parents:
26671
diff
changeset
|
629 PurpleTxtResponse *resp = responses->data; |
25597
9f8951284a2e
* small bugfix in jabber_ipc_add_feature()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25596
diff
changeset
|
630 gchar **token; |
26672
acee7d2b1983
Hide PurpleTxtResponse and use a more purple API
Paul Aurich <paul@darkrain42.org>
parents:
26671
diff
changeset
|
631 token = g_strsplit(purple_txt_response_get_content(resp), "=", 2); |
25597
9f8951284a2e
* small bugfix in jabber_ipc_add_feature()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25596
diff
changeset
|
632 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
|
633 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
|
634 js->bosh = jabber_bosh_connection_init(js, token[1]); |
25777
17b60b844803
Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents:
25776
diff
changeset
|
635 js->use_bosh = TRUE; |
25597
9f8951284a2e
* small bugfix in jabber_ipc_add_feature()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25596
diff
changeset
|
636 g_strfreev(token); |
9f8951284a2e
* small bugfix in jabber_ipc_add_feature()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25596
diff
changeset
|
637 break; |
9f8951284a2e
* small bugfix in jabber_ipc_add_feature()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25596
diff
changeset
|
638 } |
9f8951284a2e
* small bugfix in jabber_ipc_add_feature()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25596
diff
changeset
|
639 g_strfreev(token); |
26672
acee7d2b1983
Hide PurpleTxtResponse and use a more purple API
Paul Aurich <paul@darkrain42.org>
parents:
26671
diff
changeset
|
640 purple_txt_response_destroy(resp); |
27431
a71cc338f0fd
A couple more s/GSList/GList/ changes as fallout from the last change.
Etan Reisner <pidgin@unreliablesource.net>
parents:
27429
diff
changeset
|
641 responses = g_list_delete_link(responses, responses); |
25596
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25593
diff
changeset
|
642 } |
26672
acee7d2b1983
Hide PurpleTxtResponse and use a more purple API
Paul Aurich <paul@darkrain42.org>
parents:
26671
diff
changeset
|
643 |
25776
7de1f124f95a
Jabber BOSH: Many fixes
Paul Aurich <paul@darkrain42.org>
parents:
25775
diff
changeset
|
644 if (js->bosh) { |
7de1f124f95a
Jabber BOSH: Many fixes
Paul Aurich <paul@darkrain42.org>
parents:
25775
diff
changeset
|
645 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
|
646 } else { |
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25597
diff
changeset
|
647 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
|
648 } |
26671
400f74b95c0e
First crack at Win32 TXT DNS query code and don't leak the PurpleTxtResponses
Paul Aurich <paul@darkrain42.org>
parents:
26670
diff
changeset
|
649 |
26672
acee7d2b1983
Hide PurpleTxtResponse and use a more purple API
Paul Aurich <paul@darkrain42.org>
parents:
26671
diff
changeset
|
650 if (responses) { |
27431
a71cc338f0fd
A couple more s/GSList/GList/ changes as fallout from the last change.
Etan Reisner <pidgin@unreliablesource.net>
parents:
27429
diff
changeset
|
651 g_list_foreach(responses, (GFunc)purple_txt_response_destroy, NULL); |
a71cc338f0fd
A couple more s/GSList/GList/ changes as fallout from the last change.
Etan Reisner <pidgin@unreliablesource.net>
parents:
27429
diff
changeset
|
652 g_list_free(responses); |
26672
acee7d2b1983
Hide PurpleTxtResponse and use a more purple API
Paul Aurich <paul@darkrain42.org>
parents:
26671
diff
changeset
|
653 } |
25596
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25593
diff
changeset
|
654 } |
15374
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 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
657 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
|
658 { |
15823 | 659 PurpleConnection *gc = data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
660 JabberStream *js = gc->proto_data; |
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 (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
|
663 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
|
664 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
|
665 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
|
666 } else { |
25716
ba362a67278c
propagate from branch 'im.pidgin.pidgin' (head 2747d5e0324ca6b81e83bbb8b75e1efebcbbad6e)
Tobias Markmann <tfar@soc.pidgin.im>
diff
changeset
|
667 purple_debug_info("jabber","Couldn't connect directly to %s. Trying to find alternative connection methods, like BOSH.\n", js->user->domain); |
27684
6f455daf3776
ASCII-ize the TXT query, too.
Paul Aurich <paul@darkrain42.org>
parents:
27683
diff
changeset
|
668 js->srv_query_data = purple_txt_resolve("_xmppconnect", |
27711
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27689
diff
changeset
|
669 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
|
670 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
671 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
672 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
673 |
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
|
674 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
|
675 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
|
676 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
677 js->fd = source; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
678 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
679 if(js->state == JABBER_STREAM_CONNECTING) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
680 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
|
681 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
682 jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING); |
15823 | 683 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
|
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 |
15823 | 687 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
|
688 gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
689 { |
15823 | 690 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
|
691 JabberStream *js; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
692 |
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
|
693 /* If the connection is already disconnected, we don't need to do anything else */ |
15823 | 694 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
|
695 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
|
696 |
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
|
697 js = gc->proto_data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
698 js->gsc = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
699 |
20117
f24a2cacacd1
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents:
20076
diff
changeset
|
700 purple_connection_ssl_error (gc, error); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
701 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
702 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
703 static void tls_init(JabberStream *js) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
704 { |
15823 | 705 purple_input_remove(js->gc->inpa); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
706 js->gc->inpa = 0; |
18929
67cb28c0ec89
applied changes from e52b685d84ca8874da6e3e71199829e513500642
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18163
diff
changeset
|
707 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
|
708 jabber_login_callback_ssl, jabber_ssl_connect_failure, js->certificate_CN, js->gc); |
27984
96c38fe2cb00
Clear out the fd when we pass it off to the SSL subsystem
Paul Aurich <paul@darkrain42.org>
parents:
27711
diff
changeset
|
709 /* The fd is no longer our concern */ |
96c38fe2cb00
Clear out the fd when we pass it off to the SSL subsystem
Paul Aurich <paul@darkrain42.org>
parents:
27711
diff
changeset
|
710 js->fd = -1; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
711 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
712 |
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
|
713 static gboolean jabber_login_connect(JabberStream *js, const char *domain, const char *host, int port, |
27711
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27689
diff
changeset
|
714 gboolean fatal_failure) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
715 { |
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
|
716 /* 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
|
717 * 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
|
718 * but we use domain as fallback for when users enter IP address |
27711
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27689
diff
changeset
|
719 * 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
|
720 g_free(js->serverFQDN); |
27711
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27689
diff
changeset
|
721 if (purple_ip_address_is_valid(host)) |
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
|
722 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
|
723 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
|
724 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
|
725 |
27689
5f17bfa9dc70
To make grim happy (or more upset).
Paul Aurich <paul@darkrain42.org>
parents:
27684
diff
changeset
|
726 if (purple_proxy_connect(js->gc, purple_connection_get_account(js->gc), |
5f17bfa9dc70
To make grim happy (or more upset).
Paul Aurich <paul@darkrain42.org>
parents:
27684
diff
changeset
|
727 host, port, jabber_login_callback, js->gc) == NULL) { |
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
|
728 if (fatal_failure) { |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
729 purple_connection_error_reason(js->gc, |
23643
224169be5830
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23398
diff
changeset
|
730 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27431
diff
changeset
|
731 _("Unable to connect")); |
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
|
732 } |
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 |
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 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
|
735 } |
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
|
736 |
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
|
737 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
|
738 } |
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 |
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
|
740 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
|
741 { |
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
|
742 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
|
743 PurpleSrvResponse *tmp_resp = js->srv_rec + (js->srv_rec_idx++); |
27711
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27689
diff
changeset
|
744 if (jabber_login_connect(js, tmp_resp->hostname, tmp_resp->hostname, tmp_resp->port, FALSE)) |
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
|
745 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
|
746 } |
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
|
747 |
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
|
748 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
|
749 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
|
750 |
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
|
751 /* Fall back to the defaults (I'm not sure if we should actually do this) */ |
27711
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27689
diff
changeset
|
752 jabber_login_connect(js, js->user->domain, js->user->domain, |
27689
5f17bfa9dc70
To make grim happy (or more upset).
Paul Aurich <paul@darkrain42.org>
parents:
27684
diff
changeset
|
753 purple_account_get_int(purple_connection_get_account(js->gc), "port", 5222), |
27711
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27689
diff
changeset
|
754 TRUE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
755 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
756 |
15823 | 757 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
|
758 { |
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
|
759 JabberStream *js = data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
760 js->srv_query_data = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
761 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
762 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
|
763 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
|
764 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
|
765 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
|
766 try_srv_connect(js); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
767 } else { |
27711
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27689
diff
changeset
|
768 jabber_login_connect(js, js->user->domain, js->user->domain, |
27689
5f17bfa9dc70
To make grim happy (or more upset).
Paul Aurich <paul@darkrain42.org>
parents:
27684
diff
changeset
|
769 purple_account_get_int(purple_connection_get_account(js->gc), "port", 5222), |
27711
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27689
diff
changeset
|
770 TRUE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
771 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
772 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
773 |
27675
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
774 static JabberStream * |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
775 jabber_stream_new(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
776 { |
15823 | 777 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
|
778 JabberStream *js; |
27675
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
779 JabberBuddy *my_jb; |
25963
feea711ac242
Patch from Paul Aurich to fix reporting idle when reconnecting only when we're
Marcus Lundblad <ml@update.uu.se>
parents:
25962
diff
changeset
|
780 PurplePresence *presence; |
27683
f95bcb5eb047
Support connecting to IDNA XMPP domains.
Paul Aurich <paul@darkrain42.org>
parents:
27675
diff
changeset
|
781 gchar *user; |
f95bcb5eb047
Support connecting to IDNA XMPP domains.
Paul Aurich <paul@darkrain42.org>
parents:
27675
diff
changeset
|
782 gchar *slash; |
27675
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
783 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
784 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
|
785 js->gc = gc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
786 js->fd = -1; |
27683
f95bcb5eb047
Support connecting to IDNA XMPP domains.
Paul Aurich <paul@darkrain42.org>
parents:
27675
diff
changeset
|
787 |
f95bcb5eb047
Support connecting to IDNA XMPP domains.
Paul Aurich <paul@darkrain42.org>
parents:
27675
diff
changeset
|
788 user = g_strdup(purple_account_get_username(account)); |
f95bcb5eb047
Support connecting to IDNA XMPP domains.
Paul Aurich <paul@darkrain42.org>
parents:
27675
diff
changeset
|
789 /* jabber_id_new doesn't accept "user@domain/" as valid */ |
f95bcb5eb047
Support connecting to IDNA XMPP domains.
Paul Aurich <paul@darkrain42.org>
parents:
27675
diff
changeset
|
790 slash = strchr(user, '/'); |
f95bcb5eb047
Support connecting to IDNA XMPP domains.
Paul Aurich <paul@darkrain42.org>
parents:
27675
diff
changeset
|
791 if (slash && *(slash + 1) == '\0') |
f95bcb5eb047
Support connecting to IDNA XMPP domains.
Paul Aurich <paul@darkrain42.org>
parents:
27675
diff
changeset
|
792 *slash = '\0'; |
f95bcb5eb047
Support connecting to IDNA XMPP domains.
Paul Aurich <paul@darkrain42.org>
parents:
27675
diff
changeset
|
793 js->user = jabber_id_new(user); |
27675
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
794 |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
795 if (!js->user) { |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
796 purple_connection_error_reason(gc, |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
797 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
798 _("Invalid XMPP ID")); |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
799 /* Destroying the connection will free the JabberStream */ |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
800 return NULL; |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
801 } |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
802 |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
803 if (!js->user->domain || *(js->user->domain) == '\0') { |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
804 purple_connection_error_reason(gc, |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
805 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
806 _("Invalid XMPP ID. Domain must be set.")); |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
807 /* Destroying the connection will free the JabberStream */ |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
808 return NULL; |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
809 } |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
810 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
811 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
|
812 g_free, (GDestroyNotify)jabber_buddy_free); |
27675
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
813 |
27683
f95bcb5eb047
Support connecting to IDNA XMPP domains.
Paul Aurich <paul@darkrain42.org>
parents:
27675
diff
changeset
|
814 my_jb = jabber_buddy_find(js, user, TRUE); |
f95bcb5eb047
Support connecting to IDNA XMPP domains.
Paul Aurich <paul@darkrain42.org>
parents:
27675
diff
changeset
|
815 g_free(user); |
27675
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
816 if (!my_jb) { |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
817 /* This basically *can't* fail, but for good measure... */ |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
818 purple_connection_error_reason(gc, |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
819 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
820 _("Invalid XMPP ID")); |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
821 /* Destroying the connection will free the JabberStream */ |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
822 g_return_val_if_reached(NULL); |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
823 } |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
824 |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
825 my_jb->subscription |= JABBER_SUB_BOTH; |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
826 |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
827 js->iq_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
828 g_free, g_free); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
829 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
|
830 g_free, (GDestroyNotify)jabber_chat_free); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
831 js->next_id = g_random_int(); |
15823 | 832 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
|
833 js->old_length = 0; |
27151
08f5c5b12e7c
The XMPP keepalive timeout handle needs to be a guint.
Paul Aurich <paul@darkrain42.org>
parents:
27137
diff
changeset
|
834 js->keepalive_timeout = 0; |
25995
6d7d360687bd
Jabber: Default protocol version to 1.0.
Paul Aurich <paul@darkrain42.org>
parents:
25989
diff
changeset
|
835 /* Set the default protocol version to 1.0. Overridden in parser.c. */ |
6d7d360687bd
Jabber: Default protocol version to 1.0.
Paul Aurich <paul@darkrain42.org>
parents:
25989
diff
changeset
|
836 js->protocol_version = JABBER_PROTO_1_0; |
25648
16543025aed1
Moved jingle.c global variable "sessions" into JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25647
diff
changeset
|
837 js->sessions = NULL; |
26162
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26145
diff
changeset
|
838 js->stun_ip = NULL; |
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26145
diff
changeset
|
839 js->stun_port = 0; |
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26145
diff
changeset
|
840 js->stun_query = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
841 |
25962
a92df60855f3
Set idle time on JabberStream when logging in
Marcus Lundblad <ml@update.uu.se>
parents:
25956
diff
changeset
|
842 /* if we are idle, set idle-ness on the stream (this could happen if we get |
a92df60855f3
Set idle time on JabberStream when logging in
Marcus Lundblad <ml@update.uu.se>
parents:
25956
diff
changeset
|
843 disconnected and the reconnects while being idle. I don't think it makes |
a92df60855f3
Set idle time on JabberStream when logging in
Marcus Lundblad <ml@update.uu.se>
parents:
25956
diff
changeset
|
844 sense to do this when registering a new account... */ |
25963
feea711ac242
Patch from Paul Aurich to fix reporting idle when reconnecting only when we're
Marcus Lundblad <ml@update.uu.se>
parents:
25962
diff
changeset
|
845 presence = purple_account_get_presence(account); |
feea711ac242
Patch from Paul Aurich to fix reporting idle when reconnecting only when we're
Marcus Lundblad <ml@update.uu.se>
parents:
25962
diff
changeset
|
846 if (purple_presence_is_idle(presence)) |
feea711ac242
Patch from Paul Aurich to fix reporting idle when reconnecting only when we're
Marcus Lundblad <ml@update.uu.se>
parents:
25962
diff
changeset
|
847 js->idle = purple_presence_get_idle_time(presence); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
848 |
27675
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
849 return js; |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
850 } |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
851 |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
852 static void |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
853 jabber_stream_connect(JabberStream *js) |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
854 { |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
855 PurpleConnection *gc = js->gc; |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
856 PurpleAccount *account = purple_connection_get_account(gc); |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
857 const char *connect_server = purple_account_get_string(account, |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
858 "connect_server", ""); |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
859 const char *bosh_url = purple_account_get_string(account, |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
860 "bosh_url", ""); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
861 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
862 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
|
863 |
27255
a9fdf9327652
Make "BOSH URL" its own account option.
Paul Aurich <paul@darkrain42.org>
parents:
27219
diff
changeset
|
864 /* If both BOSH and a Connect Server are specified, we prefer BOSH. I'm not |
a9fdf9327652
Make "BOSH URL" its own account option.
Paul Aurich <paul@darkrain42.org>
parents:
27219
diff
changeset
|
865 * attached to that choice, though. |
a9fdf9327652
Make "BOSH URL" its own account option.
Paul Aurich <paul@darkrain42.org>
parents:
27219
diff
changeset
|
866 */ |
a9fdf9327652
Make "BOSH URL" its own account option.
Paul Aurich <paul@darkrain42.org>
parents:
27219
diff
changeset
|
867 if (*bosh_url) { |
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
|
868 js->use_bosh = TRUE; |
27255
a9fdf9327652
Make "BOSH URL" its own account option.
Paul Aurich <paul@darkrain42.org>
parents:
27219
diff
changeset
|
869 js->bosh = jabber_bosh_connection_init(js, bosh_url); |
a9fdf9327652
Make "BOSH URL" its own account option.
Paul Aurich <paul@darkrain42.org>
parents:
27219
diff
changeset
|
870 if (js->bosh) |
a9fdf9327652
Make "BOSH URL" its own account option.
Paul Aurich <paul@darkrain42.org>
parents:
27219
diff
changeset
|
871 jabber_bosh_connection_connect(js->bosh); |
a9fdf9327652
Make "BOSH URL" its own account option.
Paul Aurich <paul@darkrain42.org>
parents:
27219
diff
changeset
|
872 else { |
27675
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
873 purple_connection_error_reason(gc, |
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
|
874 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, |
27255
a9fdf9327652
Make "BOSH URL" its own account option.
Paul Aurich <paul@darkrain42.org>
parents:
27219
diff
changeset
|
875 _("Malformed BOSH URL")); |
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
|
876 } |
27255
a9fdf9327652
Make "BOSH URL" its own account option.
Paul Aurich <paul@darkrain42.org>
parents:
27219
diff
changeset
|
877 |
25774
514051f3b6cf
Add option for forcing BOSH (useful for debugging)
Paul Aurich <paul@darkrain42.org>
parents:
25772
diff
changeset
|
878 return; |
514051f3b6cf
Add option for forcing BOSH (useful for debugging)
Paul Aurich <paul@darkrain42.org>
parents:
25772
diff
changeset
|
879 } |
514051f3b6cf
Add option for forcing BOSH (useful for debugging)
Paul Aurich <paul@darkrain42.org>
parents:
25772
diff
changeset
|
880 |
27255
a9fdf9327652
Make "BOSH URL" its own account option.
Paul Aurich <paul@darkrain42.org>
parents:
27219
diff
changeset
|
881 js->certificate_CN = g_strdup(connect_server[0] ? connect_server : js->user->domain); |
a9fdf9327652
Make "BOSH URL" its own account option.
Paul Aurich <paul@darkrain42.org>
parents:
27219
diff
changeset
|
882 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
883 /* if they've got old-ssl mode going, we probably want to ignore SRV lookups */ |
27675
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
884 if(purple_account_get_bool(account, "old_ssl", FALSE)) { |
15823 | 885 if(purple_ssl_is_supported()) { |
27711
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27689
diff
changeset
|
886 js->gsc = purple_ssl_connect(account, js->certificate_CN, |
27675
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
887 purple_account_get_int(account, "port", 5223), |
27711
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27689
diff
changeset
|
888 jabber_login_callback_ssl, jabber_ssl_connect_failure, 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
|
889 if (!js->gsc) { |
27675
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
890 purple_connection_error_reason(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
|
891 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
|
892 _("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
|
893 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
894 } else { |
27675
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
895 purple_connection_error_reason(gc, |
21358 | 896 PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, |
20117
f24a2cacacd1
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents:
20076
diff
changeset
|
897 _("SSL support unavailable")); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
898 } |
25835
97a4d71e0c3d
Don't fallback (under any conditions) from old-style SSL to other connections
Paul Aurich <paul@darkrain42.org>
parents:
25834
diff
changeset
|
899 |
97a4d71e0c3d
Don't fallback (under any conditions) from old-style SSL to other connections
Paul Aurich <paul@darkrain42.org>
parents:
25834
diff
changeset
|
900 return; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
901 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
902 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
903 /* 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
|
904 * 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>
diff
changeset
|
905 if(connect_server[0]) { |
27711
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27689
diff
changeset
|
906 jabber_login_connect(js, js->user->domain, connect_server, |
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27689
diff
changeset
|
907 purple_account_get_int(account, "port", 5222), TRUE); |
25835
97a4d71e0c3d
Don't fallback (under any conditions) from old-style SSL to other connections
Paul Aurich <paul@darkrain42.org>
parents:
25834
diff
changeset
|
908 } else { |
97a4d71e0c3d
Don't fallback (under any conditions) from old-style SSL to other connections
Paul Aurich <paul@darkrain42.org>
parents:
25834
diff
changeset
|
909 js->srv_query_data = purple_srv_resolve("xmpp-client", |
27711
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27689
diff
changeset
|
910 "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
|
911 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
912 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
913 |
27675
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
914 void |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
915 jabber_login(PurpleAccount *account) |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
916 { |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
917 PurpleConnection *gc = purple_account_get_connection(account); |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
918 JabberStream *js; |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
919 PurpleStoredImage *image; |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
920 |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
921 gc->flags |= PURPLE_CONNECTION_HTML | |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
922 PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY; |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
923 js = jabber_stream_new(account); |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
924 if (js == NULL) |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
925 return; |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
926 |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
927 /* |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
928 * Calculate the avatar hash for our current image so we know (when we |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
929 * fetch our vCard and PEP avatar) if we should send our avatar to the |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
930 * server. |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
931 */ |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
932 image = purple_buddy_icons_find_account_icon(account); |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
933 if (image != NULL) { |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
934 js->initial_avatar_hash = |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
935 jabber_calculate_data_sha1sum(purple_imgstore_get_data(image), |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
936 purple_imgstore_get_size(image)); |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
937 purple_imgstore_unref(image); |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
938 } |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
939 |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
940 jabber_stream_connect(js); |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
941 } |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
942 |
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 static gboolean |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
945 conn_close_cb(gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
946 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
947 JabberStream *js = data; |
15823 | 948 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
|
949 |
17603
7a3a66c6530a
Fixed a leak: The XML parser was never cleaned up on disconnect.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17599
diff
changeset
|
950 jabber_parser_free(js); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
951 |
15823 | 952 purple_account_disconnect(account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
953 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
954 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
955 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
956 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
957 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
958 jabber_connection_schedule_close(JabberStream *js) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
959 { |
15823 | 960 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
|
961 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
962 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
963 static void |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
964 jabber_registration_result_cb(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
965 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
966 xmlnode *packet, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
967 { |
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
|
968 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
|
969 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
|
970 char *to = data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
971 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
972 if (type == JABBER_IQ_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
|
973 if(js->registration) { |
27366
73c8e1964eef
A semi-random collection of English spelling and grammatical changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27255
diff
changeset
|
974 buf = g_strdup_printf(_("Registration of %s@%s successful"), |
27413
46cc3674b13c
Indentation fix.
Etan Reisner <pidgin@unreliablesource.net>
parents:
27151
diff
changeset
|
975 js->user->node, js->user->domain); |
17608
a8b1159fd95b
Simplified registration callback per request of Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17607
diff
changeset
|
976 if(account->registration_cb) |
a8b1159fd95b
Simplified registration callback per request of Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17607
diff
changeset
|
977 (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
|
978 } 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
|
979 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
|
980 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
|
981 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
|
982 } |
15823 | 983 purple_notify_info(NULL, _("Registration Successful"), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
984 _("Registration Successful"), buf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
985 g_free(buf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
986 } 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
|
987 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
|
988 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
989 if(!msg) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
990 msg = g_strdup(_("Unknown Error")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
991 |
15823 | 992 purple_notify_error(NULL, _("Registration Failed"), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
993 _("Registration Failed"), msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
994 g_free(msg); |
17608
a8b1159fd95b
Simplified registration callback per request of Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17607
diff
changeset
|
995 if(account->registration_cb) |
a8b1159fd95b
Simplified registration callback per request of Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17607
diff
changeset
|
996 (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
|
997 } |
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
|
998 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
|
999 if(js->registration) |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
1000 jabber_connection_schedule_close(js); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1001 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1002 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1003 static void |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
1004 jabber_unregistration_result_cb(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
1005 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
1006 xmlnode *packet, gpointer data) |
18695
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1007 { |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1008 char *buf; |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1009 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
|
1010 |
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
|
1011 /* 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
|
1012 * 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
|
1013 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
|
1014 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
1015 if (type == JABBER_IQ_RESULT) { |
18695
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1016 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
|
1017 to); |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1018 purple_notify_info(NULL, _("Unregistration Successful"), |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1019 _("Unregistration Successful"), buf); |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1020 g_free(buf); |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1021 } 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
|
1022 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
|
1023 |
18695
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1024 if(!msg) |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1025 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
|
1026 |
18695
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1027 purple_notify_error(NULL, _("Unregistration Failed"), |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1028 _("Unregistration Failed"), msg); |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1029 g_free(msg); |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1030 } |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1031 g_free(to); |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1032 } |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1033 |
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
|
1034 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
|
1035 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
|
1036 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
|
1037 } 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
|
1038 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1039 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
|
1040 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
|
1041 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1042 GList *groups, *flds; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1043 xmlnode *query, *y; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1044 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1045 char *username; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1046 |
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
|
1047 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
|
1048 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
|
1049 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
|
1050 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
|
1051 |
15823 | 1052 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
|
1053 groups = groups->next) { |
15823 | 1054 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
|
1055 flds; flds = flds->next) { |
15823 | 1056 PurpleRequestField *field = flds->data; |
1057 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
|
1058 if(!strcmp(id,"unregister")) { |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1059 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
|
1060 if(value) { |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1061 /* 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
|
1062 (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
|
1063 jabber_iq_free(iq); |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1064 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
|
1065 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
|
1066 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
|
1067 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
|
1068 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
|
1069 |
18695
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1070 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
|
1071 |
18695
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1072 jabber_iq_send(iq); |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1073 g_free(cbdata); |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1074 return; |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1075 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1076 } else { |
15823 | 1077 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
|
1078 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1079 if(!strcmp(id, "username")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1080 y = xmlnode_new_child(query, "username"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1081 } else if(!strcmp(id, "password")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1082 y = xmlnode_new_child(query, "password"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1083 } else if(!strcmp(id, "name")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1084 y = xmlnode_new_child(query, "name"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1085 } else if(!strcmp(id, "email")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1086 y = xmlnode_new_child(query, "email"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1087 } else if(!strcmp(id, "nick")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1088 y = xmlnode_new_child(query, "nick"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1089 } else if(!strcmp(id, "first")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1090 y = xmlnode_new_child(query, "first"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1091 } else if(!strcmp(id, "last")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1092 y = xmlnode_new_child(query, "last"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1093 } else if(!strcmp(id, "address")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1094 y = xmlnode_new_child(query, "address"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1095 } else if(!strcmp(id, "city")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1096 y = xmlnode_new_child(query, "city"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1097 } else if(!strcmp(id, "state")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1098 y = xmlnode_new_child(query, "state"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1099 } else if(!strcmp(id, "zip")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1100 y = xmlnode_new_child(query, "zip"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1101 } else if(!strcmp(id, "phone")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1102 y = xmlnode_new_child(query, "phone"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1103 } else if(!strcmp(id, "url")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1104 y = xmlnode_new_child(query, "url"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1105 } else if(!strcmp(id, "date")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1106 y = xmlnode_new_child(query, "date"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1107 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1108 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1109 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1110 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
|
1111 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
|
1112 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
|
1113 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
|
1114 } |
18695
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1115 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
|
1116 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
|
1117 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1118 } |
19696
481749fc0b6b
merge of '1c7910841138381c841363256ca3c7905b1f26b0'
Daniel Atallah <daniel.atallah@gmail.com>
diff
changeset
|
1119 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1120 |
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
|
1121 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
|
1122 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
|
1123 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
|
1124 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
|
1125 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
|
1126 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1127 |
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
|
1128 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
|
1129 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1130 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
|
1131 g_free(cbdata); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1132 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1133 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1134 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
|
1135 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
|
1136 { |
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
|
1137 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
|
1138 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
|
1139 if(account->registration_cb) |
17608
a8b1159fd95b
Simplified registration callback per request of Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17607
diff
changeset
|
1140 (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
|
1141 jabber_connection_schedule_close(cbdata->js); |
20276
c1d3d25e8c49
Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents:
20187
diff
changeset
|
1142 } |
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
|
1143 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
|
1144 g_free(cbdata); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1145 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1146 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1147 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
|
1148 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1149 xmlnode *query; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1150 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
|
1151 char *to = data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1152 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1153 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
|
1154 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
|
1155 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
|
1156 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
|
1157 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1158 xmlnode_insert_child(query, result); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1159 |
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
|
1160 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
|
1161 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1162 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1163 |
26694
28381a8889a8
This is a little less...repetitious
Paul Aurich <paul@darkrain42.org>
parents:
26692
diff
changeset
|
1164 static const struct { |
28381a8889a8
This is a little less...repetitious
Paul Aurich <paul@darkrain42.org>
parents:
26692
diff
changeset
|
1165 const char *name; |
28381a8889a8
This is a little less...repetitious
Paul Aurich <paul@darkrain42.org>
parents:
26692
diff
changeset
|
1166 const char *label; |
28381a8889a8
This is a little less...repetitious
Paul Aurich <paul@darkrain42.org>
parents:
26692
diff
changeset
|
1167 } registration_fields[] = { |
28381a8889a8
This is a little less...repetitious
Paul Aurich <paul@darkrain42.org>
parents:
26692
diff
changeset
|
1168 { "email", N_("Email") }, |
28381a8889a8
This is a little less...repetitious
Paul Aurich <paul@darkrain42.org>
parents:
26692
diff
changeset
|
1169 { "nick", N_("Nickname") }, |
28381a8889a8
This is a little less...repetitious
Paul Aurich <paul@darkrain42.org>
parents:
26692
diff
changeset
|
1170 { "first", N_("First name") }, |
28381a8889a8
This is a little less...repetitious
Paul Aurich <paul@darkrain42.org>
parents:
26692
diff
changeset
|
1171 { "last", N_("Last name") }, |
28381a8889a8
This is a little less...repetitious
Paul Aurich <paul@darkrain42.org>
parents:
26692
diff
changeset
|
1172 { "address", N_("Address") }, |
28381a8889a8
This is a little less...repetitious
Paul Aurich <paul@darkrain42.org>
parents:
26692
diff
changeset
|
1173 { "city", N_("City") }, |
28381a8889a8
This is a little less...repetitious
Paul Aurich <paul@darkrain42.org>
parents:
26692
diff
changeset
|
1174 { "state", N_("State") }, |
28381a8889a8
This is a little less...repetitious
Paul Aurich <paul@darkrain42.org>
parents:
26692
diff
changeset
|
1175 { "zip", N_("Postal code") }, |
28381a8889a8
This is a little less...repetitious
Paul Aurich <paul@darkrain42.org>
parents:
26692
diff
changeset
|
1176 { "phone", N_("Phone") }, |
28381a8889a8
This is a little less...repetitious
Paul Aurich <paul@darkrain42.org>
parents:
26692
diff
changeset
|
1177 { "url", N_("URL") }, |
28381a8889a8
This is a little less...repetitious
Paul Aurich <paul@darkrain42.org>
parents:
26692
diff
changeset
|
1178 { "date", N_("Date") }, |
28381a8889a8
This is a little less...repetitious
Paul Aurich <paul@darkrain42.org>
parents:
26692
diff
changeset
|
1179 { NULL, NULL } |
28381a8889a8
This is a little less...repetitious
Paul Aurich <paul@darkrain42.org>
parents:
26692
diff
changeset
|
1180 }; |
28381a8889a8
This is a little less...repetitious
Paul Aurich <paul@darkrain42.org>
parents:
26692
diff
changeset
|
1181 |
25933
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25930
diff
changeset
|
1182 void jabber_register_parse(JabberStream *js, const char *from, JabberIqType type, |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25930
diff
changeset
|
1183 const char *id, xmlnode *query) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1184 { |
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
|
1185 PurpleAccount *account = purple_connection_get_account(js->gc); |
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
|
1186 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
|
1187 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
|
1188 PurpleRequestField *field; |
26697
5149ecc8f456
Use defaults provided by the server where applicable and when available
Paul Aurich <paul@darkrain42.org>
parents:
26694
diff
changeset
|
1189 xmlnode *x, *y, *node; |
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
|
1190 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
|
1191 JabberRegisterCBData *cbdata; |
18695
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1192 gboolean registered = FALSE; |
26694
28381a8889a8
This is a little less...repetitious
Paul Aurich <paul@darkrain42.org>
parents:
26692
diff
changeset
|
1193 int i; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1194 |
25933
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25930
diff
changeset
|
1195 if (type != JABBER_IQ_RESULT) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1196 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1197 |
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
|
1198 if(js->registration) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1199 /* get rid of the login thingy */ |
15823 | 1200 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
|
1201 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1202 |
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
|
1203 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
|
1204 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
|
1205 |
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
|
1206 if(js->registration) { |
15823 | 1207 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
|
1208 _("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
|
1209 if(account->registration_cb) |
17608
a8b1159fd95b
Simplified registration callback per request of Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17607
diff
changeset
|
1210 (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
|
1211 jabber_connection_schedule_close(js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1212 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1213 } |
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
|
1214 } |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25442
diff
changeset
|
1215 |
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
|
1216 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
|
1217 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
|
1218 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
|
1219 |
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
|
1220 } 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
|
1221 xmlnode *url; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1222 |
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
|
1223 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
|
1224 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
|
1225 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
|
1226 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
|
1227 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
|
1228 |
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
|
1229 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
|
1230 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
|
1231 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
|
1232 (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
|
1233 jabber_connection_schedule_close(js); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1234 } |
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
|
1235 return; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1236 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1237 } |
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
|
1238 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1239 |
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
|
1240 /* 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
|
1241 |
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
|
1242 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
|
1243 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
|
1244 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
|
1245 |
26697
5149ecc8f456
Use defaults provided by the server where applicable and when available
Paul Aurich <paul@darkrain42.org>
parents:
26694
diff
changeset
|
1246 if((node = xmlnode_get_child(query, "username"))) { |
5149ecc8f456
Use defaults provided by the server where applicable and when available
Paul Aurich <paul@darkrain42.org>
parents:
26694
diff
changeset
|
1247 char *data = xmlnode_get_data(node); |
26329
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25985
diff
changeset
|
1248 if(js->registration) |
26697
5149ecc8f456
Use defaults provided by the server where applicable and when available
Paul Aurich <paul@darkrain42.org>
parents:
26694
diff
changeset
|
1249 field = purple_request_field_string_new("username", _("Username"), data ? data : js->user->node, FALSE); |
26329
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25985
diff
changeset
|
1250 else |
26697
5149ecc8f456
Use defaults provided by the server where applicable and when available
Paul Aurich <paul@darkrain42.org>
parents:
26694
diff
changeset
|
1251 field = purple_request_field_string_new("username", _("Username"), data, FALSE); |
26329
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25985
diff
changeset
|
1252 |
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25985
diff
changeset
|
1253 purple_request_field_group_add_field(group, field); |
26697
5149ecc8f456
Use defaults provided by the server where applicable and when available
Paul Aurich <paul@darkrain42.org>
parents:
26694
diff
changeset
|
1254 g_free(data); |
26329
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25985
diff
changeset
|
1255 } |
26697
5149ecc8f456
Use defaults provided by the server where applicable and when available
Paul Aurich <paul@darkrain42.org>
parents:
26694
diff
changeset
|
1256 if((node = xmlnode_get_child(query, "password"))) { |
26329
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25985
diff
changeset
|
1257 if(js->registration) |
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25985
diff
changeset
|
1258 field = purple_request_field_string_new("password", _("Password"), |
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25985
diff
changeset
|
1259 purple_connection_get_password(js->gc), FALSE); |
26697
5149ecc8f456
Use defaults provided by the server where applicable and when available
Paul Aurich <paul@darkrain42.org>
parents:
26694
diff
changeset
|
1260 else { |
5149ecc8f456
Use defaults provided by the server where applicable and when available
Paul Aurich <paul@darkrain42.org>
parents:
26694
diff
changeset
|
1261 char *data = xmlnode_get_data(node); |
5149ecc8f456
Use defaults provided by the server where applicable and when available
Paul Aurich <paul@darkrain42.org>
parents:
26694
diff
changeset
|
1262 field = purple_request_field_string_new("password", _("Password"), data, FALSE); |
5149ecc8f456
Use defaults provided by the server where applicable and when available
Paul Aurich <paul@darkrain42.org>
parents:
26694
diff
changeset
|
1263 g_free(data); |
5149ecc8f456
Use defaults provided by the server where applicable and when available
Paul Aurich <paul@darkrain42.org>
parents:
26694
diff
changeset
|
1264 } |
26329
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25985
diff
changeset
|
1265 |
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25985
diff
changeset
|
1266 purple_request_field_string_set_masked(field, TRUE); |
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25985
diff
changeset
|
1267 purple_request_field_group_add_field(group, field); |
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25985
diff
changeset
|
1268 } |
26694
28381a8889a8
This is a little less...repetitious
Paul Aurich <paul@darkrain42.org>
parents:
26692
diff
changeset
|
1269 |
26697
5149ecc8f456
Use defaults provided by the server where applicable and when available
Paul Aurich <paul@darkrain42.org>
parents:
26694
diff
changeset
|
1270 if((node = 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
|
1271 if(js->registration) |
15823 | 1272 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
|
1273 purple_account_get_alias(js->gc->account), FALSE); |
26697
5149ecc8f456
Use defaults provided by the server where applicable and when available
Paul Aurich <paul@darkrain42.org>
parents:
26694
diff
changeset
|
1274 else { |
5149ecc8f456
Use defaults provided by the server where applicable and when available
Paul Aurich <paul@darkrain42.org>
parents:
26694
diff
changeset
|
1275 char *data = xmlnode_get_data(node); |
5149ecc8f456
Use defaults provided by the server where applicable and when available
Paul Aurich <paul@darkrain42.org>
parents:
26694
diff
changeset
|
1276 field = purple_request_field_string_new("name", _("Name"), data, FALSE); |
5149ecc8f456
Use defaults provided by the server where applicable and when available
Paul Aurich <paul@darkrain42.org>
parents:
26694
diff
changeset
|
1277 g_free(data); |
5149ecc8f456
Use defaults provided by the server where applicable and when available
Paul Aurich <paul@darkrain42.org>
parents:
26694
diff
changeset
|
1278 } |
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
|
1279 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
|
1280 } |
26694
28381a8889a8
This is a little less...repetitious
Paul Aurich <paul@darkrain42.org>
parents:
26692
diff
changeset
|
1281 |
28381a8889a8
This is a little less...repetitious
Paul Aurich <paul@darkrain42.org>
parents:
26692
diff
changeset
|
1282 for (i = 0; registration_fields[i].name != NULL; ++i) { |
26697
5149ecc8f456
Use defaults provided by the server where applicable and when available
Paul Aurich <paul@darkrain42.org>
parents:
26694
diff
changeset
|
1283 if ((node = xmlnode_get_child(query, registration_fields[i].name))) { |
5149ecc8f456
Use defaults provided by the server where applicable and when available
Paul Aurich <paul@darkrain42.org>
parents:
26694
diff
changeset
|
1284 char *data = xmlnode_get_data(node); |
26694
28381a8889a8
This is a little less...repetitious
Paul Aurich <paul@darkrain42.org>
parents:
26692
diff
changeset
|
1285 field = purple_request_field_string_new(registration_fields[i].name, |
28381a8889a8
This is a little less...repetitious
Paul Aurich <paul@darkrain42.org>
parents:
26692
diff
changeset
|
1286 _(registration_fields[i].label), |
26697
5149ecc8f456
Use defaults provided by the server where applicable and when available
Paul Aurich <paul@darkrain42.org>
parents:
26694
diff
changeset
|
1287 data, FALSE); |
26694
28381a8889a8
This is a little less...repetitious
Paul Aurich <paul@darkrain42.org>
parents:
26692
diff
changeset
|
1288 purple_request_field_group_add_field(group, field); |
26697
5149ecc8f456
Use defaults provided by the server where applicable and when available
Paul Aurich <paul@darkrain42.org>
parents:
26694
diff
changeset
|
1289 g_free(data); |
26694
28381a8889a8
This is a little less...repetitious
Paul Aurich <paul@darkrain42.org>
parents:
26692
diff
changeset
|
1290 } |
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
|
1291 } |
26694
28381a8889a8
This is a little less...repetitious
Paul Aurich <paul@darkrain42.org>
parents:
26692
diff
changeset
|
1292 |
18695
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1293 if(registered) { |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1294 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
|
1295 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
|
1296 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1297 |
20276
c1d3d25e8c49
Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents:
20187
diff
changeset
|
1298 if((y = xmlnode_get_child(query, "instructions"))) |
c1d3d25e8c49
Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents:
20187
diff
changeset
|
1299 instructions = xmlnode_get_data(y); |
18695
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1300 else if(registered) |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1301 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
|
1302 "to change your account registration.")); |
20276
c1d3d25e8c49
Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents:
20187
diff
changeset
|
1303 else |
c1d3d25e8c49
Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents:
20187
diff
changeset
|
1304 instructions = g_strdup(_("Please fill out the information below " |
c1d3d25e8c49
Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents:
20187
diff
changeset
|
1305 "to register your new account.")); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1306 |
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
|
1307 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
|
1308 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
|
1309 cbdata->who = g_strdup(from); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1310 |
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
|
1311 if(js->registration) |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
1312 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
|
1313 _("Register New XMPP Account"), instructions, fields, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1314 _("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
|
1315 _("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
|
1316 purple_connection_get_account(js->gc), NULL, NULL, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
1317 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
|
1318 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
|
1319 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
|
1320 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
|
1321 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
|
1322 :g_strdup_printf(_("Register New Account at %s"), from); |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
1323 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
|
1324 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
|
1325 (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
|
1326 _("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
|
1327 purple_connection_get_account(js->gc), NULL, NULL, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
1328 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
|
1329 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
|
1330 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1331 |
20276
c1d3d25e8c49
Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents:
20187
diff
changeset
|
1332 g_free(instructions); |
c1d3d25e8c49
Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents:
20187
diff
changeset
|
1333 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1334 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1335 void jabber_register_start(JabberStream *js) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1336 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1337 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1338 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1339 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
|
1340 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1341 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1342 |
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
|
1343 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
|
1344 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
|
1345 |
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
|
1346 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
|
1347 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
|
1348 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
|
1349 } |
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
|
1350 |
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
|
1351 void jabber_register_account(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1352 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1353 JabberStream *js; |
27675
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
1354 |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
1355 js = jabber_stream_new(account); |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
1356 if (js == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1357 return; |
27675
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
1358 |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
1359 js->registration = TRUE; |
409ef6d76bf6
Refactor jabber_login and jabber_register_account
Paul Aurich <paul@darkrain42.org>
parents:
27603
diff
changeset
|
1360 jabber_stream_connect(js); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1361 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1362 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
1363 static void |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
1364 jabber_unregister_account_iq_cb(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
1365 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
1366 xmlnode *packet, gpointer data) |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
1367 { |
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
|
1368 PurpleAccount *account = purple_connection_get_account(js->gc); |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
1369 |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
1370 if (type == JABBER_IQ_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
|
1371 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
|
1372 |
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
|
1373 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
|
1374 _("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
|
1375 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
|
1376 if(js->unregistration_cb) |
18921
ba3b22cd280b
Mixed up TRUE and FALSE.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18920
diff
changeset
|
1377 js->unregistration_cb(account, FALSE, js->unregistration_user_data); |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
1378 } else { |
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
|
1379 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
|
1380 _("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
|
1381 if(js->unregistration_cb) |
18921
ba3b22cd280b
Mixed up TRUE and FALSE.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18920
diff
changeset
|
1382 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
|
1383 } |
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
|
1384 } |
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 |
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 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
|
1387 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
|
1388 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
|
1389 |
ab38146f8f78
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19999
diff
changeset
|
1390 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
|
1391 |
ab38146f8f78
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19999
diff
changeset
|
1392 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
|
1393 |
ab38146f8f78
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19999
diff
changeset
|
1394 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
|
1395 |
ab38146f8f78
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19999
diff
changeset
|
1396 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
|
1397 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
|
1398 |
ab38146f8f78
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19999
diff
changeset
|
1399 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
|
1400 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
|
1401 } |
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
|
1402 |
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
|
1403 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
|
1404 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
|
1405 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
|
1406 |
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
|
1407 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
|
1408 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
|
1409 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
|
1410 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
|
1411 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
|
1412 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
|
1413 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
|
1414 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
|
1415 } |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25442
diff
changeset
|
1416 |
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
|
1417 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
|
1418 |
ab38146f8f78
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19999
diff
changeset
|
1419 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
|
1420 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
|
1421 return; |
ab38146f8f78
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19999
diff
changeset
|
1422 } |
ab38146f8f78
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19999
diff
changeset
|
1423 |
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
|
1424 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
|
1425 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
|
1426 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
|
1427 |
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
|
1428 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
|
1429 } |
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
|
1430 |
25872
3b674151cd60
*** Plucked rev 4831edb9 (darkrain42@pidgin.im):
Paul Aurich <paul@darkrain42.org>
parents:
25871
diff
changeset
|
1431 /* TODO: As Will pointed out in IRC, after being notified by the core to |
3b674151cd60
*** Plucked rev 4831edb9 (darkrain42@pidgin.im):
Paul Aurich <paul@darkrain42.org>
parents:
25871
diff
changeset
|
1432 * shutdown, we should async. wait for the server to send us the stream |
3b674151cd60
*** Plucked rev 4831edb9 (darkrain42@pidgin.im):
Paul Aurich <paul@darkrain42.org>
parents:
25871
diff
changeset
|
1433 * termination before destorying everything. That seems like it would require |
3b674151cd60
*** Plucked rev 4831edb9 (darkrain42@pidgin.im):
Paul Aurich <paul@darkrain42.org>
parents:
25871
diff
changeset
|
1434 * changing the semantics of prpl->close(), so it's a good idea for 3.0.0. |
3b674151cd60
*** Plucked rev 4831edb9 (darkrain42@pidgin.im):
Paul Aurich <paul@darkrain42.org>
parents:
25871
diff
changeset
|
1435 */ |
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
|
1436 void jabber_close(PurpleConnection *gc) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1437 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1438 JabberStream *js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1439 |
25667
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25666
diff
changeset
|
1440 /* Close all of the open Jingle sessions on this stream */ |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25729
diff
changeset
|
1441 jingle_terminate_sessions(js); |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25646
diff
changeset
|
1442 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1443 /* 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
|
1444 * 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
|
1445 * on some SSL backends. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1446 */ |
25777
17b60b844803
Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents:
25776
diff
changeset
|
1447 if (!gc->disconnect_timeout) { |
17b60b844803
Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents:
25776
diff
changeset
|
1448 if (js->use_bosh) |
17b60b844803
Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents:
25776
diff
changeset
|
1449 jabber_bosh_connection_close(js->bosh); |
27683
f95bcb5eb047
Support connecting to IDNA XMPP domains.
Paul Aurich <paul@darkrain42.org>
parents:
27675
diff
changeset
|
1450 else if ((js->gsc && js->gsc->fd > 0) || js->fd > 0) |
25777
17b60b844803
Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents:
25776
diff
changeset
|
1451 jabber_send_raw(js, "</stream:stream>", -1); |
26767
90d5e3b94a37
Feed a fake </stream:stream> to the XMPP parser to silence warnings.
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1452 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1453 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1454 if (js->srv_query_data) |
15823 | 1455 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
|
1456 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1457 if(js->gsc) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1458 #ifdef HAVE_OPENSSL |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1459 if (!gc->disconnect_timeout) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1460 #endif |
15823 | 1461 purple_ssl_close(js->gsc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1462 } else if (js->fd > 0) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1463 if(js->gc->inpa) |
15823 | 1464 purple_input_remove(js->gc->inpa); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1465 close(js->fd); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1466 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1467 |
25777
17b60b844803
Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents:
25776
diff
changeset
|
1468 if (js->bosh) |
17b60b844803
Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents:
25776
diff
changeset
|
1469 jabber_bosh_connection_destroy(js->bosh); |
17b60b844803
Jabber BOSH: more fixes.
Paul Aurich <paul@darkrain42.org>
parents:
25776
diff
changeset
|
1470 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1471 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
|
1472 |
17603
7a3a66c6530a
Fixed a leak: The XML parser was never cleaned up on disconnect.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17599
diff
changeset
|
1473 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
|
1474 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1475 if(js->iq_callbacks) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1476 g_hash_table_destroy(js->iq_callbacks); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1477 if(js->buddies) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1478 g_hash_table_destroy(js->buddies); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1479 if(js->chats) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1480 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
|
1481 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1482 while(js->chat_servers) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1483 g_free(js->chat_servers->data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1484 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
|
1485 } |
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 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1487 while(js->user_directories) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1488 g_free(js->user_directories->data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1489 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
|
1490 } |
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
|
1491 |
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 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
|
1493 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
|
1494 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
|
1495 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
|
1496 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
|
1497 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
|
1498 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
|
1499 } |
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
|
1500 |
23744
3c3032be12de
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23644
diff
changeset
|
1501 while(js->url_datas) { |
3c3032be12de
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23644
diff
changeset
|
1502 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
|
1503 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
|
1504 } |
3c3032be12de
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23644
diff
changeset
|
1505 |
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
|
1506 g_free(js->stream_id); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1507 if(js->user) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1508 jabber_id_free(js->user); |
25832
2d92bbe6807b
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <paul@darkrain42.org>
parents:
25829
diff
changeset
|
1509 g_free(js->initial_avatar_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
|
1510 g_free(js->avatar_hash); |
25742
4040da08a733
Entity Capabilities must be per-JabberStream
Paul Aurich <paul@darkrain42.org>
parents:
25741
diff
changeset
|
1511 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
|
1512 |
15823 | 1513 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
|
1514 if(js->writeh) |
15823 | 1515 purple_input_remove(js->writeh); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1516 #ifdef HAVE_CYRUS_SASL |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1517 if(js->sasl) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1518 sasl_dispose(&js->sasl); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1519 if(js->sasl_mechs) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1520 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
|
1521 g_free(js->sasl_cb); |
18929
67cb28c0ec89
applied changes from e52b685d84ca8874da6e3e71199829e513500642
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18163
diff
changeset
|
1522 #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
|
1523 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
|
1524 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
|
1525 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
|
1526 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
|
1527 g_free(cmd->node); |
17620
11dd7969dd4b
Fixed copy/paste error.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17617
diff
changeset
|
1528 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
|
1529 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
|
1530 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
|
1531 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1532 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
|
1533 g_free(js->certificate_CN); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1534 g_free(js->gmail_last_time); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1535 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
|
1536 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
|
1537 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
|
1538 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
|
1539 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
|
1540 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
|
1541 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
|
1542 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
|
1543 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
|
1544 |
28112
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
27991
diff
changeset
|
1545 if (js->vcard_timer != 0) |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
27991
diff
changeset
|
1546 purple_timeout_remove(js->vcard_timer); |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
27991
diff
changeset
|
1547 |
27151
08f5c5b12e7c
The XMPP keepalive timeout handle needs to be a guint.
Paul Aurich <paul@darkrain42.org>
parents:
27137
diff
changeset
|
1548 if (js->keepalive_timeout != 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
|
1549 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
|
1550 |
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
|
1551 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
|
1552 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
|
1553 |
26162
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26145
diff
changeset
|
1554 g_free(js->stun_ip); |
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26145
diff
changeset
|
1555 js->stun_ip = NULL; |
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26145
diff
changeset
|
1556 |
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26145
diff
changeset
|
1557 /* cancel DNS query for STUN, if one is ongoing */ |
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26145
diff
changeset
|
1558 if (js->stun_query) { |
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26145
diff
changeset
|
1559 purple_dnsquery_destroy(js->stun_query); |
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26145
diff
changeset
|
1560 js->stun_query = NULL; |
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26145
diff
changeset
|
1561 } |
27014
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
26999
diff
changeset
|
1562 |
23644
fa8567fa0ca0
Fix a stupid mistake in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23643
diff
changeset
|
1563 g_free(js); |
fa8567fa0ca0
Fix a stupid mistake in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23643
diff
changeset
|
1564 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1565 gc->proto_data = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1566 } |
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 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
|
1569 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1570 js->state = state; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1571 switch(state) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1572 case JABBER_STREAM_OFFLINE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1573 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1574 case JABBER_STREAM_CONNECTING: |
15823 | 1575 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
|
1576 JABBER_CONNECT_STEPS); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1577 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1578 case JABBER_STREAM_INITIALIZING: |
15823 | 1579 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
|
1580 js->gsc ? 5 : 2, JABBER_CONNECT_STEPS); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1581 jabber_stream_init(js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1582 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
|
1583 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
|
1584 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
|
1585 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
|
1586 break; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1587 case JABBER_STREAM_AUTHENTICATING: |
15823 | 1588 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
|
1589 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
|
1590 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
|
1591 jabber_register_start(js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1592 } 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
|
1593 /* 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
|
1594 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
|
1595 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
|
1596 */ |
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
|
1597 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
|
1598 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
|
1599 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
|
1600 } |
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
|
1601 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1602 jabber_auth_start_old(js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1603 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1604 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1605 case JABBER_STREAM_REINITIALIZING: |
15823 | 1606 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
|
1607 (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
|
1608 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1609 /* 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
|
1610 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
|
1611 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1612 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1613 case JABBER_STREAM_CONNECTED: |
27571
c8390dc125c1
Use js->state to track whether the roster has been retrieved.
Paul Aurich <paul@darkrain42.org>
parents:
27096
diff
changeset
|
1614 /* Send initial presence */ |
c8390dc125c1
Use js->state to track whether the roster has been retrieved.
Paul Aurich <paul@darkrain42.org>
parents:
27096
diff
changeset
|
1615 jabber_presence_send(js, TRUE); |
15823 | 1616 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
|
1617 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1618 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1619 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1620 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1621 char *jabber_get_next_id(JabberStream *js) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1622 { |
15823 | 1623 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
|
1624 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1625 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1626 |
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
|
1627 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
|
1628 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1629 JabberStream *js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1630 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1631 js->idle = idle ? time(NULL) - idle : idle; |
26787
fef989505ea2
propagate from branch 'im.pidgin.pidgin' (head 7281ad5ba8e68debd285e06dafebd991e980f3da)
Paul Aurich <paul@darkrain42.org>
diff
changeset
|
1632 |
25791
e9b7e41dc816
A first stab at supporting the upcoming new use-case in XMPP XEP-0012
Marcus Lundblad <ml@update.uu.se>
parents:
24155
diff
changeset
|
1633 /* send out an updated prescence */ |
e9b7e41dc816
A first stab at supporting the upcoming new use-case in XMPP XEP-0012
Marcus Lundblad <ml@update.uu.se>
parents:
24155
diff
changeset
|
1634 purple_debug_info("jabber", "sending updated presence for idle\n"); |
26818 | 1635 jabber_presence_send(js, FALSE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1636 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1637 |
27033
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1638 void jabber_blocklist_parse_push(JabberStream *js, const char *from, |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1639 JabberIqType type, const char *id, |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1640 xmlnode *child) |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1641 { |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1642 JabberIq *result; |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1643 xmlnode *item; |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1644 PurpleAccount *account; |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1645 gboolean is_block; |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1646 |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1647 if (!jabber_is_own_account(js, from)) { |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1648 xmlnode *error, *x; |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1649 result = jabber_iq_new(js, JABBER_IQ_ERROR); |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1650 xmlnode_set_attrib(result->node, "id", id); |
27040
c41698323c2f
No, I had that right the first time; if it's not our account, then there *is* a from and we need to route the IQ to the proper place.
Paul Aurich <paul@darkrain42.org>
parents:
27039
diff
changeset
|
1651 if (from) |
c41698323c2f
No, I had that right the first time; if it's not our account, then there *is* a from and we need to route the IQ to the proper place.
Paul Aurich <paul@darkrain42.org>
parents:
27039
diff
changeset
|
1652 xmlnode_set_attrib(result->node, "to", from); |
27033
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1653 |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1654 error = xmlnode_new_child(result->node, "error"); |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1655 xmlnode_set_attrib(error, "type", "cancel"); |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1656 x = xmlnode_new_child(error, "not-allowed"); |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1657 xmlnode_set_namespace(x, "urn:ietf:params:xml:ns:xmpp-stanzas"); |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1658 |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1659 jabber_iq_send(result); |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1660 return; |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1661 } |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1662 |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1663 account = purple_connection_get_account(js->gc); |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1664 is_block = g_str_equal(child->name, "block"); |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1665 |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1666 item = xmlnode_get_child(child, "item"); |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1667 if (!is_block && item == NULL) { |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1668 /* Unblock everyone */ |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1669 purple_debug_info("jabber", "Received unblock push. Unblocking everyone.\n"); |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1670 |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1671 while (account->deny != NULL) { |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1672 purple_privacy_deny_remove(account, account->deny->data, TRUE); |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1673 } |
27039
373141b35c52
Avoid an assertion failure and add an error case.
Paul Aurich <paul@darkrain42.org>
parents:
27034
diff
changeset
|
1674 } else if (item == NULL) { |
373141b35c52
Avoid an assertion failure and add an error case.
Paul Aurich <paul@darkrain42.org>
parents:
27034
diff
changeset
|
1675 /* An empty <block/> is bogus */ |
373141b35c52
Avoid an assertion failure and add an error case.
Paul Aurich <paul@darkrain42.org>
parents:
27034
diff
changeset
|
1676 xmlnode *error, *x; |
373141b35c52
Avoid an assertion failure and add an error case.
Paul Aurich <paul@darkrain42.org>
parents:
27034
diff
changeset
|
1677 result = jabber_iq_new(js, JABBER_IQ_ERROR); |
373141b35c52
Avoid an assertion failure and add an error case.
Paul Aurich <paul@darkrain42.org>
parents:
27034
diff
changeset
|
1678 xmlnode_set_attrib(result->node, "id", id); |
373141b35c52
Avoid an assertion failure and add an error case.
Paul Aurich <paul@darkrain42.org>
parents:
27034
diff
changeset
|
1679 |
373141b35c52
Avoid an assertion failure and add an error case.
Paul Aurich <paul@darkrain42.org>
parents:
27034
diff
changeset
|
1680 error = xmlnode_new_child(result->node, "error"); |
373141b35c52
Avoid an assertion failure and add an error case.
Paul Aurich <paul@darkrain42.org>
parents:
27034
diff
changeset
|
1681 xmlnode_set_attrib(error, "type", "modify"); |
373141b35c52
Avoid an assertion failure and add an error case.
Paul Aurich <paul@darkrain42.org>
parents:
27034
diff
changeset
|
1682 x = xmlnode_new_child(error, "bad-request"); |
373141b35c52
Avoid an assertion failure and add an error case.
Paul Aurich <paul@darkrain42.org>
parents:
27034
diff
changeset
|
1683 xmlnode_set_namespace(x, "urn:ietf:params:xml:ns:xmpp-stanzas"); |
373141b35c52
Avoid an assertion failure and add an error case.
Paul Aurich <paul@darkrain42.org>
parents:
27034
diff
changeset
|
1684 |
373141b35c52
Avoid an assertion failure and add an error case.
Paul Aurich <paul@darkrain42.org>
parents:
27034
diff
changeset
|
1685 jabber_iq_send(result); |
373141b35c52
Avoid an assertion failure and add an error case.
Paul Aurich <paul@darkrain42.org>
parents:
27034
diff
changeset
|
1686 return; |
27033
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1687 } else { |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1688 for ( ; item; item = xmlnode_get_next_twin(item)) { |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1689 const char *jid = xmlnode_get_attrib(item, "jid"); |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1690 if (jid == NULL || *jid == '\0') |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1691 continue; |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1692 |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1693 if (is_block) |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1694 purple_privacy_deny_add(account, jid, TRUE); |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1695 else |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1696 purple_privacy_deny_remove(account, jid, TRUE); |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1697 } |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1698 } |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1699 |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1700 result = jabber_iq_new(js, JABBER_IQ_RESULT); |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1701 xmlnode_set_attrib(result->node, "id", id); |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1702 jabber_iq_send(result); |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1703 } |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1704 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
1705 static void jabber_blocklist_parse(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
1706 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
1707 xmlnode *packet, gpointer data) |
24820
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1708 { |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1709 xmlnode *blocklist, *item; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1710 PurpleAccount *account; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1711 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1712 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
|
1713 "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
|
1714 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
|
1715 |
27034
1dcee141997d
The server list is definitive for who is blocked.
Paul Aurich <paul@darkrain42.org>
parents:
27033
diff
changeset
|
1716 if (type == JABBER_IQ_ERROR || blocklist == NULL) |
24820
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1717 return; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1718 |
27033
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1719 /* This is the only privacy method supported by XEP-0191 */ |
27034
1dcee141997d
The server list is definitive for who is blocked.
Paul Aurich <paul@darkrain42.org>
parents:
27033
diff
changeset
|
1720 if (account->perm_deny != PURPLE_PRIVACY_DENY_USERS) |
27033
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1721 account->perm_deny = PURPLE_PRIVACY_DENY_USERS; |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1722 |
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1723 /* |
27034
1dcee141997d
The server list is definitive for who is blocked.
Paul Aurich <paul@darkrain42.org>
parents:
27033
diff
changeset
|
1724 * TODO: When account->deny is something more than a hash table, this can |
1dcee141997d
The server list is definitive for who is blocked.
Paul Aurich <paul@darkrain42.org>
parents:
27033
diff
changeset
|
1725 * be re-written to find the set intersection and difference. |
27033
10c91922bc1e
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <paul@darkrain42.org>
parents:
27015
diff
changeset
|
1726 */ |
27034
1dcee141997d
The server list is definitive for who is blocked.
Paul Aurich <paul@darkrain42.org>
parents:
27033
diff
changeset
|
1727 while (account->deny) |
1dcee141997d
The server list is definitive for who is blocked.
Paul Aurich <paul@darkrain42.org>
parents:
27033
diff
changeset
|
1728 purple_privacy_deny_remove(account, account->deny->data, TRUE); |
1dcee141997d
The server list is definitive for who is blocked.
Paul Aurich <paul@darkrain42.org>
parents:
27033
diff
changeset
|
1729 |
24820
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1730 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
|
1731 while (item != NULL) { |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1732 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
|
1733 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
|
1734 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
|
1735 } |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1736 } |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1737 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1738 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
|
1739 { |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1740 JabberIq *iq; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1741 xmlnode *blocklist; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1742 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1743 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
|
1744 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1745 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
|
1746 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
|
1747 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1748 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
|
1749 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1750 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
|
1751 } |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1752 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1753 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
|
1754 { |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1755 JabberStream *js; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1756 JabberIq *iq; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1757 xmlnode *block, *item; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1758 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1759 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
|
1760 if (js == NULL) |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1761 return; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1762 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1763 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
|
1764 { |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1765 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
|
1766 return; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1767 } |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1768 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1769 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
|
1770 { |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1771 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
|
1772 _("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
|
1773 return; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1774 } |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1775 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1776 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
|
1777 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1778 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
|
1779 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
|
1780 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1781 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
|
1782 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
|
1783 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1784 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
|
1785 } |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1786 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1787 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
|
1788 { |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1789 JabberStream *js; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1790 JabberIq *iq; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1791 xmlnode *unblock, *item; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1792 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1793 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
|
1794 if (js == NULL) |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1795 return; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1796 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1797 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
|
1798 { |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1799 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
|
1800 return; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1801 } |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1802 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1803 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
|
1804 return; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1805 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1806 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
|
1807 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1808 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
|
1809 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
|
1810 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1811 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
|
1812 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
|
1813 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1814 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
|
1815 } |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1816 |
25575
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23287
diff
changeset
|
1817 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
|
1818 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
|
1819 |
ab38146f8f78
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19999
diff
changeset
|
1820 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
|
1821 |
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
|
1822 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
|
1823 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
|
1824 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
|
1825 |
17572
2e0799b916b9
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents:
17568
diff
changeset
|
1826 /* 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
|
1827 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
|
1828 |
17572
2e0799b916b9
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents:
17568
diff
changeset
|
1829 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
|
1830 } |
95affacf6f82
Added the ability to define extensions to caps
Andreas Monitzer <pidgin@monitzer.com>
parents:
17562
diff
changeset
|
1831 |
25575
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23287
diff
changeset
|
1832 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
|
1833 GList *feature; |
2e0799b916b9
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents:
17568
diff
changeset
|
1834 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
|
1835 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
|
1836 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
|
1837 g_free(feat->namespace); |
2e0799b916b9
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents:
17568
diff
changeset
|
1838 g_free(feature->data); |
21538 | 1839 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
|
1840 break; |
2e0799b916b9
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents:
17568
diff
changeset
|
1841 } |
2e0799b916b9
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents:
17568
diff
changeset
|
1842 } |
17563
95affacf6f82
Added the ability to define extensions to caps
Andreas Monitzer <pidgin@monitzer.com>
parents:
17562
diff
changeset
|
1843 } |
95affacf6f82
Added the ability to define extensions to caps
Andreas Monitzer <pidgin@monitzer.com>
parents:
17562
diff
changeset
|
1844 |
25763
860ebaf275ae
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents:
25761
diff
changeset
|
1845 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
|
1846 { |
860ebaf275ae
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents:
25761
diff
changeset
|
1847 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
|
1848 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
|
1849 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
|
1850 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
|
1851 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
|
1852 } |
860ebaf275ae
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents:
25761
diff
changeset
|
1853 } |
860ebaf275ae
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents:
25761
diff
changeset
|
1854 |
25760
f462fa160f06
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents:
25747
diff
changeset
|
1855 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
|
1856 GList *identity; |
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23287
diff
changeset
|
1857 JabberIdentity *ident; |
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23287
diff
changeset
|
1858 /* 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
|
1859 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
|
1860 g_return_if_fail(type != NULL); |
27014
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
26999
diff
changeset
|
1861 |
25575
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23287
diff
changeset
|
1862 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
|
1863 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
|
1864 if (!strcmp(ident->category, category) && |
f462fa160f06
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents:
25747
diff
changeset
|
1865 !strcmp(ident->type, type) && |
f462fa160f06
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents:
25747
diff
changeset
|
1866 ((!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
|
1867 return; |
27014
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
26999
diff
changeset
|
1868 } |
25575
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23287
diff
changeset
|
1869 } |
25760
f462fa160f06
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents:
25747
diff
changeset
|
1870 |
25575
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23287
diff
changeset
|
1871 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
|
1872 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
|
1873 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
|
1874 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
|
1875 ident->name = g_strdup(name); |
26850
966d2f2f86c8
Don't crash when the caps cb is NULL and don't corrupt jabber_identities
Paul Aurich <paul@darkrain42.org>
parents:
26842
diff
changeset
|
1876 jabber_identities = g_list_prepend(jabber_identities, ident); |
25575
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23287
diff
changeset
|
1877 } |
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23287
diff
changeset
|
1878 |
25763
860ebaf275ae
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents:
25761
diff
changeset
|
1879 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
|
1880 { |
860ebaf275ae
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents:
25761
diff
changeset
|
1881 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
|
1882 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
|
1883 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
|
1884 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
|
1885 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
|
1886 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
|
1887 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
|
1888 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
|
1889 } |
860ebaf275ae
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents:
25761
diff
changeset
|
1890 } |
860ebaf275ae
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents:
25761
diff
changeset
|
1891 |
26354
fcee93c74230
BOSH: For authentication purposes, HTTPS is equivalent to a secured JabberStream.
Paul Aurich <paul@darkrain42.org>
parents:
26352
diff
changeset
|
1892 gboolean jabber_stream_is_ssl(JabberStream *js) |
fcee93c74230
BOSH: For authentication purposes, HTTPS is equivalent to a secured JabberStream.
Paul Aurich <paul@darkrain42.org>
parents:
26352
diff
changeset
|
1893 { |
fcee93c74230
BOSH: For authentication purposes, HTTPS is equivalent to a secured JabberStream.
Paul Aurich <paul@darkrain42.org>
parents:
26352
diff
changeset
|
1894 return (js->bosh && jabber_bosh_connection_is_ssl(js->bosh)) || |
fcee93c74230
BOSH: For authentication purposes, HTTPS is equivalent to a secured JabberStream.
Paul Aurich <paul@darkrain42.org>
parents:
26352
diff
changeset
|
1895 (!js->bosh && js->gsc); |
fcee93c74230
BOSH: For authentication purposes, HTTPS is equivalent to a secured JabberStream.
Paul Aurich <paul@darkrain42.org>
parents:
26352
diff
changeset
|
1896 } |
fcee93c74230
BOSH: For authentication purposes, HTTPS is equivalent to a secured JabberStream.
Paul Aurich <paul@darkrain42.org>
parents:
26352
diff
changeset
|
1897 |
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
|
1898 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
|
1899 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1900 return "jabber"; |
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 |
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
|
1903 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
|
1904 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1905 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1906 JabberBuddy *jb = NULL; |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
1907 PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(b)); |
27136
dd7e7071d46d
Whitespace + a change cluttering up the diff with im.pidgin.pidgin
Paul Aurich <paul@darkrain42.org>
parents:
27135
diff
changeset
|
1908 |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
1909 if(!gc) |
15498
0d4890637238
clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents:
15463
diff
changeset
|
1910 return NULL; |
0d4890637238
clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents:
15463
diff
changeset
|
1911 |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
1912 js = gc->proto_data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1913 if(js) |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
1914 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
|
1915 |
15823 | 1916 if(!PURPLE_BUDDY_IS_ONLINE(b)) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1917 if(jb && (jb->subscription & JABBER_SUB_PENDING || |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1918 !(jb->subscription & JABBER_SUB_TO))) |
15463 | 1919 return "not-authorized"; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1920 } |
27136
dd7e7071d46d
Whitespace + a change cluttering up the diff with im.pidgin.pidgin
Paul Aurich <paul@darkrain42.org>
parents:
27135
diff
changeset
|
1921 |
25836
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25066
diff
changeset
|
1922 if (jb) { |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25066
diff
changeset
|
1923 JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, NULL); |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25066
diff
changeset
|
1924 if (jbr) { |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25066
diff
changeset
|
1925 const gchar *client_type = |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25066
diff
changeset
|
1926 jabber_resource_get_identity_category_type(jbr, "client"); |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25066
diff
changeset
|
1927 |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25066
diff
changeset
|
1928 if (client_type) { |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25066
diff
changeset
|
1929 if (strcmp(client_type, "phone") == 0) { |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25066
diff
changeset
|
1930 return "mobile"; |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25066
diff
changeset
|
1931 } else if (strcmp(client_type, "web") == 0) { |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25066
diff
changeset
|
1932 return "external"; |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25066
diff
changeset
|
1933 } else if (strcmp(client_type, "handheld") == 0) { |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25066
diff
changeset
|
1934 return "hiptop"; |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25066
diff
changeset
|
1935 } else if (strcmp(client_type, "bot") == 0) { |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25066
diff
changeset
|
1936 return "bot"; |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25066
diff
changeset
|
1937 } |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25066
diff
changeset
|
1938 /* the default value "pc" falls through and has no emblem */ |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25066
diff
changeset
|
1939 } |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25066
diff
changeset
|
1940 } |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25066
diff
changeset
|
1941 } |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25066
diff
changeset
|
1942 |
15463 | 1943 return NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1944 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1945 |
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
|
1946 char *jabber_status_text(PurpleBuddy *b) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1947 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1948 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
|
1949 JabberBuddy *jb = NULL; |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
1950 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
|
1951 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
|
1952 |
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
1953 if (gc && gc->proto_data) |
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
1954 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
|
1955 |
15823 | 1956 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
|
1957 ret = g_strdup(_("Not Authorized")); |
15823 | 1958 } 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
|
1959 ret = g_strdup(jb->error_msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1960 } else { |
26773
803e05b3a871
Retrieve status message to display in Buddy List from PurplePresence.
Paul Aurich <paul@darkrain42.org>
parents:
26767
diff
changeset
|
1961 PurplePresence *presence = purple_buddy_get_presence(b); |
27563
7a2891487a00
Don't pre-escape jbr->status. Almost every place required it in unescaped
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27514
diff
changeset
|
1962 PurpleStatus *status = purple_presence_get_active_status(presence); |
27603
a12574d982a1
merge of '6bf1ed8cefd6bb5b980baf7501bcf6936634bd8d'
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
1963 const char *message; |
a12574d982a1
merge of '6bf1ed8cefd6bb5b980baf7501bcf6936634bd8d'
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
1964 |
a12574d982a1
merge of '6bf1ed8cefd6bb5b980baf7501bcf6936634bd8d'
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
1965 if((message = purple_status_get_attr_string(status, "message"))) { |
a12574d982a1
merge of '6bf1ed8cefd6bb5b980baf7501bcf6936634bd8d'
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
1966 ret = g_markup_escape_text(message, -1); |
a12574d982a1
merge of '6bf1ed8cefd6bb5b980baf7501bcf6936634bd8d'
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
1967 } else if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) { |
a12574d982a1
merge of '6bf1ed8cefd6bb5b980baf7501bcf6936634bd8d'
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
1968 PurpleStatus *status = purple_presence_get_status(presence, "tune"); |
a12574d982a1
merge of '6bf1ed8cefd6bb5b980baf7501bcf6936634bd8d'
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
1969 const char *title = purple_status_get_attr_string(status, PURPLE_TUNE_TITLE); |
a12574d982a1
merge of '6bf1ed8cefd6bb5b980baf7501bcf6936634bd8d'
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
1970 const char *artist = purple_status_get_attr_string(status, PURPLE_TUNE_ARTIST); |
a12574d982a1
merge of '6bf1ed8cefd6bb5b980baf7501bcf6936634bd8d'
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
1971 const char *album = purple_status_get_attr_string(status, PURPLE_TUNE_ALBUM); |
a12574d982a1
merge of '6bf1ed8cefd6bb5b980baf7501bcf6936634bd8d'
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
1972 ret = purple_util_format_song_info(title, artist, album, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1973 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1974 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1975 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1976 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1977 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1978 |
25972
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
1979 static void |
27014
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
26999
diff
changeset
|
1980 jabber_tooltip_add_resource_text(JabberBuddyResource *jbr, |
25972
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
1981 PurpleNotifyUserInfo *user_info, gboolean multiple_resources) |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
1982 { |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
1983 char *text = NULL; |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
1984 char *res = NULL; |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
1985 char *label, *value; |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
1986 const char *state; |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
1987 |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
1988 if(jbr->status) { |
27563
7a2891487a00
Don't pre-escape jbr->status. Almost every place required it in unescaped
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27514
diff
changeset
|
1989 text = g_markup_escape_text(jbr->status, -1); |
25972
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
1990 } |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
1991 |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
1992 if(jbr->name) |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
1993 res = g_strdup_printf(" (%s)", jbr->name); |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
1994 |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
1995 state = jabber_buddy_state_get_name(jbr->state); |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
1996 if (text != NULL && !purple_utf8_strcasecmp(state, text)) { |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
1997 g_free(text); |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
1998 text = NULL; |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
1999 } |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
2000 |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
2001 label = g_strdup_printf("%s%s", _("Status"), (res ? res : "")); |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
2002 value = g_strdup_printf("%s%s%s", state, (text ? ": " : ""), (text ? text : "")); |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
2003 |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
2004 purple_notify_user_info_add_pair(user_info, label, value); |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
2005 g_free(label); |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
2006 g_free(value); |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
2007 g_free(text); |
27014
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
26999
diff
changeset
|
2008 |
25972
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
2009 /* if the resource is idle, show that */ |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
2010 /* only show it if there is more than one resource available for |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
2011 the buddy, since the "general" idleness will be shown anyway, |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
2012 this way we can see see the idleness of lower-priority resources */ |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
2013 if (jbr->idle && multiple_resources) { |
27014
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
26999
diff
changeset
|
2014 gchar *idle_str = |
25972
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
2015 purple_str_seconds_to_string(time(NULL) - jbr->idle); |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
2016 label = g_strdup_printf("%s%s", _("Idle"), (res ? res : "")); |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
2017 purple_notify_user_info_add_pair(user_info, label, idle_str); |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
2018 g_free(idle_str); |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
2019 g_free(label); |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
2020 } |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
2021 g_free(res); |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
2022 } |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
2023 |
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
|
2024 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
|
2025 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2026 JabberBuddy *jb; |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
2027 PurpleAccount *account; |
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
2028 PurpleConnection *gc; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2029 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2030 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
|
2031 |
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
2032 account = purple_buddy_get_account(b); |
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
2033 g_return_if_fail(account != NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2034 |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
2035 gc = purple_account_get_connection(account); |
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
2036 g_return_if_fail(gc != NULL); |
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
2037 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
|
2038 |
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
2039 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
|
2040 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2041 if(jb) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2042 JabberBuddyResource *jbr = NULL; |
20571
c97e3ab9ef11
Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents:
20570
diff
changeset
|
2043 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
|
2044 const char *sub; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2045 GList *l; |
19722
eedf2918aace
Don't put "Mood: \(null\) \(null\)" on XMPP buddies
Sean Egan <seanegan@gmail.com>
parents:
19696
diff
changeset
|
2046 const char *mood; |
27014
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
26999
diff
changeset
|
2047 gboolean multiple_resources = |
25968
65f2c84f122f
Only show idle time for idle resources in tooltip text when there is more than
Marcus Lundblad <ml@update.uu.se>
parents:
25963
diff
changeset
|
2048 jb->resources && g_list_next(jb->resources); |
25972
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
2049 JabberBuddyResource *top_jbr = jabber_buddy_find_resource(jb, NULL); |
25974
8202f850ca9e
Remove some unused variables
Marcus Lundblad <ml@update.uu.se>
parents:
25973
diff
changeset
|
2050 |
25972
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
2051 /* resource-specific info for the top resource */ |
25975
1ad482221d70
Avoid crashing when showing the tooltip of an offline buddy, oops :)
Marcus Lundblad <ml@update.uu.se>
parents:
25974
diff
changeset
|
2052 if (top_jbr) { |
27014
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
26999
diff
changeset
|
2053 jabber_tooltip_add_resource_text(top_jbr, user_info, |
25975
1ad482221d70
Avoid crashing when showing the tooltip of an offline buddy, oops :)
Marcus Lundblad <ml@update.uu.se>
parents:
25974
diff
changeset
|
2054 multiple_resources); |
1ad482221d70
Avoid crashing when showing the tooltip of an offline buddy, oops :)
Marcus Lundblad <ml@update.uu.se>
parents:
25974
diff
changeset
|
2055 } |
25974
8202f850ca9e
Remove some unused variables
Marcus Lundblad <ml@update.uu.se>
parents:
25973
diff
changeset
|
2056 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2057 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
|
2058 jbr = l->data; |
25972
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
2059 /* the remaining resources */ |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
2060 if (jbr != top_jbr) { |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
2061 jabber_tooltip_add_resource_text(jbr, user_info, |
e3f2b16f75da
Always show the top resource first in the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25969
diff
changeset
|
2062 multiple_resources); |
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 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2065 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2066 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
|
2067 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
|
2068 |
20571
c97e3ab9ef11
Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents:
20570
diff
changeset
|
2069 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
|
2070 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
|
2071 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
|
2072 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
|
2073 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
|
2074 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
|
2075 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
|
2076 |
17573
2f067d8fb19a
Fixed a few small mistakes I discovered while testing user mood in Adium.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17572
diff
changeset
|
2077 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
|
2078 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
|
2079 } else |
2f067d8fb19a
Fixed a few small mistakes I discovered while testing user mood in Adium.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17572
diff
changeset
|
2080 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
|
2081 } |
22000
af0426c34c27
Utility functions to set and format song information. Closes #4398.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21978
diff
changeset
|
2082 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
|
2083 PurpleStatus *tune = purple_presence_get_status(presence, "tune"); |
c97e3ab9ef11
Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents:
20570
diff
changeset
|
2084 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
|
2085 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
|
2086 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
|
2087 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
|
2088 if (playing) { |
af0426c34c27
Utility functions to set and format song information. Closes #4398.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21978
diff
changeset
|
2089 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
|
2090 g_free(playing); |
af0426c34c27
Utility functions to set and format song information. Closes #4398.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21978
diff
changeset
|
2091 } |
20571
c97e3ab9ef11
Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents:
20570
diff
changeset
|
2092 } |
25969
a8224eb86581
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25968
diff
changeset
|
2093 |
a8224eb86581
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25968
diff
changeset
|
2094 if(jb->subscription & JABBER_SUB_FROM) { |
a8224eb86581
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25968
diff
changeset
|
2095 if(jb->subscription & JABBER_SUB_TO) |
a8224eb86581
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25968
diff
changeset
|
2096 sub = _("Both"); |
a8224eb86581
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25968
diff
changeset
|
2097 else if(jb->subscription & JABBER_SUB_PENDING) |
a8224eb86581
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25968
diff
changeset
|
2098 sub = _("From (To pending)"); |
a8224eb86581
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25968
diff
changeset
|
2099 else |
a8224eb86581
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25968
diff
changeset
|
2100 sub = _("From"); |
a8224eb86581
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25968
diff
changeset
|
2101 } else { |
a8224eb86581
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25968
diff
changeset
|
2102 if(jb->subscription & JABBER_SUB_TO) |
a8224eb86581
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25968
diff
changeset
|
2103 sub = _("To"); |
a8224eb86581
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25968
diff
changeset
|
2104 else if(jb->subscription & JABBER_SUB_PENDING) |
a8224eb86581
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25968
diff
changeset
|
2105 sub = _("None (To pending)"); |
a8224eb86581
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25968
diff
changeset
|
2106 else |
a8224eb86581
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25968
diff
changeset
|
2107 sub = _("None"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2108 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2109 |
25969
a8224eb86581
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25968
diff
changeset
|
2110 purple_notify_user_info_add_pair(user_info, _("Subscription"), sub); |
a8224eb86581
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <ml@update.uu.se>
parents:
25968
diff
changeset
|
2111 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2112 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2113 |
15823 | 2114 if(!PURPLE_BUDDY_IS_ONLINE(b) && jb->error_msg) { |
2115 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
|
2116 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2117 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2118 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2119 |
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
|
2120 GList *jabber_status_types(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2121 { |
15823 | 2122 PurpleStatusType *type; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2123 GList *types = NULL; |
15823 | 2124 PurpleValue *priority_value; |
24122
04d8a514d2bb
Updated support for XEP-0224.
Marcus Lundblad <ml@update.uu.se>
parents:
23988
diff
changeset
|
2125 PurpleValue *buzz_enabled; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2126 |
15823 | 2127 priority_value = purple_value_new(PURPLE_TYPE_INT); |
2128 purple_value_set_int(priority_value, 1); | |
24122
04d8a514d2bb
Updated support for XEP-0224.
Marcus Lundblad <ml@update.uu.se>
parents:
23988
diff
changeset
|
2129 buzz_enabled = purple_value_new(PURPLE_TYPE_BOOLEAN); |
04d8a514d2bb
Updated support for XEP-0224.
Marcus Lundblad <ml@update.uu.se>
parents:
23988
diff
changeset
|
2130 purple_value_set_boolean(buzz_enabled, TRUE); |
15823 | 2131 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
|
2132 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
|
2133 NULL, TRUE, TRUE, FALSE, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2134 "priority", _("Priority"), priority_value, |
15823 | 2135 "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
|
2136 "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
|
2137 "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
|
2138 "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
|
2139 "buzz", _("Allow Buzz"), buzz_enabled, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2140 NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2141 types = g_list_append(types, type); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2142 |
15823 | 2143 priority_value = purple_value_new(PURPLE_TYPE_INT); |
2144 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
|
2145 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
|
2146 purple_value_set_boolean(buzz_enabled, TRUE); |
15823 | 2147 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
|
2148 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
|
2149 _("Chatty"), TRUE, TRUE, FALSE, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2150 "priority", _("Priority"), priority_value, |
15823 | 2151 "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
|
2152 "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
|
2153 "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
|
2154 "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
|
2155 "buzz", _("Allow Buzz"), buzz_enabled, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2156 NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2157 types = g_list_append(types, type); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2158 |
15823 | 2159 priority_value = purple_value_new(PURPLE_TYPE_INT); |
2160 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
|
2161 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
|
2162 purple_value_set_boolean(buzz_enabled, TRUE); |
15823 | 2163 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
|
2164 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
|
2165 NULL, TRUE, TRUE, FALSE, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2166 "priority", _("Priority"), priority_value, |
15823 | 2167 "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
|
2168 "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
|
2169 "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
|
2170 "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
|
2171 "buzz", _("Allow Buzz"), buzz_enabled, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2172 NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2173 types = g_list_append(types, type); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2174 |
15823 | 2175 priority_value = purple_value_new(PURPLE_TYPE_INT); |
2176 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
|
2177 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
|
2178 purple_value_set_boolean(buzz_enabled, TRUE); |
15823 | 2179 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
|
2180 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
|
2181 NULL, TRUE, TRUE, FALSE, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2182 "priority", _("Priority"), priority_value, |
15823 | 2183 "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
|
2184 "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
|
2185 "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
|
2186 "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
|
2187 "buzz", _("Allow Buzz"), buzz_enabled, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2188 NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2189 types = g_list_append(types, type); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2190 |
15823 | 2191 priority_value = purple_value_new(PURPLE_TYPE_INT); |
2192 purple_value_set_int(priority_value, 0); | |
2193 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
|
2194 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
|
2195 _("Do Not Disturb"), TRUE, TRUE, FALSE, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2196 "priority", _("Priority"), priority_value, |
15823 | 2197 "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
|
2198 "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
|
2199 "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
|
2200 "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
|
2201 NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2202 types = g_list_append(types, type); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2203 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2204 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2205 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
|
2206 m = g_list_append(m, _("Invisible")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2207 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2208 |
15823 | 2209 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
|
2210 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
|
2211 NULL, TRUE, TRUE, FALSE, |
15823 | 2212 "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
|
2213 NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2214 types = g_list_append(types, type); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2215 |
20570
5913725cbcd6
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20076
diff
changeset
|
2216 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
|
2217 "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
|
2218 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
|
2219 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
|
2220 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
|
2221 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
|
2222 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
|
2223 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
|
2224 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
|
2225 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
|
2226 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
|
2227 NULL); |
5913725cbcd6
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20076
diff
changeset
|
2228 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
|
2229 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2230 return types; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2231 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2232 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2233 static void |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
2234 jabber_password_change_result_cb(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
2235 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
2236 xmlnode *packet, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2237 { |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
2238 if (type == JABBER_IQ_RESULT) { |
15823 | 2239 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
|
2240 _("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
|
2241 |
647b841ea945
This patch prevents changing the saved account password for XMPP accounts
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21000
diff
changeset
|
2242 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
|
2243 } 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
|
2244 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
|
2245 |
15823 | 2246 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
|
2247 _("Error changing password"), msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2248 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2249 } |
21058
647b841ea945
This patch prevents changing the saved account password for XMPP accounts
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21000
diff
changeset
|
2250 |
647b841ea945
This patch prevents changing the saved account password for XMPP accounts
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21000
diff
changeset
|
2251 g_free(data); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2252 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2253 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2254 static void jabber_password_change_cb(JabberStream *js, |
15823 | 2255 PurpleRequestFields *fields) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2256 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2257 const char *p1, *p2; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2258 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2259 xmlnode *query, *y; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2260 |
15823 | 2261 p1 = purple_request_fields_get_string(fields, "password1"); |
2262 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
|
2263 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2264 if(strcmp(p1, p2)) { |
15823 | 2265 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
|
2266 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2267 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2268 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2269 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
|
2270 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2271 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
|
2272 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2273 query = xmlnode_get_child(iq->node, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2274 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2275 y = xmlnode_new_child(query, "username"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2276 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
|
2277 y = xmlnode_new_child(query, "password"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2278 xmlnode_insert_data(y, p1, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2279 |
21058
647b841ea945
This patch prevents changing the saved account password for XMPP accounts
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21000
diff
changeset
|
2280 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
|
2281 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2282 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2283 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2284 |
15823 | 2285 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
|
2286 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2287 |
15823 | 2288 PurpleConnection *gc = (PurpleConnection *) action->context; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2289 JabberStream *js = gc->proto_data; |
15823 | 2290 PurpleRequestFields *fields; |
2291 PurpleRequestFieldGroup *group; | |
2292 PurpleRequestField *field; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2293 |
15823 | 2294 fields = purple_request_fields_new(); |
2295 group = purple_request_field_group_new(NULL); | |
2296 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
|
2297 |
15823 | 2298 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
|
2299 "", FALSE); |
15823 | 2300 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
|
2301 purple_request_field_set_required(field, TRUE); |
15823 | 2302 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
|
2303 |
15823 | 2304 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
|
2305 "", FALSE); |
15823 | 2306 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
|
2307 purple_request_field_set_required(field, TRUE); |
15823 | 2308 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
|
2309 |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
2310 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
|
2311 _("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
|
2312 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
|
2313 _("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
|
2314 purple_connection_get_account(gc), NULL, NULL, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
2315 js); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2316 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2317 |
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
|
2318 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
|
2319 { |
17575
5fc8a8a25008
Implemented a mood menu action (non-functional right now for some reason)
Andreas Monitzer <pidgin@monitzer.com>
parents:
17573
diff
changeset
|
2320 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
|
2321 JabberStream *js = gc->proto_data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2322 GList *m = NULL; |
15823 | 2323 PurplePluginAction *act; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2324 |
15823 | 2325 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
|
2326 jabber_setup_set_info); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2327 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2328 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2329 /* if (js->protocol_options & CHANGE_PASSWORD) { */ |
15823 | 2330 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
|
2331 jabber_password_change); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2332 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2333 /* } */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2334 |
15823 | 2335 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
|
2336 jabber_user_search_begin); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2337 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2338 |
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
|
2339 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
|
2340 |
17575
5fc8a8a25008
Implemented a mood menu action (non-functional right now for some reason)
Andreas Monitzer <pidgin@monitzer.com>
parents:
17573
diff
changeset
|
2341 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
|
2342 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
|
2343 |
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
|
2344 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
|
2345 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
|
2346 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2347 return m; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2348 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2349 |
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
|
2350 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
|
2351 { |
15823 | 2352 PurpleBlistNode *gnode, *cnode; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2353 JabberID *jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2354 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2355 if(!(jid = jabber_id_new(name))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2356 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2357 |
25289
aa876d48b5b2
Some more struct hiding.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24294
diff
changeset
|
2358 for(gnode = purple_blist_get_root(); gnode; |
aa876d48b5b2
Some more struct hiding.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24294
diff
changeset
|
2359 gnode = purple_blist_node_get_sibling_next(gnode)) { |
aa876d48b5b2
Some more struct hiding.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24294
diff
changeset
|
2360 for(cnode = purple_blist_node_get_first_child(gnode); |
aa876d48b5b2
Some more struct hiding.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24294
diff
changeset
|
2361 cnode; |
aa876d48b5b2
Some more struct hiding.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24294
diff
changeset
|
2362 cnode = purple_blist_node_get_sibling_next(cnode)) { |
15823 | 2363 PurpleChat *chat = (PurpleChat*)cnode; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2364 const char *room, *server; |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
2365 GHashTable *components; |
15823 | 2366 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
|
2367 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2368 |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
2369 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
|
2370 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2371 |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
2372 components = purple_chat_get_components(chat); |
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
2373 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
|
2374 continue; |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
2375 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
|
2376 continue; |
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 if(jid->node && jid->domain && |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2379 !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
|
2380 jabber_id_free(jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2381 return chat; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2382 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2383 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2384 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2385 jabber_id_free(jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2386 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2387 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2388 |
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
|
2389 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
|
2390 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2391 JabberStream *js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2392 JabberID *jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2393 JabberBuddy *jb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2394 JabberBuddyResource *jbr; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2395 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2396 if(!(jid = jabber_id_new(who))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2397 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2398 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2399 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
|
2400 (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
|
2401 if(jbr->thread_id) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2402 g_free(jbr->thread_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2403 jbr->thread_id = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2404 } |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2407 jabber_id_free(jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2408 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2409 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2410 |
20814
bde477ec6a71
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents:
20792
diff
changeset
|
2411 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
|
2412 xmlnode *packet, |
21358 | 2413 PurpleConnectionError *reason) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2414 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2415 xmlnode *error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2416 const char *code = NULL, *text = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2417 const char *xmlns = xmlnode_get_namespace(packet); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2418 char *cdata = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2419 |
20814
bde477ec6a71
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents:
20792
diff
changeset
|
2420 #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
|
2421 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
|
2422 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2423 if((error = xmlnode_get_child(packet, "error"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2424 cdata = xmlnode_get_data(error); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2425 code = xmlnode_get_attrib(error, "code"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2426 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2427 /* Stanza errors */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2428 if(xmlnode_get_child(error, "bad-request")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2429 text = _("Bad Request"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2430 } else if(xmlnode_get_child(error, "conflict")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2431 text = _("Conflict"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2432 } 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
|
2433 text = _("Feature Not Implemented"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2434 } else if(xmlnode_get_child(error, "forbidden")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2435 text = _("Forbidden"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2436 } else if(xmlnode_get_child(error, "gone")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2437 text = _("Gone"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2438 } 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
|
2439 text = _("Internal Server Error"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2440 } 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
|
2441 text = _("Item Not Found"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2442 } 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
|
2443 text = _("Malformed XMPP ID"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2444 } 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
|
2445 text = _("Not Acceptable"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2446 } 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
|
2447 text = _("Not Allowed"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2448 } 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
|
2449 text = _("Not Authorized"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2450 } 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
|
2451 text = _("Payment Required"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2452 } 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
|
2453 text = _("Recipient Unavailable"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2454 } else if(xmlnode_get_child(error, "redirect")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2455 /* XXX */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2456 } 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
|
2457 text = _("Registration Required"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2458 } 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
|
2459 text = _("Remote Server Not Found"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2460 } 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
|
2461 text = _("Remote Server Timeout"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2462 } 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
|
2463 text = _("Server Overloaded"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2464 } 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
|
2465 text = _("Service Unavailable"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2466 } 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
|
2467 text = _("Subscription Required"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2468 } 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
|
2469 text = _("Unexpected Request"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2470 } 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
|
2471 text = _("Unknown Error"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2472 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2473 } 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
|
2474 /* 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
|
2475 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
|
2476 if(xmlnode_get_child(packet, "aborted")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2477 text = _("Authorization Aborted"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2478 } 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
|
2479 text = _("Incorrect encoding in authorization"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2480 } 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
|
2481 text = _("Invalid authzid"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2482 } 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
|
2483 text = _("Invalid Authorization Mechanism"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2484 } 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
|
2485 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
|
2486 text = _("Authorization mechanism too weak"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2487 } 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
|
2488 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
|
2489 /* 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
|
2490 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
|
2491 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
|
2492 text = _("Not Authorized"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2493 } 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
|
2494 text = _("Temporary Authentication Failure"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2495 } 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
|
2496 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
|
2497 text = _("Authentication Failure"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2498 } |
15918
4be5d38ee117
Correctly handle the Jabber disconnection error for signing onto the
Mark Doliner <mark@kingant.net>
parents:
15916
diff
changeset
|
2499 } 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
|
2500 (!strcmp(packet->name, "error") && xmlns && |
15919 | 2501 !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
|
2502 /* Most common reason as default: */ |
21358 | 2503 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
|
2504 if(xmlnode_get_child(packet, "bad-format")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2505 text = _("Bad Format"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2506 } 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
|
2507 text = _("Bad Namespace Prefix"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2508 } else if(xmlnode_get_child(packet, "conflict")) { |
21358 | 2509 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
|
2510 text = _("Resource Conflict"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2511 } 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
|
2512 text = _("Connection Timeout"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2513 } 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
|
2514 text = _("Host Gone"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2515 } 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
|
2516 text = _("Host Unknown"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2517 } 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
|
2518 text = _("Improper Addressing"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2519 } 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
|
2520 text = _("Internal Server Error"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2521 } 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
|
2522 text = _("Invalid ID"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2523 } 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
|
2524 text = _("Invalid Namespace"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2525 } 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
|
2526 text = _("Invalid XML"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2527 } 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
|
2528 text = _("Non-matching Hosts"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2529 } 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
|
2530 text = _("Not Authorized"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2531 } 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
|
2532 text = _("Policy Violation"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2533 } 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
|
2534 text = _("Remote Connection Failed"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2535 } 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
|
2536 text = _("Resource Constraint"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2537 } 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
|
2538 text = _("Restricted XML"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2539 } 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
|
2540 text = _("See Other Host"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2541 } 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
|
2542 text = _("System Shutdown"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2543 } 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
|
2544 text = _("Undefined Condition"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2545 } 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
|
2546 text = _("Unsupported Encoding"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2547 } 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
|
2548 text = _("Unsupported Stanza Type"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2549 } 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
|
2550 text = _("Unsupported Version"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2551 } 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
|
2552 text = _("XML Not Well Formed"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2553 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2554 text = _("Stream Error"); |
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 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2557 |
20814
bde477ec6a71
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents:
20792
diff
changeset
|
2558 #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
|
2559 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2560 if(text || cdata) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2561 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
|
2562 code ? ": " : "", text ? text : cdata); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2563 g_free(cdata); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2564 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2565 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2566 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2567 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2568 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2569 |
15823 | 2570 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
|
2571 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
|
2572 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2573 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
|
2574 |
259f8635eeff
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents:
18323
diff
changeset
|
2575 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
|
2576 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
|
2577 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2578 jabber_chat_request_room_configure(chat); |
15823 | 2579 return PURPLE_CMD_RET_OK; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2580 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2581 |
15823 | 2582 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
|
2583 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
|
2584 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2585 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
|
2586 |
259f8635eeff
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents:
18323
diff
changeset
|
2587 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
|
2588 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
|
2589 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2590 jabber_chat_register(chat); |
15823 | 2591 return PURPLE_CMD_RET_OK; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2592 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2593 |
15823 | 2594 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
|
2595 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
|
2596 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2597 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
|
2598 |
259f8635eeff
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents:
18323
diff
changeset
|
2599 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
|
2600 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
|
2601 |
26766
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26649
diff
changeset
|
2602 if (args && args[0] && *args[0]) |
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26649
diff
changeset
|
2603 jabber_chat_change_topic(chat, args[0]); |
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26649
diff
changeset
|
2604 else { |
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26649
diff
changeset
|
2605 const char *cur = purple_conv_chat_get_topic(PURPLE_CONV_CHAT(conv)); |
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26649
diff
changeset
|
2606 char *buf, *tmp, *tmp2; |
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26649
diff
changeset
|
2607 |
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26649
diff
changeset
|
2608 if (cur) { |
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26649
diff
changeset
|
2609 tmp = g_markup_escape_text(cur, -1); |
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26649
diff
changeset
|
2610 tmp2 = purple_markup_linkify(tmp); |
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26649
diff
changeset
|
2611 buf = g_strdup_printf(_("current topic is: %s"), tmp2); |
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26649
diff
changeset
|
2612 g_free(tmp); |
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26649
diff
changeset
|
2613 g_free(tmp2); |
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26649
diff
changeset
|
2614 } else |
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26649
diff
changeset
|
2615 buf = g_strdup(_("No topic is set")); |
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26649
diff
changeset
|
2616 purple_conv_chat_write(PURPLE_CONV_CHAT(conv), "", buf, |
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26649
diff
changeset
|
2617 PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG, time(NULL)); |
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26649
diff
changeset
|
2618 g_free(buf); |
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26649
diff
changeset
|
2619 } |
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26649
diff
changeset
|
2620 |
15823 | 2621 return PURPLE_CMD_RET_OK; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2622 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2623 |
15823 | 2624 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
|
2625 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
|
2626 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2627 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
|
2628 |
18711
259f8635eeff
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents:
18323
diff
changeset
|
2629 if(!chat || !args || !args[0]) |
15823 | 2630 return PURPLE_CMD_RET_FAILED; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2631 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2632 jabber_chat_change_nick(chat, args[0]); |
15823 | 2633 return PURPLE_CMD_RET_OK; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2634 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2635 |
15823 | 2636 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
|
2637 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
|
2638 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2639 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
|
2640 |
259f8635eeff
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents:
18323
diff
changeset
|
2641 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
|
2642 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
|
2643 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2644 jabber_chat_part(chat, args ? args[0] : NULL); |
15823 | 2645 return PURPLE_CMD_RET_OK; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2646 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2647 |
15823 | 2648 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
|
2649 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
|
2650 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2651 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
|
2652 |
18711
259f8635eeff
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents:
18323
diff
changeset
|
2653 if(!chat || !args || !args[0]) |
15823 | 2654 return PURPLE_CMD_RET_FAILED; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2655 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2656 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
|
2657 *error = g_strdup_printf(_("Unable to ban user %s"), args[0]); |
15823 | 2658 return PURPLE_CMD_RET_FAILED; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2659 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2660 |
15823 | 2661 return PURPLE_CMD_RET_OK; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2662 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2663 |
15823 | 2664 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
|
2665 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
|
2666 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2667 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
|
2668 |
26884
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2669 if (!chat || !args || !args[0]) |
15823 | 2670 return PURPLE_CMD_RET_FAILED; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2671 |
26884
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2672 if (strcmp(args[0], "owner") != 0 && |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2673 strcmp(args[0], "admin") != 0 && |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2674 strcmp(args[0], "member") != 0 && |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2675 strcmp(args[0], "outcast") != 0 && |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2676 strcmp(args[0], "none") != 0) { |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2677 *error = g_strdup_printf(_("Unknown affiliation: \"%s\""), args[0]); |
15823 | 2678 return PURPLE_CMD_RET_FAILED; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2679 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2680 |
26884
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2681 if (args[1]) { |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2682 int i; |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2683 char **nicks = g_strsplit(args[1], " ", -1); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2684 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2685 for (i = 0; nicks[i]; ++i) |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2686 if (!jabber_chat_affiliate_user(chat, nicks[i], args[0])) { |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2687 *error = g_strdup_printf(_("Unable to affiliate user %s as \"%s\""), nicks[i], args[0]); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2688 g_strfreev(nicks); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2689 return PURPLE_CMD_RET_FAILED; |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2690 } |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2691 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2692 g_strfreev(nicks); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2693 } else { |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2694 jabber_chat_affiliation_list(chat, args[0]); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2695 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2696 |
15823 | 2697 return PURPLE_CMD_RET_OK; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2698 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2699 |
15823 | 2700 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
|
2701 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
|
2702 { |
18855
28a7c9dbbc2b
Fix uninitialized variable access.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18711
diff
changeset
|
2703 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
|
2704 |
26884
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2705 if (!chat || !args || !args[0]) |
15823 | 2706 return PURPLE_CMD_RET_FAILED; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2707 |
26884
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2708 if (strcmp(args[0], "moderator") != 0 && |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2709 strcmp(args[0], "participant") != 0 && |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2710 strcmp(args[0], "visitor") != 0 && |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2711 strcmp(args[0], "none") != 0) { |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2712 *error = g_strdup_printf(_("Unknown role: \"%s\""), args[0]); |
15823 | 2713 return PURPLE_CMD_RET_FAILED; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2714 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2715 |
26884
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2716 if (args[1]) { |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2717 int i; |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2718 char **nicks = g_strsplit(args[1], " ", -1); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2719 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2720 for (i = 0; nicks[i]; i++) |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2721 if (!jabber_chat_role_user(chat, nicks[i], args[0])) { |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2722 *error = g_strdup_printf(_("Unable to set role \"%s\" for user: %s"), |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2723 args[0], nicks[i]); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2724 return PURPLE_CMD_RET_FAILED; |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2725 } |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2726 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2727 g_strfreev(nicks); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2728 } else { |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
2729 jabber_chat_role_list(chat, args[0]); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2730 } |
15823 | 2731 return PURPLE_CMD_RET_OK; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2732 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2733 |
15823 | 2734 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
|
2735 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
|
2736 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2737 if(!args || !args[0]) |
15823 | 2738 return PURPLE_CMD_RET_FAILED; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2739 |
15823 | 2740 jabber_chat_invite(purple_conversation_get_gc(conv), |
2741 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
|
2742 args[0]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2743 |
15823 | 2744 return PURPLE_CMD_RET_OK; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2745 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2746 |
15823 | 2747 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
|
2748 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
|
2749 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2750 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
|
2751 GHashTable *components; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2752 |
18711
259f8635eeff
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents:
18323
diff
changeset
|
2753 if(!chat || !args || !args[0]) |
15823 | 2754 return PURPLE_CMD_RET_FAILED; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2755 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2756 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
|
2757 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2758 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
|
2759 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
|
2760 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
|
2761 if(args[1]) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2762 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
|
2763 |
15823 | 2764 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
|
2765 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2766 g_hash_table_destroy(components); |
15823 | 2767 return PURPLE_CMD_RET_OK; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2768 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2769 |
15823 | 2770 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
|
2771 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
|
2772 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2773 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
|
2774 |
18711
259f8635eeff
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents:
18323
diff
changeset
|
2775 if(!chat || !args || !args[0]) |
15823 | 2776 return PURPLE_CMD_RET_FAILED; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2777 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2778 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
|
2779 *error = g_strdup_printf(_("Unable to kick user %s"), args[0]); |
15823 | 2780 return PURPLE_CMD_RET_FAILED; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2781 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2782 |
15823 | 2783 return PURPLE_CMD_RET_OK; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2784 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2785 |
15823 | 2786 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
|
2787 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
|
2788 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2789 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
|
2790 char *who; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2791 |
18711
259f8635eeff
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents:
18323
diff
changeset
|
2792 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
|
2793 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
|
2794 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2795 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
|
2796 |
15823 | 2797 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
|
2798 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2799 g_free(who); |
15823 | 2800 return PURPLE_CMD_RET_OK; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2801 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2802 |
17562
6ab1089e2101
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents:
17561
diff
changeset
|
2803 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
|
2804 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
|
2805 { |
25984
d24b476cc60f
Fix merge (i.e. reapply my changes here).
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
2806 PurpleAccount *account; |
d24b476cc60f
Fix merge (i.e. reapply my changes here).
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
2807 PurpleConnection *pc; |
d24b476cc60f
Fix merge (i.e. reapply my changes here).
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
2808 |
17562
6ab1089e2101
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents:
17561
diff
changeset
|
2809 if(!args || !args[0]) |
6ab1089e2101
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents:
17561
diff
changeset
|
2810 return PURPLE_CMD_RET_FAILED; |
6ab1089e2101
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents:
17561
diff
changeset
|
2811 |
25984
d24b476cc60f
Fix merge (i.e. reapply my changes here).
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
2812 account = purple_conversation_get_account(conv); |
d24b476cc60f
Fix merge (i.e. reapply my changes here).
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
2813 pc = purple_account_get_connection(account); |
d24b476cc60f
Fix merge (i.e. reapply my changes here).
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
2814 |
d24b476cc60f
Fix merge (i.e. reapply my changes here).
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
2815 if(!jabber_ping_jid(purple_connection_get_protocol_data(pc), args[0])) { |
17562
6ab1089e2101
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents:
17561
diff
changeset
|
2816 *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
|
2817 return PURPLE_CMD_RET_FAILED; |
6ab1089e2101
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents:
17561
diff
changeset
|
2818 } |
6ab1089e2101
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents:
17561
diff
changeset
|
2819 |
6ab1089e2101
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents:
17561
diff
changeset
|
2820 return PURPLE_CMD_RET_OK; |
6ab1089e2101
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents:
17561
diff
changeset
|
2821 } |
6ab1089e2101
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents:
17561
diff
changeset
|
2822 |
20852
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2823 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
|
2824 |
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2825 JabberBuddy *jb; |
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2826 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
|
2827 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
|
2828 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
|
2829 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
|
2830 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
|
2831 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
|
2832 |
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2833 if(!username) |
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2834 return FALSE; |
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2835 |
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2836 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
|
2837 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
|
2838 *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
|
2839 "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
|
2840 return FALSE; |
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2841 } |
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2842 |
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2843 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
|
2844 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
|
2845 *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
|
2846 alias); |
20852
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2847 return FALSE; |
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2848 } |
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2849 |
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
|
2850 if (jabber_resource_has_capability(jbr, XEP_0224_NAMESPACE)) { |
a64d90cff01f
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <ml@update.uu.se>
parents:
24123
diff
changeset
|
2851 xmlnode *buzz, *msg = xmlnode_new("message"); |
a64d90cff01f
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <ml@update.uu.se>
parents:
24123
diff
changeset
|
2852 gchar *to; |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25442
diff
changeset
|
2853 |
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
|
2854 to = g_strdup_printf("%s/%s", username, jbr->name); |
a64d90cff01f
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <ml@update.uu.se>
parents:
24123
diff
changeset
|
2855 xmlnode_set_attrib(msg, "to", to); |
a64d90cff01f
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <ml@update.uu.se>
parents:
24123
diff
changeset
|
2856 g_free(to); |
20852
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2857 |
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
|
2858 /* avoid offline storage */ |
a64d90cff01f
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <ml@update.uu.se>
parents:
24123
diff
changeset
|
2859 xmlnode_set_attrib(msg, "type", "headline"); |
20852
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2860 |
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
|
2861 buzz = xmlnode_new_child(msg, "attention"); |
a64d90cff01f
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <ml@update.uu.se>
parents:
24123
diff
changeset
|
2862 xmlnode_set_namespace(buzz, XEP_0224_NAMESPACE); |
20852
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2863 |
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
|
2864 jabber_send(js, msg); |
a64d90cff01f
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <ml@update.uu.se>
parents:
24123
diff
changeset
|
2865 xmlnode_free(msg); |
20852
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2866 |
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
|
2867 return TRUE; |
a64d90cff01f
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <ml@update.uu.se>
parents:
24123
diff
changeset
|
2868 } 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
|
2869 *error = g_strdup_printf(_("Unable to buzz, because %s does " |
25985
7ace7bf0bfad
Use "does" here sounds more natural to me
Mark Doliner <mark@kingant.net>
parents:
25443
diff
changeset
|
2870 "not support it or does 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
|
2871 return FALSE; |
20852
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2872 } |
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2873 } |
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2874 |
17615
cca457b9158b
disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents:
17614
diff
changeset
|
2875 static PurpleCmdRet jabber_cmd_buzz(PurpleConversation *conv, |
cca457b9158b
disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents:
17614
diff
changeset
|
2876 const char *cmd, char **args, char **error, void *data) |
cca457b9158b
disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents:
17614
diff
changeset
|
2877 { |
cca457b9158b
disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents:
17614
diff
changeset
|
2878 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
|
2879 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
|
2880 |
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
|
2881 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
|
2882 /* 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
|
2883 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
|
2884 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
|
2885 } 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
|
2886 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
|
2887 } |
a64d90cff01f
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <ml@update.uu.se>
parents:
24123
diff
changeset
|
2888 } 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
|
2889 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
|
2890 } |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25442
diff
changeset
|
2891 |
25197
8dee1fb9d8e9
Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <ml@update.uu.se>
parents:
25196
diff
changeset
|
2892 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
|
2893 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
|
2894 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
|
2895 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
|
2896 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
|
2897 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
|
2898 |
25197
8dee1fb9d8e9
Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <ml@update.uu.se>
parents:
25196
diff
changeset
|
2899 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
|
2900 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
|
2901 else |
8dee1fb9d8e9
Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <ml@update.uu.se>
parents:
25196
diff
changeset
|
2902 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
|
2903 |
25197
8dee1fb9d8e9
Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <ml@update.uu.se>
parents:
25196
diff
changeset
|
2904 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
|
2905 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
|
2906 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
|
2907 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
|
2908 |
25197
8dee1fb9d8e9
Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <ml@update.uu.se>
parents:
25196
diff
changeset
|
2909 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
|
2910 } else { |
17615
cca457b9158b
disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents:
17614
diff
changeset
|
2911 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
|
2912 } |
17615
cca457b9158b
disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents:
17614
diff
changeset
|
2913 } |
cca457b9158b
disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents:
17614
diff
changeset
|
2914 |
20149
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2915 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
|
2916 { |
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2917 static GList *types = NULL; |
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2918 |
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2919 if (!types) { |
22097
eab7d03edfcb
This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22034
diff
changeset
|
2920 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
|
2921 _("%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
|
2922 } |
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2923 |
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2924 return types; |
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2925 } |
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2926 |
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2927 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
|
2928 { |
20852
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2929 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
|
2930 gchar *error = NULL; |
20149
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2931 |
20852
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2932 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
|
2933 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
|
2934 g_free(error); |
20149
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2935 return FALSE; |
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2936 } |
20852
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2937 |
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2938 return TRUE; |
20149
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2939 } |
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2940 |
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2941 |
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
|
2942 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
|
2943 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2944 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2945 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2946 |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2947 #ifdef USE_VV |
26539
20743d9bd62d
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents:
26536
diff
changeset
|
2948 gboolean |
20743d9bd62d
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents:
26536
diff
changeset
|
2949 jabber_audio_enabled(JabberStream *js, const char *namespace) |
26535
ecf6fd808d23
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <paul@darkrain42.org>
parents:
26533
diff
changeset
|
2950 { |
ecf6fd808d23
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <paul@darkrain42.org>
parents:
26533
diff
changeset
|
2951 PurpleMediaManager *manager = purple_media_manager_get(); |
ecf6fd808d23
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <paul@darkrain42.org>
parents:
26533
diff
changeset
|
2952 PurpleMediaCaps caps = purple_media_manager_get_ui_caps(manager); |
ecf6fd808d23
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <paul@darkrain42.org>
parents:
26533
diff
changeset
|
2953 |
ecf6fd808d23
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <paul@darkrain42.org>
parents:
26533
diff
changeset
|
2954 return (caps & (PURPLE_MEDIA_CAPS_AUDIO | PURPLE_MEDIA_CAPS_AUDIO_SINGLE_DIRECTION)); |
ecf6fd808d23
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <paul@darkrain42.org>
parents:
26533
diff
changeset
|
2955 } |
ecf6fd808d23
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <paul@darkrain42.org>
parents:
26533
diff
changeset
|
2956 |
27079
72bcdcb0629f
Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27069
diff
changeset
|
2957 gboolean |
26539
20743d9bd62d
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents:
26536
diff
changeset
|
2958 jabber_video_enabled(JabberStream *js, const char *namespace) |
26535
ecf6fd808d23
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <paul@darkrain42.org>
parents:
26533
diff
changeset
|
2959 { |
ecf6fd808d23
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <paul@darkrain42.org>
parents:
26533
diff
changeset
|
2960 PurpleMediaManager *manager = purple_media_manager_get(); |
ecf6fd808d23
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <paul@darkrain42.org>
parents:
26533
diff
changeset
|
2961 PurpleMediaCaps caps = purple_media_manager_get_ui_caps(manager); |
ecf6fd808d23
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <paul@darkrain42.org>
parents:
26533
diff
changeset
|
2962 |
ecf6fd808d23
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <paul@darkrain42.org>
parents:
26533
diff
changeset
|
2963 return (caps & (PURPLE_MEDIA_CAPS_VIDEO | PURPLE_MEDIA_CAPS_VIDEO_SINGLE_DIRECTION)); |
ecf6fd808d23
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <paul@darkrain42.org>
parents:
26533
diff
changeset
|
2964 } |
ecf6fd808d23
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <paul@darkrain42.org>
parents:
26533
diff
changeset
|
2965 |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2966 typedef struct { |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
2967 PurpleAccount *account; |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2968 gchar *who; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2969 PurpleMediaSessionType type; |
27014
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
26999
diff
changeset
|
2970 |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2971 } JabberMediaRequest; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2972 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2973 static void |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2974 jabber_media_cancel_cb(JabberMediaRequest *request, |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2975 PurpleRequestFields *fields) |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2976 { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2977 g_free(request->who); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2978 g_free(request); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2979 } |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2980 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2981 static void |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2982 jabber_media_ok_cb(JabberMediaRequest *request, PurpleRequestFields *fields) |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2983 { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2984 PurpleRequestField *field = |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2985 purple_request_fields_get_field(fields, "resource"); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2986 int selected_id = purple_request_field_choice_get_value(field); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2987 GList *labels = purple_request_field_choice_get_labels(field); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2988 gchar *who = g_strdup_printf("%s/%s", request->who, |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2989 (gchar*)g_list_nth_data(labels, selected_id)); |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
2990 jabber_initiate_media(request->account, who, request->type); |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2991 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2992 g_free(who); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2993 g_free(request->who); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2994 g_free(request); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2995 } |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2996 #endif |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2997 |
26447
34eb898478b4
Don't assume a PurpleMedia instance will be created immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26417
diff
changeset
|
2998 gboolean |
27014
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
26999
diff
changeset
|
2999 jabber_initiate_media(PurpleAccount *account, const char *who, |
25720
551a462b346a
Changed PurpleMediaStreamType to PurpleMediaSessionType.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25718
diff
changeset
|
3000 PurpleMediaSessionType type) |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25635
diff
changeset
|
3001 { |
26416
6f0200f1e497
Clean up usage of USE_VV in the XMPP protocol.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26361
diff
changeset
|
3002 #ifdef USE_VV |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
3003 JabberStream *js = (JabberStream *) |
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
3004 purple_account_get_connection(account)->proto_data; |
26081
44a528094cbf
Support initiating voice calls to GTalk and Gmail.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26062
diff
changeset
|
3005 JabberBuddy *jb; |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3006 JabberBuddyResource *jbr = NULL; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3007 char *resource; |
26081
44a528094cbf
Support initiating voice calls to GTalk and Gmail.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26062
diff
changeset
|
3008 |
44a528094cbf
Support initiating voice calls to GTalk and Gmail.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26062
diff
changeset
|
3009 if (!js) { |
44a528094cbf
Support initiating voice calls to GTalk and Gmail.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26062
diff
changeset
|
3010 purple_debug_error("jabber", |
44a528094cbf
Support initiating voice calls to GTalk and Gmail.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26062
diff
changeset
|
3011 "jabber_initiate_media: NULL stream\n"); |
26447
34eb898478b4
Don't assume a PurpleMedia instance will be created immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26417
diff
changeset
|
3012 return FALSE; |
26081
44a528094cbf
Support initiating voice calls to GTalk and Gmail.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26062
diff
changeset
|
3013 } |
44a528094cbf
Support initiating voice calls to GTalk and Gmail.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26062
diff
changeset
|
3014 |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3015 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3016 if((resource = jabber_get_resource(who)) != NULL) { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3017 /* they've specified a resource, no need to ask or |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3018 * default or anything, just do it */ |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3019 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3020 jb = jabber_buddy_find(js, who, FALSE); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3021 jbr = jabber_buddy_find_resource(jb, resource); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3022 g_free(resource); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3023 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3024 if (type & PURPLE_MEDIA_AUDIO && |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3025 !jabber_resource_has_capability(jbr, |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3026 JINGLE_APP_RTP_SUPPORT_AUDIO) && |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3027 jabber_resource_has_capability(jbr, |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3028 GOOGLE_VOICE_CAP)) |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
3029 return jabber_google_session_initiate(js, who, type); |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3030 else |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
3031 return jingle_rtp_initiate_media(js, who, type); |
26081
44a528094cbf
Support initiating voice calls to GTalk and Gmail.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26062
diff
changeset
|
3032 } |
44a528094cbf
Support initiating voice calls to GTalk and Gmail.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26062
diff
changeset
|
3033 |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3034 jb = jabber_buddy_find(js, who, FALSE); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3035 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3036 if(!jb || !jb->resources) { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3037 /* no resources online, we're trying to initiate with someone |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3038 * whose presence we're not subscribed to, or |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3039 * someone who is offline. Let's inform the user */ |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3040 char *msg; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3041 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3042 if(!jb) { |
26518
28f1512b0f94
Minor grammatical message fixes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26514
diff
changeset
|
3043 msg = g_strdup_printf(_("Unable to initiate media with %s: invalid JID"), who); |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3044 } else if(jb->subscription & JABBER_SUB_TO) { |
26518
28f1512b0f94
Minor grammatical message fixes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26514
diff
changeset
|
3045 msg = g_strdup_printf(_("Unable to initiate media with %s: user is not online"), who); |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3046 } else { |
26518
28f1512b0f94
Minor grammatical message fixes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26514
diff
changeset
|
3047 msg = g_strdup_printf(_("Unable to initiate media with %s: not subscribed to user presence"), who); |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3048 } |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3049 |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
3050 purple_notify_error(account, _("Media Initiation Failed"), |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3051 _("Media Initiation Failed"), msg); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3052 g_free(msg); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3053 return FALSE; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3054 } else if(!jb->resources->next) { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3055 /* only 1 resource online (probably our most common case) |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3056 * so no need to ask who to initiate with */ |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3057 gchar *name; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3058 gboolean result; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3059 jbr = jb->resources->data; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3060 name = g_strdup_printf("%s/%s", who, jbr->name); |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
3061 result = jabber_initiate_media(account, name, type); |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3062 g_free(name); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3063 return result; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3064 } else { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3065 /* we've got multiple resources, |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3066 * we need to pick one to initiate with */ |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3067 GList *l; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3068 char *msg; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3069 PurpleRequestFields *fields; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3070 PurpleRequestField *field = purple_request_field_choice_new( |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3071 "resource", _("Resource"), 0); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3072 PurpleRequestFieldGroup *group; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3073 JabberMediaRequest *request; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3074 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3075 for(l = jb->resources; l; l = l->next) |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3076 { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3077 JabberBuddyResource *ljbr = l->data; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3078 PurpleMediaCaps caps; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3079 gchar *name; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3080 name = g_strdup_printf("%s/%s", who, ljbr->name); |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
3081 caps = jabber_get_media_caps(account, name); |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3082 g_free(name); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3083 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3084 if ((type & PURPLE_MEDIA_AUDIO) && |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3085 (type & PURPLE_MEDIA_VIDEO)) { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3086 if (caps & PURPLE_MEDIA_CAPS_AUDIO_VIDEO) { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3087 jbr = ljbr; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3088 purple_request_field_choice_add( |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3089 field, jbr->name); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3090 } |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3091 } else if (type & (PURPLE_MEDIA_AUDIO) && |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3092 (caps & PURPLE_MEDIA_CAPS_AUDIO)) { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3093 jbr = ljbr; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3094 purple_request_field_choice_add( |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3095 field, jbr->name); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3096 }else if (type & (PURPLE_MEDIA_VIDEO) && |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3097 (caps & PURPLE_MEDIA_CAPS_VIDEO)) { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3098 jbr = ljbr; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3099 purple_request_field_choice_add( |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3100 field, jbr->name); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3101 } |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3102 } |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3103 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3104 if (jbr == NULL) { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3105 purple_debug_error("jabber", |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3106 "No resources available\n"); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3107 return FALSE; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3108 } |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3109 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3110 if (g_list_length(purple_request_field_choice_get_labels( |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3111 field)) <= 1) { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3112 gchar *name; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3113 gboolean result; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3114 purple_request_field_destroy(field); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3115 name = g_strdup_printf("%s/%s", who, jbr->name); |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
3116 result = jabber_initiate_media(account, name, type); |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3117 g_free(name); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3118 return result; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3119 } |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3120 |
26518
28f1512b0f94
Minor grammatical message fixes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26514
diff
changeset
|
3121 msg = g_strdup_printf(_("Please select the resource of %s with which you would like to start a media session."), who); |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3122 fields = purple_request_fields_new(); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3123 group = purple_request_field_group_new(NULL); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3124 request = g_new0(JabberMediaRequest, 1); |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
3125 request->account = account; |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3126 request->who = g_strdup(who); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3127 request->type = type; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3128 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3129 purple_request_field_group_add_field(group, field); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3130 purple_request_fields_add_group(fields, group); |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
3131 purple_request_fields(account, _("Select a Resource"), msg, |
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
3132 NULL, fields, _("Initiate Media"), |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3133 G_CALLBACK(jabber_media_ok_cb), _("Cancel"), |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3134 G_CALLBACK(jabber_media_cancel_cb), |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
3135 account, who, NULL, request); |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3136 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3137 g_free(msg); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3138 return TRUE; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3139 } |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3140 #endif |
26447
34eb898478b4
Don't assume a PurpleMedia instance will be created immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26417
diff
changeset
|
3141 return FALSE; |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25635
diff
changeset
|
3142 } |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25635
diff
changeset
|
3143 |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
3144 PurpleMediaCaps jabber_get_media_caps(PurpleAccount *account, const char *who) |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25635
diff
changeset
|
3145 { |
26416
6f0200f1e497
Clean up usage of USE_VV in the XMPP protocol.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26361
diff
changeset
|
3146 #ifdef USE_VV |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
3147 JabberStream *js = (JabberStream *) |
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
3148 purple_account_get_connection(account)->proto_data; |
25665
1f085713c281
Fix crash bug when checking if a contact can do media when logging out.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25664
diff
changeset
|
3149 JabberBuddy *jb; |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3150 JabberBuddyResource *jbr; |
26190
d6e23439b77c
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26168
diff
changeset
|
3151 PurpleMediaCaps caps = PURPLE_MEDIA_CAPS_NONE; |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3152 gchar *resource; |
25665
1f085713c281
Fix crash bug when checking if a contact can do media when logging out.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25664
diff
changeset
|
3153 |
1f085713c281
Fix crash bug when checking if a contact can do media when logging out.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25664
diff
changeset
|
3154 if (!js) { |
26500
da651b0f40a1
Demote debug error to info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26447
diff
changeset
|
3155 purple_debug_info("jabber", |
da651b0f40a1
Demote debug error to info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26447
diff
changeset
|
3156 "jabber_can_do_media: NULL stream\n"); |
25665
1f085713c281
Fix crash bug when checking if a contact can do media when logging out.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25664
diff
changeset
|
3157 return FALSE; |
1f085713c281
Fix crash bug when checking if a contact can do media when logging out.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25664
diff
changeset
|
3158 } |
1f085713c281
Fix crash bug when checking if a contact can do media when logging out.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25664
diff
changeset
|
3159 |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3160 if ((resource = jabber_get_resource(who)) != NULL) { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3161 /* they've specified a resource, no need to ask or |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3162 * default or anything, just do it */ |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3163 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3164 jb = jabber_buddy_find(js, who, FALSE); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3165 jbr = jabber_buddy_find_resource(jb, resource); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3166 g_free(resource); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3167 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3168 if (!jbr) { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3169 purple_debug_error("jabber", "jabber_get_media_caps:" |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3170 " Can't find resource %s\n", who); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3171 return caps; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3172 } |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3173 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3174 if (jabber_resource_has_capability(jbr, |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3175 JINGLE_APP_RTP_SUPPORT_AUDIO)) |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3176 caps |= PURPLE_MEDIA_CAPS_AUDIO_SINGLE_DIRECTION | |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3177 PURPLE_MEDIA_CAPS_AUDIO; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3178 if (jabber_resource_has_capability(jbr, |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3179 JINGLE_APP_RTP_SUPPORT_VIDEO)) |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3180 caps |= PURPLE_MEDIA_CAPS_VIDEO_SINGLE_DIRECTION | |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3181 PURPLE_MEDIA_CAPS_VIDEO; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3182 if (caps & PURPLE_MEDIA_CAPS_AUDIO && caps & |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3183 PURPLE_MEDIA_CAPS_VIDEO) |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3184 caps |= PURPLE_MEDIA_CAPS_AUDIO_VIDEO; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3185 if (caps != PURPLE_MEDIA_CAPS_NONE) { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3186 if (!jabber_resource_has_capability(jbr, |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3187 JINGLE_TRANSPORT_ICEUDP) && |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3188 !jabber_resource_has_capability(jbr, |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3189 JINGLE_TRANSPORT_RAWUDP)) { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3190 purple_debug_info("jingle-rtp", "Buddy doesn't " |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3191 "support the same transport types\n"); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3192 caps = PURPLE_MEDIA_CAPS_NONE; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3193 } else |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3194 caps |= PURPLE_MEDIA_CAPS_MODIFY_SESSION | |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3195 PURPLE_MEDIA_CAPS_CHANGE_DIRECTION; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3196 } |
27079
72bcdcb0629f
Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27069
diff
changeset
|
3197 if (jabber_resource_has_capability(jbr, GOOGLE_VOICE_CAP)) { |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3198 caps |= PURPLE_MEDIA_CAPS_AUDIO; |
27079
72bcdcb0629f
Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27069
diff
changeset
|
3199 if (jabber_resource_has_capability(jbr, |
72bcdcb0629f
Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27069
diff
changeset
|
3200 GOOGLE_VIDEO_CAP)) |
72bcdcb0629f
Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27069
diff
changeset
|
3201 caps |= PURPLE_MEDIA_CAPS_AUDIO_VIDEO; |
72bcdcb0629f
Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27069
diff
changeset
|
3202 } |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3203 return caps; |
25664
d0ac3c438b71
Check remote JID's capabilities for audio and video XEP support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25662
diff
changeset
|
3204 } |
26046
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26043
diff
changeset
|
3205 |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3206 jb = jabber_buddy_find(js, who, FALSE); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3207 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3208 if(!jb || !jb->resources) { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3209 /* no resources online, we're trying to get caps for someone |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3210 * whose presence we're not subscribed to, or |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3211 * someone who is offline. */ |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3212 return caps; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3213 } else if(!jb->resources->next) { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3214 /* only 1 resource online (probably our most common case) */ |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3215 gchar *name; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3216 jbr = jb->resources->data; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3217 name = g_strdup_printf("%s/%s", who, jbr->name); |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
3218 caps = jabber_get_media_caps(account, name); |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3219 g_free(name); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3220 } else { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3221 /* we've got multiple resources, combine their caps */ |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3222 GList *l; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3223 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3224 for(l = jb->resources; l; l = l->next) |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3225 { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3226 gchar *name; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3227 jbr = l->data; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3228 name = g_strdup_printf("%s/%s", who, jbr->name); |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
3229 caps |= jabber_get_media_caps(account, name); |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3230 g_free(name); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
3231 } |
26046
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26043
diff
changeset
|
3232 } |
26190
d6e23439b77c
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26168
diff
changeset
|
3233 |
d6e23439b77c
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26168
diff
changeset
|
3234 return caps; |
26416
6f0200f1e497
Clean up usage of USE_VV in the XMPP protocol.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26361
diff
changeset
|
3235 #else |
6f0200f1e497
Clean up usage of USE_VV in the XMPP protocol.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26361
diff
changeset
|
3236 return PURPLE_MEDIA_CAPS_NONE; |
6f0200f1e497
Clean up usage of USE_VV in the XMPP protocol.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26361
diff
changeset
|
3237 #endif |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25635
diff
changeset
|
3238 } |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25635
diff
changeset
|
3239 |
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
|
3240 void jabber_register_commands(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3241 { |
26885
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3242 PurpleCmdId id; |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3243 id = purple_cmd_register("config", "", PURPLE_CMD_P_PRPL, |
15823 | 3244 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
|
3245 "prpl-jabber", jabber_cmd_chat_config, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3246 _("config: Configure a chat room."), NULL); |
26885
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3247 jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3248 |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3249 id = purple_cmd_register("configure", "", PURPLE_CMD_P_PRPL, |
15823 | 3250 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
|
3251 "prpl-jabber", jabber_cmd_chat_config, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3252 _("configure: Configure a chat room."), NULL); |
26885
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3253 jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3254 |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3255 id = purple_cmd_register("nick", "s", PURPLE_CMD_P_PRPL, |
15823 | 3256 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
|
3257 "prpl-jabber", jabber_cmd_chat_nick, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3258 _("nick <new nickname>: Change your nickname."), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3259 NULL); |
26885
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3260 jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3261 |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3262 id = purple_cmd_register("part", "s", PURPLE_CMD_P_PRPL, |
15823 | 3263 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | |
3264 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
|
3265 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
|
3266 NULL); |
26885
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3267 jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3268 |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3269 id = purple_cmd_register("register", "", PURPLE_CMD_P_PRPL, |
15823 | 3270 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
|
3271 "prpl-jabber", jabber_cmd_chat_register, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3272 _("register: Register with a chat room."), NULL); |
26885
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3273 jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3274 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3275 /* XXX: there needs to be a core /topic cmd, methinks */ |
26885
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3276 id = purple_cmd_register("topic", "s", PURPLE_CMD_P_PRPL, |
15823 | 3277 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | |
3278 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
|
3279 jabber_cmd_chat_topic, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3280 _("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
|
3281 NULL); |
26885
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3282 jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3283 |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3284 id = purple_cmd_register("ban", "ws", PURPLE_CMD_P_PRPL, |
15823 | 3285 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | |
3286 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
|
3287 jabber_cmd_chat_ban, |
22602
9a84976c8e76
Correct some help strings for Jabber slash commands
Mark Doliner <mark@kingant.net>
parents:
22448
diff
changeset
|
3288 _("ban <user> [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
|
3289 NULL); |
26885
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3290 jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3291 |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3292 id = purple_cmd_register("affiliate", "ws", PURPLE_CMD_P_PRPL, |
15823 | 3293 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | |
3294 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
|
3295 jabber_cmd_chat_affiliate, |
26884
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
3296 _("affiliate <owner|admin|member|outcast|none> [nick1] [nick2] ...: Get the users with an affiliation or set users' affiliation with the room."), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3297 NULL); |
26885
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3298 jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3299 |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3300 id = purple_cmd_register("role", "ws", PURPLE_CMD_P_PRPL, |
15823 | 3301 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | |
3302 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
|
3303 jabber_cmd_chat_role, |
26884
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26859
diff
changeset
|
3304 _("role <moderator|participant|visitor|none> [nick1] [nick2] ...: Get the users with an role or set users' role with the room."), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3305 NULL); |
26885
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3306 jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3307 |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3308 id = purple_cmd_register("invite", "ws", PURPLE_CMD_P_PRPL, |
15823 | 3309 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | |
3310 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
|
3311 jabber_cmd_chat_invite, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3312 _("invite <user> [message]: Invite a user to the room."), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3313 NULL); |
26885
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3314 jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3315 |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3316 id = purple_cmd_register("join", "ws", PURPLE_CMD_P_PRPL, |
15823 | 3317 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | |
3318 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
|
3319 jabber_cmd_chat_join, |
22602
9a84976c8e76
Correct some help strings for Jabber slash commands
Mark Doliner <mark@kingant.net>
parents:
22448
diff
changeset
|
3320 _("join: <room> [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
|
3321 NULL); |
26885
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3322 jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3323 |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3324 id = purple_cmd_register("kick", "ws", PURPLE_CMD_P_PRPL, |
15823 | 3325 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | |
3326 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
|
3327 jabber_cmd_chat_kick, |
22602
9a84976c8e76
Correct some help strings for Jabber slash commands
Mark Doliner <mark@kingant.net>
parents:
22448
diff
changeset
|
3328 _("kick <user> [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
|
3329 NULL); |
26885
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3330 jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3331 |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3332 id = purple_cmd_register("msg", "ws", PURPLE_CMD_P_PRPL, |
15823 | 3333 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
|
3334 "prpl-jabber", jabber_cmd_chat_msg, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3335 _("msg <user> <message>: Send a private message to another user."), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3336 NULL); |
26885
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3337 jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3338 |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3339 id = 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
|
3340 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
|
3341 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
|
3342 "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
|
3343 _("ping <jid>: 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
|
3344 NULL); |
26885
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3345 jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3346 |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3347 id = 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
|
3348 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
|
3349 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, |
17615
cca457b9158b
disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents:
17614
diff
changeset
|
3350 "prpl-jabber", jabber_cmd_buzz, |
cca457b9158b
disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents:
17614
diff
changeset
|
3351 _("buzz: Buzz a user to get their attention"), NULL); |
27514
889bf9af9706
The last command registered wasn't added to the list, so was leaking at uninit.
Paul Aurich <paul@darkrain42.org>
parents:
27463
diff
changeset
|
3352 jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3353 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3354 |
26885
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3355 void jabber_unregister_commands(void) |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3356 { |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3357 while (jabber_cmds != NULL) { |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3358 purple_cmd_unregister(GPOINTER_TO_UINT(jabber_cmds->data)); |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3359 jabber_cmds = g_slist_delete_link(jabber_cmds, jabber_cmds); |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3360 } |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3361 } |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3362 |
25760
f462fa160f06
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents:
25747
diff
changeset
|
3363 /* IPC functions */ |
25587
2bf9bf49cea8
* adding documentation for IPC function contact_has_feature
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25586
diff
changeset
|
3364 |
25760
f462fa160f06
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents:
25747
diff
changeset
|
3365 /** |
f462fa160f06
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents:
25747
diff
changeset
|
3366 * 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
|
3367 * |
f462fa160f06
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents:
25747
diff
changeset
|
3368 * @param account The PurpleAccount |
f462fa160f06
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents:
25747
diff
changeset
|
3369 * @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
|
3370 * @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
|
3371 * |
25587
2bf9bf49cea8
* adding documentation for IPC function contact_has_feature
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25586
diff
changeset
|
3372 * @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
|
3373 */ |
25586
e6f92c0f9770
* adding IPC function 'contact_has_feature'
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25585
diff
changeset
|
3374 static gboolean |
25760
f462fa160f06
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents:
25747
diff
changeset
|
3375 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
|
3376 const gchar *feature) |
25586
e6f92c0f9770
* adding IPC function 'contact_has_feature'
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25585
diff
changeset
|
3377 { |
25760
f462fa160f06
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents:
25747
diff
changeset
|
3378 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
|
3379 JabberStream *js; |
f462fa160f06
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents:
25747
diff
changeset
|
3380 JabberBuddy *jb; |
f462fa160f06
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents:
25747
diff
changeset
|
3381 JabberBuddyResource *jbr; |
f462fa160f06
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents:
25747
diff
changeset
|
3382 gchar *resource; |
f462fa160f06
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents:
25747
diff
changeset
|
3383 |
f462fa160f06
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents:
25747
diff
changeset
|
3384 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
|
3385 return FALSE; |
f462fa160f06
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents:
25747
diff
changeset
|
3386 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
|
3387 |
27014
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
26999
diff
changeset
|
3388 if (!(resource = jabber_get_resource(jid)) || |
25760
f462fa160f06
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents:
25747
diff
changeset
|
3389 !(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
|
3390 !(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
|
3391 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
|
3392 return FALSE; |
25760
f462fa160f06
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents:
25747
diff
changeset
|
3393 } |
25747
504c98a90ef5
constify, ifdef out an old-caps remnant, and rewrite a little
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
3394 |
25760
f462fa160f06
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents:
25747
diff
changeset
|
3395 g_free(resource); |
f462fa160f06
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents:
25747
diff
changeset
|
3396 |
25770
b1b1b75a922e
Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents:
25763
diff
changeset
|
3397 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
|
3398 } |
45816181b7de
* fixing a bug in jabber_caps_compare()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25575
diff
changeset
|
3399 |
25588
61f37abc8a70
* removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25587
diff
changeset
|
3400 static void |
25747
504c98a90ef5
constify, ifdef out an old-caps remnant, and rewrite a little
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
3401 jabber_ipc_add_feature(const gchar *feature) |
25588
61f37abc8a70
* removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25587
diff
changeset
|
3402 { |
25747
504c98a90ef5
constify, ifdef out an old-caps remnant, and rewrite a little
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
3403 if (!feature) |
504c98a90ef5
constify, ifdef out an old-caps remnant, and rewrite a little
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
3404 return; |
25589 | 3405 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
|
3406 |
504c98a90ef5
constify, ifdef out an old-caps remnant, and rewrite a little
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
3407 /* 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
|
3408 jabber_caps_broadcast_change(); |
25588
61f37abc8a70
* removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25587
diff
changeset
|
3409 } |
61f37abc8a70
* removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25587
diff
changeset
|
3410 |
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
|
3411 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
|
3412 jabber_init_plugin(PurplePlugin *plugin) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3413 { |
27064
007dff3cb9e4
Fixup after propagating new caps stuff
Marcus Lundblad <ml@update.uu.se>
parents:
27063
diff
changeset
|
3414 GHashTable *ui_info = purple_core_get_ui_info(); |
27137
2d258a809609
Avoid an assertion when the UI doesn't have a get_ui_info ui_op
Paul Aurich <paul@darkrain42.org>
parents:
27136
diff
changeset
|
3415 const gchar *ui_type; |
27593
6b1eb8dbf86e
Identify clients in XMPP caps based on the ui_info hash. Closes #9672.
Paul Aurich <paul@darkrain42.org>
parents:
27592
diff
changeset
|
3416 const gchar *type = "pc"; /* default client type, if unknown or |
27064
007dff3cb9e4
Fixup after propagating new caps stuff
Marcus Lundblad <ml@update.uu.se>
parents:
27063
diff
changeset
|
3417 unspecified */ |
27593
6b1eb8dbf86e
Identify clients in XMPP caps based on the ui_info hash. Closes #9672.
Paul Aurich <paul@darkrain42.org>
parents:
27592
diff
changeset
|
3418 const gchar *ui_name = NULL; |
27064
007dff3cb9e4
Fixup after propagating new caps stuff
Marcus Lundblad <ml@update.uu.se>
parents:
27063
diff
changeset
|
3419 |
27137
2d258a809609
Avoid an assertion when the UI doesn't have a get_ui_info ui_op
Paul Aurich <paul@darkrain42.org>
parents:
27136
diff
changeset
|
3420 jabber_plugin = plugin; |
2d258a809609
Avoid an assertion when the UI doesn't have a get_ui_info ui_op
Paul Aurich <paul@darkrain42.org>
parents:
27136
diff
changeset
|
3421 |
2d258a809609
Avoid an assertion when the UI doesn't have a get_ui_info ui_op
Paul Aurich <paul@darkrain42.org>
parents:
27136
diff
changeset
|
3422 ui_type = ui_info ? g_hash_table_lookup(ui_info, "client_type") : NULL; |
27064
007dff3cb9e4
Fixup after propagating new caps stuff
Marcus Lundblad <ml@update.uu.se>
parents:
27063
diff
changeset
|
3423 if (ui_type) { |
007dff3cb9e4
Fixup after propagating new caps stuff
Marcus Lundblad <ml@update.uu.se>
parents:
27063
diff
changeset
|
3424 if (strcmp(ui_type, "pc") == 0 || |
007dff3cb9e4
Fixup after propagating new caps stuff
Marcus Lundblad <ml@update.uu.se>
parents:
27063
diff
changeset
|
3425 strcmp(ui_type, "console") == 0 || |
007dff3cb9e4
Fixup after propagating new caps stuff
Marcus Lundblad <ml@update.uu.se>
parents:
27063
diff
changeset
|
3426 strcmp(ui_type, "phone") == 0 || |
007dff3cb9e4
Fixup after propagating new caps stuff
Marcus Lundblad <ml@update.uu.se>
parents:
27063
diff
changeset
|
3427 strcmp(ui_type, "handheld") == 0 || |
007dff3cb9e4
Fixup after propagating new caps stuff
Marcus Lundblad <ml@update.uu.se>
parents:
27063
diff
changeset
|
3428 strcmp(ui_type, "web") == 0 || |
007dff3cb9e4
Fixup after propagating new caps stuff
Marcus Lundblad <ml@update.uu.se>
parents:
27063
diff
changeset
|
3429 strcmp(ui_type, "bot") == 0) { |
007dff3cb9e4
Fixup after propagating new caps stuff
Marcus Lundblad <ml@update.uu.se>
parents:
27063
diff
changeset
|
3430 type = ui_type; |
007dff3cb9e4
Fixup after propagating new caps stuff
Marcus Lundblad <ml@update.uu.se>
parents:
27063
diff
changeset
|
3431 } |
007dff3cb9e4
Fixup after propagating new caps stuff
Marcus Lundblad <ml@update.uu.se>
parents:
27063
diff
changeset
|
3432 } |
25575
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23287
diff
changeset
|
3433 |
27593
6b1eb8dbf86e
Identify clients in XMPP caps based on the ui_info hash. Closes #9672.
Paul Aurich <paul@darkrain42.org>
parents:
27592
diff
changeset
|
3434 if (ui_info) |
6b1eb8dbf86e
Identify clients in XMPP caps based on the ui_info hash. Closes #9672.
Paul Aurich <paul@darkrain42.org>
parents:
27592
diff
changeset
|
3435 ui_name = g_hash_table_lookup(ui_info, "name"); |
6b1eb8dbf86e
Identify clients in XMPP caps based on the ui_info hash. Closes #9672.
Paul Aurich <paul@darkrain42.org>
parents:
27592
diff
changeset
|
3436 if (ui_name == NULL) |
6b1eb8dbf86e
Identify clients in XMPP caps based on the ui_info hash. Closes #9672.
Paul Aurich <paul@darkrain42.org>
parents:
27592
diff
changeset
|
3437 ui_name = PACKAGE; |
6b1eb8dbf86e
Identify clients in XMPP caps based on the ui_info hash. Closes #9672.
Paul Aurich <paul@darkrain42.org>
parents:
27592
diff
changeset
|
3438 |
6b1eb8dbf86e
Identify clients in XMPP caps based on the ui_info hash. Closes #9672.
Paul Aurich <paul@darkrain42.org>
parents:
27592
diff
changeset
|
3439 jabber_add_identity("client", type, NULL, ui_name); |
25575
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23287
diff
changeset
|
3440 |
25586
e6f92c0f9770
* adding IPC function 'contact_has_feature'
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25585
diff
changeset
|
3441 /* 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
|
3442 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
|
3443 jabber_add_feature("jabber:iq:oob", 0); |
25825
69495c6f12af
Fix advertised capabilities (caps, chatstates, entity time)
Paul Aurich <paul@darkrain42.org>
parents:
25824
diff
changeset
|
3444 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
|
3445 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
|
3446 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
|
3447 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
|
3448 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
|
3449 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
|
3450 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
|
3451 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
|
3452 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
|
3453 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
|
3454 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
|
3455 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
|
3456 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
|
3457 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
|
3458 jabber_add_feature("urn:xmpp:ping", 0); |
26529
1ecbda91458a
Fix merge: Move the Jingle features to jabber.c
Paul Aurich <paul@darkrain42.org>
parents:
26528
diff
changeset
|
3459 |
26885
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3460 /* Buzz/Attention */ |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3461 jabber_add_feature(XEP_0224_NAMESPACE, jabber_buzz_isenabled); |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3462 |
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3463 /* Bits Of Binary */ |
26956
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26952
diff
changeset
|
3464 jabber_add_feature(XEP_0231_NAMESPACE, 0); |
26885
1dfa009f6db5
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
26884
diff
changeset
|
3465 |
26529
1ecbda91458a
Fix merge: Move the Jingle features to jabber.c
Paul Aurich <paul@darkrain42.org>
parents:
26528
diff
changeset
|
3466 /* Jingle features! */ |
1ecbda91458a
Fix merge: Move the Jingle features to jabber.c
Paul Aurich <paul@darkrain42.org>
parents:
26528
diff
changeset
|
3467 jabber_add_feature(JINGLE, 0); |
1ecbda91458a
Fix merge: Move the Jingle features to jabber.c
Paul Aurich <paul@darkrain42.org>
parents:
26528
diff
changeset
|
3468 jabber_add_feature(JINGLE_TRANSPORT_RAWUDP, 0); |
26536
9131368ba4be
Advertise ICEUDP only when libnice is available
Paul Aurich <paul@darkrain42.org>
parents:
26535
diff
changeset
|
3469 |
26535
ecf6fd808d23
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <paul@darkrain42.org>
parents:
26533
diff
changeset
|
3470 #ifdef USE_VV |
26539
20743d9bd62d
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents:
26536
diff
changeset
|
3471 jabber_add_feature("http://www.google.com/xmpp/protocol/session", jabber_audio_enabled); |
20743d9bd62d
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents:
26536
diff
changeset
|
3472 jabber_add_feature("http://www.google.com/xmpp/protocol/voice/v1", jabber_audio_enabled); |
28115
3ad2700e7c68
jabber: Add the two Gtalk video features to the disco#info/caps hash
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
3473 jabber_add_feature("http://www.google.com/xmpp/protocol/video/v1", jabber_video_enabled); |
3ad2700e7c68
jabber: Add the two Gtalk video features to the disco#info/caps hash
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
3474 jabber_add_feature("http://www.google.com/xmpp/protocol/camera/v1", jabber_video_enabled); |
26539
20743d9bd62d
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents:
26536
diff
changeset
|
3475 jabber_add_feature(JINGLE_APP_RTP_SUPPORT_AUDIO, jabber_audio_enabled); |
20743d9bd62d
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents:
26536
diff
changeset
|
3476 jabber_add_feature(JINGLE_APP_RTP_SUPPORT_VIDEO, jabber_video_enabled); |
26819
8b7d1aed6d59
merge of '8ddbfe5d6f5c2455497d11ccbfff769ed4e9fad4'
Paul Aurich <paul@darkrain42.org>
diff
changeset
|
3477 jabber_add_feature(JINGLE_TRANSPORT_ICEUDP, 0); |
26535
ecf6fd808d23
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <paul@darkrain42.org>
parents:
26533
diff
changeset
|
3478 #endif |
26529
1ecbda91458a
Fix merge: Move the Jingle features to jabber.c
Paul Aurich <paul@darkrain42.org>
parents:
26528
diff
changeset
|
3479 |
25586
e6f92c0f9770
* adding IPC function 'contact_has_feature'
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25585
diff
changeset
|
3480 /* IPC functions */ |
e6f92c0f9770
* adding IPC function 'contact_has_feature'
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25585
diff
changeset
|
3481 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
|
3482 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
|
3483 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
|
3484 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
|
3485 purple_value_new(PURPLE_TYPE_STRING), |
e6f92c0f9770
* adding IPC function 'contact_has_feature'
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25585
diff
changeset
|
3486 purple_value_new(PURPLE_TYPE_STRING)); |
26952
92565c8e1e3a
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
3487 |
25589 | 3488 purple_plugin_ipc_register(plugin, "add_feature", PURPLE_CALLBACK(jabber_ipc_add_feature), |
3489 purple_marshal_VOID__POINTER, | |
3490 NULL, 1, | |
3491 purple_value_new(PURPLE_TYPE_STRING)); | |
27086
60cb86295f08
Examples for the namespace-(un)registering of IQs and added IPC versions
Paul Aurich <paul@darkrain42.org>
parents:
27084
diff
changeset
|
3492 |
60cb86295f08
Examples for the namespace-(un)registering of IQs and added IPC versions
Paul Aurich <paul@darkrain42.org>
parents:
27084
diff
changeset
|
3493 /* Modifying these? Look at libxmpp.c:load_plugin for the signal versions */ |
60cb86295f08
Examples for the namespace-(un)registering of IQs and added IPC versions
Paul Aurich <paul@darkrain42.org>
parents:
27084
diff
changeset
|
3494 purple_plugin_ipc_register(plugin, "register_namespace_watcher", |
60cb86295f08
Examples for the namespace-(un)registering of IQs and added IPC versions
Paul Aurich <paul@darkrain42.org>
parents:
27084
diff
changeset
|
3495 PURPLE_CALLBACK(jabber_iq_signal_register), |
60cb86295f08
Examples for the namespace-(un)registering of IQs and added IPC versions
Paul Aurich <paul@darkrain42.org>
parents:
27084
diff
changeset
|
3496 purple_marshal_VOID__POINTER_POINTER, |
60cb86295f08
Examples for the namespace-(un)registering of IQs and added IPC versions
Paul Aurich <paul@darkrain42.org>
parents:
27084
diff
changeset
|
3497 NULL, 2, |
60cb86295f08
Examples for the namespace-(un)registering of IQs and added IPC versions
Paul Aurich <paul@darkrain42.org>
parents:
27084
diff
changeset
|
3498 purple_value_new(PURPLE_TYPE_STRING), /* node */ |
60cb86295f08
Examples for the namespace-(un)registering of IQs and added IPC versions
Paul Aurich <paul@darkrain42.org>
parents:
27084
diff
changeset
|
3499 purple_value_new(PURPLE_TYPE_STRING)); /* namespace */ |
60cb86295f08
Examples for the namespace-(un)registering of IQs and added IPC versions
Paul Aurich <paul@darkrain42.org>
parents:
27084
diff
changeset
|
3500 |
60cb86295f08
Examples for the namespace-(un)registering of IQs and added IPC versions
Paul Aurich <paul@darkrain42.org>
parents:
27084
diff
changeset
|
3501 purple_plugin_ipc_register(plugin, "unregister_namespace_watcher", |
60cb86295f08
Examples for the namespace-(un)registering of IQs and added IPC versions
Paul Aurich <paul@darkrain42.org>
parents:
27084
diff
changeset
|
3502 PURPLE_CALLBACK(jabber_iq_signal_unregister), |
60cb86295f08
Examples for the namespace-(un)registering of IQs and added IPC versions
Paul Aurich <paul@darkrain42.org>
parents:
27084
diff
changeset
|
3503 purple_marshal_VOID__POINTER_POINTER, |
60cb86295f08
Examples for the namespace-(un)registering of IQs and added IPC versions
Paul Aurich <paul@darkrain42.org>
parents:
27084
diff
changeset
|
3504 NULL, 2, |
60cb86295f08
Examples for the namespace-(un)registering of IQs and added IPC versions
Paul Aurich <paul@darkrain42.org>
parents:
27084
diff
changeset
|
3505 purple_value_new(PURPLE_TYPE_STRING), /* node */ |
60cb86295f08
Examples for the namespace-(un)registering of IQs and added IPC versions
Paul Aurich <paul@darkrain42.org>
parents:
27084
diff
changeset
|
3506 purple_value_new(PURPLE_TYPE_STRING)); /* namespace */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3507 } |
25763
860ebaf275ae
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents:
25761
diff
changeset
|
3508 |
860ebaf275ae
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents:
25761
diff
changeset
|
3509 void |
860ebaf275ae
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents:
25761
diff
changeset
|
3510 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
|
3511 { |
26952
92565c8e1e3a
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
3512 purple_plugin_ipc_unregister_all(jabber_plugin); |
92565c8e1e3a
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <paul@darkrain42.org>
parents:
26885
diff
changeset
|
3513 |
25763
860ebaf275ae
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents:
25761
diff
changeset
|
3514 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
|
3515 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
|
3516 } |