Mercurial > pidgin.yaz
annotate libpurple/protocols/jabber/jabber.c @ 26692:332d967670e0
propagate from branch 'im.pidgin.pidgin' (head 58fbcc161c5eadf3f307cd460a6ce0a209d908df)
to branch 'org.darkrain42.pidgin.disco' (head 0a29ca89a8dbe84c8b4d4631185db447391c375f)
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Wed, 15 Apr 2009 23:32:18 +0000 |
parents | 1df3579a974b d00a8111e479 |
children | 28381a8889a8 |
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" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 #include "cmds.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 #include "connection.h" |
15891
87ea711b9781
Re-arrange #includes so 'make check' stands a chance of passing during
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
28 #include "conversation.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 #include "debug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 #include "dnssrv.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #include "message.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 #include "notify.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 #include "pluginpref.h" |
24820
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
34 #include "privacy.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 #include "proxy.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 #include "prpl.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 #include "request.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 #include "server.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 #include "util.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 #include "version.h" |
15891
87ea711b9781
Re-arrange #includes so 'make check' stands a chance of passing during
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
41 #include "xmlnode.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 #include "auth.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 #include "buddy.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 #include "chat.h" |
23445
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23182
diff
changeset
|
46 #include "data.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 #include "disco.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 #include "google.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 #include "iq.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 #include "jutil.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 #include "message.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 #include "parser.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 #include "presence.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
54 #include "jabber.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 #include "roster.h" |
17562
6ab1089e2101
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents:
17561
diff
changeset
|
56 #include "ping.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 #include "si.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 #include "xdata.h" |
17561
a75079eae085
added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
17560
diff
changeset
|
59 #include "pep.h" |
17610
9a19c46adf66
The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <pidgin@monitzer.com>
parents:
17608
diff
changeset
|
60 #include "adhoccommands.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25729
diff
changeset
|
62 #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
|
63 #include "jingle/rtp.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
64 |
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
|
65 #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
|
66 |
15823 | 67 static PurplePlugin *my_protocol = NULL; |
21538 | 68 GList *jabber_features = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
69 |
18703
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18695
diff
changeset
|
70 static void jabber_unregister_account_cb(JabberStream *js); |
23643
224169be5830
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23398
diff
changeset
|
71 static void try_srv_connect(JabberStream *js); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
72 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
73 static void jabber_stream_init(JabberStream *js) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
74 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
75 char *open_stream; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
76 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
77 open_stream = g_strdup_printf("<stream:stream to='%s' " |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
78 "xmlns='jabber:client' " |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 "xmlns:stream='http://etherx.jabber.org/streams' " |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
80 "version='1.0'>", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 js->user->domain); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
82 /* setup the parser fresh for each stream */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
83 jabber_parser_setup(js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
84 jabber_send_raw(js, open_stream, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 js->reinit = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
86 g_free(open_stream); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
87 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
88 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
89 static void |
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
|
90 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
|
91 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
|
92 xmlnode *packet, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 { |
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
|
94 if (type == JABBER_IQ_RESULT) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 jabber_stream_set_state(js, JABBER_STREAM_CONNECTED); |
18703
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18695
diff
changeset
|
96 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
|
97 jabber_unregister_account_cb(js); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
98 } else { |
21358 | 99 purple_connection_error_reason (js->gc, |
100 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | |
20117
f24a2cacacd1
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents:
20076
diff
changeset
|
101 ("Error initializing session")); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
102 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
103 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
104 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 static void jabber_session_init(JabberStream *js) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
107 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
|
108 xmlnode *session; |
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 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
|
111 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 session = xmlnode_new_child(iq->node, "session"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 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
|
114 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
115 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 |
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
|
118 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
|
119 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
|
120 xmlnode *packet, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
121 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
122 xmlnode *bind; |
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 if (type == JABBER_IQ_RESULT && |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
125 (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
|
126 xmlnode *jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 char *full_jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
128 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
|
129 JabberBuddy *my_jb = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
130 jabber_id_free(js->user); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
131 if(!(js->user = jabber_id_new(full_jid))) { |
21358 | 132 purple_connection_error_reason (js->gc, |
133 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | |
20117
f24a2cacacd1
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents:
20076
diff
changeset
|
134 _("Invalid response from server.")); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
135 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
136 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
|
137 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
|
138 |
a61c017d3a99
Set the connection display name to the server-assigned full jid for XMPP
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23988
diff
changeset
|
139 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
|
140 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
141 g_free(full_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
142 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
143 } else { |
21358 | 144 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
|
145 char *msg = jabber_parse_error(js, packet, &reason); |
bde477ec6a71
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents:
20792
diff
changeset
|
146 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
|
147 g_free(msg); |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
150 jabber_session_init(js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
151 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 |
24500
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
153 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
|
154 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
|
155 *dot = NULL; |
24500
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
156 |
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
157 /* 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
|
158 if (input == NULL || *input == '\0') |
24500
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
159 return NULL; |
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
160 |
24514
6b9552b09de0
Avoid needlessly calling gethostname() if __HOSTNAME__ doesn't appear in the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24508
diff
changeset
|
161 if (strstr(input, "__HOSTNAME__") == NULL) |
24531 | 162 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
|
163 |
24500
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
164 /* Replace __HOSTNAME__ with hostname */ |
24505
9bb624e345aa
me likes this better, References #5565
Ka-Hing Cheung <khc@hxbc.us>
parents:
24501
diff
changeset
|
165 if (gethostname(hostname, sizeof(hostname) - 1)) { |
9bb624e345aa
me likes this better, References #5565
Ka-Hing Cheung <khc@hxbc.us>
parents:
24501
diff
changeset
|
166 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
|
167 /* 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
|
168 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
|
169 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
|
170 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
|
171 instead |
9bb624e345aa
me likes this better, References #5565
Ka-Hing Cheung <khc@hxbc.us>
parents:
24501
diff
changeset
|
172 */ |
24500
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
173 strcpy(hostname, "localhost"); |
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
174 } |
24505
9bb624e345aa
me likes this better, References #5565
Ka-Hing Cheung <khc@hxbc.us>
parents:
24501
diff
changeset
|
175 hostname[sizeof(hostname) - 1] = '\0'; |
24500
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
176 |
25097
43055addf135
Grab only the "short" hostname on systems (like Fedora/RedHat, but others too)
mcepl@redhat.com
parents:
25066
diff
changeset
|
177 /* 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
|
178 * 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
|
179 * 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
|
180 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
|
181 dot = '\0'; |
43055addf135
Grab only the "short" hostname on systems (like Fedora/RedHat, but others too)
mcepl@redhat.com
parents:
25066
diff
changeset
|
182 |
24500
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
183 return purple_strreplace(input, "__HOSTNAME__", hostname); |
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
184 } |
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
185 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
186 static void jabber_stream_features_parse(JabberStream *js, xmlnode *packet) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
187 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
188 if(xmlnode_get_child(packet, "starttls")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
189 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
|
190 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 return; |
17623
a8420fd18545
Added an option to require SSL or TLS when connecting to an XMPP server.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17621
diff
changeset
|
192 } else if(purple_account_get_bool(js->gc->account, "require_tls", FALSE) && !js->gsc) { |
21358 | 193 purple_connection_error_reason (js->gc, |
194 PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, | |
20117
f24a2cacacd1
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents:
20076
diff
changeset
|
195 _("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
|
196 return; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
197 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
198 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
199 if(js->registration) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 jabber_register_start(js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
201 } else if(xmlnode_get_child(packet, "mechanisms")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
202 jabber_auth_start(js, packet); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 } else if(xmlnode_get_child(packet, "bind")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 xmlnode *bind, *resource; |
24500
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
205 char *requested_resource; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 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
|
207 bind = xmlnode_new_child(iq->node, "bind"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
208 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
|
209 requested_resource = jabber_prep_resource(js->user->resource); |
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
210 |
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
211 if (requested_resource != NULL) { |
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
212 resource = xmlnode_new_child(bind, "resource"); |
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
213 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
|
214 g_free(requested_resource); |
24500
7ec139c84d36
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24409
diff
changeset
|
215 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
216 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
217 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
|
218 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
219 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
220 } 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
|
221 /* 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
|
222 * 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
|
223 * 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
|
224 * connecting to an XMPP server. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
225 js->auth_type = JABBER_AUTH_IQ_AUTH; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
226 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
|
227 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
228 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
229 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 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
|
231 { |
21358 | 232 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
|
233 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
|
234 |
20814
bde477ec6a71
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents:
20792
diff
changeset
|
235 purple_connection_error_reason (js->gc, reason, msg); |
bde477ec6a71
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents:
20792
diff
changeset
|
236 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
237 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
238 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
239 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
240 static void tls_init(JabberStream *js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 |
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
|
242 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
|
243 { |
15919 | 244 const char *xmlns; |
245 | |
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
|
246 purple_signal_emit(my_protocol, "jabber-receiving-xmlnode", js->gc, packet); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
248 /* 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
|
249 if(NULL == *packet) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
250 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
251 |
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
|
252 xmlns = xmlnode_get_namespace(*packet); |
15919 | 253 |
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
|
254 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
|
255 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
|
256 } 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
|
257 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
|
258 } 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
|
259 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
|
260 } 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
|
261 jabber_stream_features_parse(js, *packet); |
21538 | 262 } else if (!strcmp((*packet)->name, "features") && xmlns && |
15919 | 263 !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
|
264 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
|
265 } else if(!strcmp((*packet)->name, "stream:error") || |
21538 | 266 (!strcmp((*packet)->name, "error") && xmlns && |
15919 | 267 !strcmp(xmlns, "http://etherx.jabber.org/streams"))) |
268 { | |
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
|
269 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
|
270 } else if(!strcmp((*packet)->name, "challenge")) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
271 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
|
272 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
|
273 } else if(!strcmp((*packet)->name, "success")) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 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
|
275 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
|
276 } else if(!strcmp((*packet)->name, "failure")) { |
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_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
|
279 } else if(!strcmp((*packet)->name, "proceed")) { |
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 && !js->gsc) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
281 tls_init(js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 } else { |
15823 | 283 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
|
284 (*packet)->name); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
285 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
287 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
288 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
|
289 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
290 int ret; |
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 if (js->gsc) |
15823 | 293 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
|
294 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
295 ret = write(js->fd, data, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
296 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
297 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
298 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
299 |
15823 | 300 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
|
301 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
302 JabberStream *js = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
303 int ret, writelen; |
15823 | 304 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
|
305 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
306 if (writelen == 0) { |
15823 | 307 purple_input_remove(js->writeh); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
308 js->writeh = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
309 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
310 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
311 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
312 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
|
313 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
314 if (ret < 0 && errno == EAGAIN) |
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 else if (ret <= 0) { |
21358 | 317 purple_connection_error_reason (js->gc, |
318 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | |
20117
f24a2cacacd1
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents:
20076
diff
changeset
|
319 _("Write error")); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 |
15823 | 323 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
|
324 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 |
23378
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
326 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
|
327 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
328 int ret; |
23378
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
329 gboolean success = TRUE; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
330 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
331 if (len == -1) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 len = strlen(data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
333 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
334 if (js->writeh == 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
335 ret = jabber_do_send(js, data, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
336 else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
337 ret = -1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
338 errno = EAGAIN; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
339 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 |
23378
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
341 if (ret < 0 && errno != EAGAIN) { |
20117
f24a2cacacd1
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents:
20076
diff
changeset
|
342 purple_connection_error_reason (js->gc, |
21358 | 343 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
20117
f24a2cacacd1
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents:
20076
diff
changeset
|
344 _("Write error")); |
23378
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
345 success = FALSE; |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
346 } else if (ret < len) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
347 if (ret < 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
348 ret = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
349 if (js->writeh == 0) |
15823 | 350 js->writeh = purple_input_add( |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
351 js->gsc ? js->gsc->fd : js->fd, |
15823 | 352 PURPLE_INPUT_WRITE, jabber_send_cb, js); |
353 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
|
354 data + ret, len - ret); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
355 } |
23378
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
356 |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
357 return success; |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
358 } |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
359 |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
360 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
|
361 { |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
362 |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
363 /* 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
|
364 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
|
365 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
|
366 |
3a4070656d61
Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents:
24834
diff
changeset
|
367 /* 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
|
368 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
|
369 /* 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
|
370 (((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
|
371 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
|
372 ((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
|
373 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
|
374 (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
|
375 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
|
376 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
|
377 |
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 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
|
379 |
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 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
|
381 *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
|
382 } |
3a4070656d61
Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents:
24834
diff
changeset
|
383 |
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 purple_debug(PURPLE_DEBUG_MISC, "jabber", "Sending%s: %s%s%s\n", |
3a4070656d61
Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents:
24834
diff
changeset
|
385 js->gsc ? " (ssl)" : "", text ? text : data, |
3a4070656d61
Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents:
24834
diff
changeset
|
386 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
|
387 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
|
388 |
3a4070656d61
Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <paul@darkrain42.org>
parents:
24834
diff
changeset
|
389 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
|
390 } |
23378
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
391 |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
392 /* 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
|
393 * 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
|
394 |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
395 purple_signal_emit(my_protocol, "jabber-sending-text", js->gc, &data); |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
396 if (data == NULL) |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
397 return; |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
398 |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
399 #ifdef HAVE_CYRUS_SASL |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
400 if (js->sasl_maxbuf>0) { |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
401 int pos = 0; |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
402 |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
403 if (!js->gsc && js->fd<0) |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
404 return; |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
405 |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
406 if (len == -1) |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
407 len = strlen(data); |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
408 |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
409 while (pos < len) { |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
410 int towrite; |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
411 const char *out; |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
412 unsigned olen; |
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 towrite = MIN((len - pos), js->sasl_maxbuf); |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
415 |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
416 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
|
417 pos += towrite; |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
418 |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
419 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
|
420 break; |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
421 } |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
422 return; |
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 #endif |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
425 |
e12600d6b902
Cleanup some duplication and simplify this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23287
diff
changeset
|
426 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
|
427 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
428 |
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
|
429 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
|
430 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
431 JabberStream *js = (JabberStream*)gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
432 jabber_send_raw(js, buf, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
433 return len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
434 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
435 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
436 void jabber_send(JabberStream *js, xmlnode *packet) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
437 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
438 char *txt; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
439 int len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
440 |
15823 | 441 purple_signal_emit(my_protocol, "jabber-sending-xmlnode", js->gc, &packet); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
442 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
443 /* if we get NULL back, we're done processing */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
444 if(NULL == packet) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
445 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
446 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
447 txt = xmlnode_to_str(packet, &len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
448 jabber_send_raw(js, txt, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
449 g_free(txt); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
450 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
451 |
25925
42dd7e591031
Make the XMPP keepalive use jabber_ping_jid instead of building it itself.
Paul Aurich <paul@darkrain42.org>
parents:
25050
diff
changeset
|
452 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
|
453 { |
21973
966f98d4b04b
Masca noticed that dc6923294f5f33ff7a52a998e1b9e9ad47be0211 made jabber.c not
Will Thompson <will.thompson@collabora.co.uk>
parents:
21964
diff
changeset
|
454 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
|
455 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
e13609ce4548
Send XMPP Pings to the server instead of whitespace for our keepalives. Timeout the connection if there's no response in 20 seconds
Sean Egan <seanegan@gmail.com>
parents:
21814
diff
changeset
|
456 _("Ping timeout")); |
21964
eaaac273d80c
Keep track of the keepalive timeout source so it can be removed when the account disconnects. This prevents a possible crash if the timeout fired after the account disconnected.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21948
diff
changeset
|
457 js->keepalive_timeout = -1; |
21859
e13609ce4548
Send XMPP Pings to the server instead of whitespace for our keepalives. Timeout the connection if there's no response in 20 seconds
Sean Egan <seanegan@gmail.com>
parents:
21814
diff
changeset
|
458 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
|
459 } |
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
|
460 |
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
|
461 void jabber_keepalive(PurpleConnection *gc) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
462 { |
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
|
463 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
|
464 |
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
|
465 if (js->keepalive_timeout == -1) { |
26649
d00a8111e479
Send XMPP keepalive pings to our server, not our bare JID.
Paul Aurich <paul@darkrain42.org>
parents:
26606
diff
changeset
|
466 jabber_ping_jid(js, js->user->domain); |
25925
42dd7e591031
Make the XMPP keepalive use jabber_ping_jid instead of building it itself.
Paul Aurich <paul@darkrain42.org>
parents:
25050
diff
changeset
|
467 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
|
468 (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
|
469 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
470 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
471 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
472 static void |
15823 | 473 jabber_recv_cb_ssl(gpointer data, PurpleSslConnection *gsc, |
474 PurpleInputCondition cond) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
475 { |
15823 | 476 PurpleConnection *gc = data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
477 JabberStream *js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
478 int len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
479 static char buf[4096]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
480 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
481 /* TODO: It should be possible to make this check unnecessary */ |
15823 | 482 if(!PURPLE_CONNECTION_IS_VALID(gc)) { |
483 purple_ssl_close(gsc); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
484 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
485 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
486 |
15823 | 487 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
|
488 gc->last_received = time(NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
489 buf[len] = '\0'; |
15823 | 490 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
|
491 jabber_parser_process(js, buf, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
492 if(js->reinit) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
493 jabber_stream_init(js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
494 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
495 |
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
|
496 if(len < 0 && errno == EAGAIN) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
497 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
|
498 else { |
47b709962aab
Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <mark@kingant.net>
parents:
23391
diff
changeset
|
499 if (len == 0) |
47b709962aab
Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <mark@kingant.net>
parents:
23391
diff
changeset
|
500 purple_debug_info("jabber", "Server closed the connection.\n"); |
47b709962aab
Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <mark@kingant.net>
parents:
23391
diff
changeset
|
501 else |
47b709962aab
Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <mark@kingant.net>
parents:
23391
diff
changeset
|
502 purple_debug_info("jabber", "Disconnected: %s\n", g_strerror(errno)); |
20117
f24a2cacacd1
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents:
20076
diff
changeset
|
503 purple_connection_error_reason (js->gc, |
21358 | 504 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
20117
f24a2cacacd1
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents:
20076
diff
changeset
|
505 _("Read Error")); |
23398
47b709962aab
Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <mark@kingant.net>
parents:
23391
diff
changeset
|
506 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
507 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
508 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
509 static void |
15823 | 510 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
|
511 { |
15823 | 512 PurpleConnection *gc = data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
513 JabberStream *js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
514 int len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
515 static char buf[4096]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
516 |
15823 | 517 if(!PURPLE_CONNECTION_IS_VALID(gc)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
518 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
519 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
520 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
|
521 gc->last_received = time(NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
522 #ifdef HAVE_CYRUS_SASL |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
523 if (js->sasl_maxbuf>0) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
524 const char *out; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
525 unsigned int olen; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
526 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
|
527 if (olen>0) { |
15823 | 528 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
|
529 jabber_parser_process(js,out,olen); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
530 if(js->reinit) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
531 jabber_stream_init(js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
532 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
533 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
534 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
535 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
536 buf[len] = '\0'; |
15823 | 537 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
|
538 jabber_parser_process(js, buf, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
539 if(js->reinit) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
540 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
|
541 } else if(len < 0 && errno == EAGAIN) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
542 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
543 } else { |
23398
47b709962aab
Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <mark@kingant.net>
parents:
23391
diff
changeset
|
544 if (len == 0) |
47b709962aab
Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <mark@kingant.net>
parents:
23391
diff
changeset
|
545 purple_debug_info("jabber", "Server closed the connection.\n"); |
47b709962aab
Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <mark@kingant.net>
parents:
23391
diff
changeset
|
546 else |
47b709962aab
Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <mark@kingant.net>
parents:
23391
diff
changeset
|
547 purple_debug_info("jabber", "Disconnected: %s\n", g_strerror(errno)); |
20117
f24a2cacacd1
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents:
20076
diff
changeset
|
548 purple_connection_error_reason (js->gc, |
21358 | 549 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
20117
f24a2cacacd1
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents:
20076
diff
changeset
|
550 _("Read Error")); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
551 } |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
554 static void |
15823 | 555 jabber_login_callback_ssl(gpointer data, PurpleSslConnection *gsc, |
556 PurpleInputCondition cond) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
557 { |
15823 | 558 PurpleConnection *gc = data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
559 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
560 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
561 /* TODO: It should be possible to make this check unnecessary */ |
15823 | 562 if(!PURPLE_CONNECTION_IS_VALID(gc)) { |
563 purple_ssl_close(gsc); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
564 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
|
565 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
566 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
567 js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
568 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
569 if(js->state == JABBER_STREAM_CONNECTING) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
570 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
|
571 jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING); |
15823 | 572 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
|
573 |
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
|
574 /* 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
|
575 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
|
576 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
577 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
578 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
579 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
580 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
|
581 { |
15823 | 582 PurpleConnection *gc = data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
583 JabberStream *js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
584 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
585 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
|
586 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
|
587 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
|
588 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
|
589 } else { |
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
|
590 gchar *tmp; |
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
|
591 tmp = g_strdup_printf(_("Could not establish a connection with the server:\n%s"), |
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
|
592 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
|
593 purple_connection_error_reason(gc, |
224169be5830
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23398
diff
changeset
|
594 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
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
|
595 g_free(tmp); |
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
|
596 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
597 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
598 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
599 |
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
|
600 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
|
601 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
|
602 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
603 js->fd = source; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
604 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
605 if(js->state == JABBER_STREAM_CONNECTING) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
606 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
|
607 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
608 jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING); |
15823 | 609 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
|
610 } |
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 static void |
15823 | 613 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
|
614 gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
615 { |
15823 | 616 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
|
617 JabberStream *js; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
618 |
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
|
619 /* If the connection is already disconnected, we don't need to do anything else */ |
15823 | 620 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
|
621 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
|
622 |
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
|
623 js = gc->proto_data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
624 js->gsc = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
625 |
20117
f24a2cacacd1
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents:
20076
diff
changeset
|
626 purple_connection_ssl_error (gc, error); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
627 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
628 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
629 static void tls_init(JabberStream *js) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
630 { |
15823 | 631 purple_input_remove(js->gc->inpa); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
632 js->gc->inpa = 0; |
18929
67cb28c0ec89
applied changes from e52b685d84ca8874da6e3e71199829e513500642
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18163
diff
changeset
|
633 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
|
634 jabber_login_callback_ssl, jabber_ssl_connect_failure, js->certificate_CN, js->gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
635 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
636 |
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
|
637 static gboolean jabber_login_connect(JabberStream *js, const char *domain, const char *host, int port, |
224169be5830
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23398
diff
changeset
|
638 gboolean fatal_failure) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
639 { |
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
|
640 /* 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
|
641 * 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
|
642 * but we use domain as fallback for when users enter IP address |
dc47e908965f
Use connect server as FQDN for SASL auth except when it is an IP address.
Stu Tomlinson <stu@nosnilmot.com>
parents:
22149
diff
changeset
|
643 * 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
|
644 g_free(js->serverFQDN); |
22327
dc47e908965f
Use connect server as FQDN for SASL auth except when it is an IP address.
Stu Tomlinson <stu@nosnilmot.com>
parents:
22149
diff
changeset
|
645 if (purple_ip_address_is_valid(host)) |
dc47e908965f
Use connect server as FQDN for SASL auth except when it is an IP address.
Stu Tomlinson <stu@nosnilmot.com>
parents:
22149
diff
changeset
|
646 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
|
647 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
|
648 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
|
649 |
17007 | 650 if (purple_proxy_connect(js->gc, js->gc->account, host, |
23643
224169be5830
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23398
diff
changeset
|
651 port, jabber_login_callback, js->gc) == NULL) { |
224169be5830
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23398
diff
changeset
|
652 if (fatal_failure) { |
224169be5830
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23398
diff
changeset
|
653 purple_connection_error_reason (js->gc, |
224169be5830
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23398
diff
changeset
|
654 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
224169be5830
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23398
diff
changeset
|
655 _("Unable to create socket")); |
224169be5830
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23398
diff
changeset
|
656 } |
224169be5830
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23398
diff
changeset
|
657 |
224169be5830
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23398
diff
changeset
|
658 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
|
659 } |
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
|
660 |
224169be5830
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23398
diff
changeset
|
661 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
|
662 } |
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 |
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 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
|
665 { |
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 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
|
667 PurpleSrvResponse *tmp_resp = js->srv_rec + (js->srv_rec_idx++); |
224169be5830
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23398
diff
changeset
|
668 if (jabber_login_connect(js, tmp_resp->hostname, tmp_resp->hostname, tmp_resp->port, FALSE)) |
224169be5830
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23398
diff
changeset
|
669 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
|
670 } |
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
|
671 |
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
|
672 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
|
673 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
|
674 |
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 /* Fall back to the defaults (I'm not sure if we should actually do this) */ |
224169be5830
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23398
diff
changeset
|
676 jabber_login_connect(js, js->user->domain, js->user->domain, |
224169be5830
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23398
diff
changeset
|
677 purple_account_get_int(js->gc->account, "port", 5222), TRUE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
678 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
679 |
15823 | 680 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
|
681 { |
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
|
682 JabberStream *js = data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
683 js->srv_query_data = NULL; |
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 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
|
686 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
|
687 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
|
688 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
|
689 try_srv_connect(js); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
690 } else { |
17007 | 691 jabber_login_connect(js, js->user->domain, js->user->domain, |
23643
224169be5830
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23398
diff
changeset
|
692 purple_account_get_int(js->gc->account, "port", 5222), TRUE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
693 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
694 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
695 |
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
|
696 void |
15823 | 697 jabber_login(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
698 { |
15823 | 699 PurpleConnection *gc = purple_account_get_connection(account); |
700 const char *connect_server = purple_account_get_string(account, | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
701 "connect_server", ""); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
702 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
703 JabberBuddy *my_jb = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
704 |
23445
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23182
diff
changeset
|
705 gc->flags |= PURPLE_CONNECTION_HTML | |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23182
diff
changeset
|
706 PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
707 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
|
708 js->gc = gc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
709 js->fd = -1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
710 js->iq_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
711 g_free, g_free); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
712 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
|
713 g_free, (GDestroyNotify)jabber_buddy_free); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
714 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
|
715 g_free, (GDestroyNotify)jabber_chat_free); |
15823 | 716 js->user = jabber_id_new(purple_account_get_username(account)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
717 js->next_id = g_random_int(); |
15823 | 718 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
|
719 js->old_length = 0; |
21964
eaaac273d80c
Keep track of the keepalive timeout source so it can be removed when the account disconnects. This prevents a possible crash if the timeout fired after the account disconnected.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21948
diff
changeset
|
720 js->keepalive_timeout = -1; |
23287
eb27ae817284
Don't crash if the given jabber id is invalid. For example,
Mark Doliner <mark@kingant.net>
parents:
23271
diff
changeset
|
721 js->certificate_CN = g_strdup(connect_server[0] ? connect_server : js->user ? js->user->domain : NULL); |
25648
16543025aed1
Moved jingle.c global variable "sessions" into JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25647
diff
changeset
|
722 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
|
723 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
|
724 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
|
725 js->stun_query = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
726 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
727 if(!js->user) { |
21358 | 728 purple_connection_error_reason (gc, |
729 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, | |
20117
f24a2cacacd1
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents:
20076
diff
changeset
|
730 _("Invalid XMPP ID")); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
731 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
732 } |
26162
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26145
diff
changeset
|
733 |
16963
919515748253
Handle people forgetting to enter a domain. Also, change 'server,' in the account options to 'domain,' which is its proper name, and hopefully less confusion
Sean Egan <seanegan@gmail.com>
parents:
16962
diff
changeset
|
734 if (!js->user->domain || *(js->user->domain) == '\0') { |
21358 | 735 purple_connection_error_reason (gc, |
736 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, | |
20117
f24a2cacacd1
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents:
20076
diff
changeset
|
737 _("Invalid XMPP ID. Domain must be set.")); |
16963
919515748253
Handle people forgetting to enter a domain. Also, change 'server,' in the account options to 'domain,' which is its proper name, and hopefully less confusion
Sean Egan <seanegan@gmail.com>
parents:
16962
diff
changeset
|
738 return; |
919515748253
Handle people forgetting to enter a domain. Also, change 'server,' in the account options to 'domain,' which is its proper name, and hopefully less confusion
Sean Egan <seanegan@gmail.com>
parents:
16962
diff
changeset
|
739 } |
26162
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26145
diff
changeset
|
740 |
15823 | 741 if((my_jb = jabber_buddy_find(js, purple_account_get_username(account), TRUE))) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
742 my_jb->subscription |= JABBER_SUB_BOTH; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
743 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
744 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
|
745 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
746 /* if they've got old-ssl mode going, we probably want to ignore SRV lookups */ |
15823 | 747 if(purple_account_get_bool(js->gc->account, "old_ssl", FALSE)) { |
748 if(purple_ssl_is_supported()) { | |
749 js->gsc = purple_ssl_connect(js->gc->account, | |
22034
d63892ade0a6
Now checking the hostname supplied by the user, or the host-part of the JID when no host name is given against the CN of the domain. This makes libpurple comply to the RFC. Fixes http://trac.adiumx.com/ticket/8787
Andreas Monitzer <pidgin@monitzer.com>
parents:
22000
diff
changeset
|
750 js->certificate_CN, |
15823 | 751 purple_account_get_int(account, "port", 5223), jabber_login_callback_ssl, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
752 jabber_ssl_connect_failure, js->gc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
753 } else { |
21358 | 754 purple_connection_error_reason (js->gc, |
755 PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, | |
20117
f24a2cacacd1
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents:
20076
diff
changeset
|
756 _("SSL support unavailable")); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
757 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
758 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
759 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
760 /* 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
|
761 * invoke the magic of SRV lookups, to figure out host and port */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
762 if(!js->gsc) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
763 if(connect_server[0]) { |
23643
224169be5830
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23398
diff
changeset
|
764 jabber_login_connect(js, js->user->domain, connect_server, purple_account_get_int(account, "port", 5222), TRUE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
765 } else { |
15823 | 766 js->srv_query_data = purple_srv_resolve("xmpp-client", |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
767 "tcp", js->user->domain, srv_resolved_cb, js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
768 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
769 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
770 } |
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 static gboolean |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
774 conn_close_cb(gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
775 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
776 JabberStream *js = data; |
15823 | 777 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
|
778 |
17603
7a3a66c6530a
Fixed a leak: The XML parser was never cleaned up on disconnect.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17599
diff
changeset
|
779 jabber_parser_free(js); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
780 |
15823 | 781 purple_account_disconnect(account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
782 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
783 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
784 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
785 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
786 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
787 jabber_connection_schedule_close(JabberStream *js) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
788 { |
15823 | 789 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
|
790 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
791 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
792 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
|
793 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
|
794 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
|
795 xmlnode *packet, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
796 { |
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
|
797 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
|
798 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
|
799 char *to = data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
800 |
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
|
801 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
|
802 if(js->registration) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
803 buf = g_strdup_printf(_("Registration of %s@%s successful"), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
804 js->user->node, js->user->domain); |
17608
a8b1159fd95b
Simplified registration callback per request of Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17607
diff
changeset
|
805 if(account->registration_cb) |
a8b1159fd95b
Simplified registration callback per request of Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17607
diff
changeset
|
806 (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
|
807 } 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
|
808 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
|
809 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
|
810 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
|
811 } |
15823 | 812 purple_notify_info(NULL, _("Registration Successful"), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
813 _("Registration Successful"), buf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
814 g_free(buf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
815 } 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
|
816 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
|
817 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
818 if(!msg) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
819 msg = g_strdup(_("Unknown Error")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
820 |
15823 | 821 purple_notify_error(NULL, _("Registration Failed"), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
822 _("Registration Failed"), msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
823 g_free(msg); |
17608
a8b1159fd95b
Simplified registration callback per request of Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17607
diff
changeset
|
824 if(account->registration_cb) |
a8b1159fd95b
Simplified registration callback per request of Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17607
diff
changeset
|
825 (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
|
826 } |
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
|
827 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
|
828 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
|
829 jabber_connection_schedule_close(js); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
830 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
831 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
832 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
|
833 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
|
834 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
|
835 xmlnode *packet, gpointer data) |
18695
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
836 { |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
837 char *buf; |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
838 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
|
839 |
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
|
840 /* 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
|
841 * 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
|
842 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
|
843 |
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
|
844 if (type == JABBER_IQ_RESULT) { |
18695
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
845 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
|
846 to); |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
847 purple_notify_info(NULL, _("Unregistration Successful"), |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
848 _("Unregistration Successful"), buf); |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
849 g_free(buf); |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
850 } 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
|
851 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
|
852 |
18695
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
853 if(!msg) |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
854 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
|
855 |
18695
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
856 purple_notify_error(NULL, _("Unregistration Failed"), |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
857 _("Unregistration Failed"), msg); |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
858 g_free(msg); |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
859 } |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
860 g_free(to); |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
861 } |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
862 |
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
|
863 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
|
864 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
|
865 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
|
866 } 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
|
867 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
868 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
|
869 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
|
870 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
871 GList *groups, *flds; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
872 xmlnode *query, *y; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
873 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
874 char *username; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
875 |
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
|
876 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
|
877 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
|
878 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
|
879 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
|
880 |
15823 | 881 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
|
882 groups = groups->next) { |
15823 | 883 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
|
884 flds; flds = flds->next) { |
15823 | 885 PurpleRequestField *field = flds->data; |
886 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
|
887 if(!strcmp(id,"unregister")) { |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
888 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
|
889 if(value) { |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
890 /* 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
|
891 (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
|
892 jabber_iq_free(iq); |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
893 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
|
894 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
|
895 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
|
896 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
|
897 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
|
898 |
18695
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
899 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
|
900 |
18695
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
901 jabber_iq_send(iq); |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
902 g_free(cbdata); |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
903 return; |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
904 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
905 } else { |
15823 | 906 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
|
907 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
908 if(!strcmp(id, "username")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
909 y = xmlnode_new_child(query, "username"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
910 } else if(!strcmp(id, "password")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
911 y = xmlnode_new_child(query, "password"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
912 } else if(!strcmp(id, "name")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
913 y = xmlnode_new_child(query, "name"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
914 } else if(!strcmp(id, "email")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
915 y = xmlnode_new_child(query, "email"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
916 } else if(!strcmp(id, "nick")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
917 y = xmlnode_new_child(query, "nick"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
918 } else if(!strcmp(id, "first")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
919 y = xmlnode_new_child(query, "first"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
920 } else if(!strcmp(id, "last")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
921 y = xmlnode_new_child(query, "last"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
922 } else if(!strcmp(id, "address")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
923 y = xmlnode_new_child(query, "address"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
924 } else if(!strcmp(id, "city")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
925 y = xmlnode_new_child(query, "city"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
926 } else if(!strcmp(id, "state")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
927 y = xmlnode_new_child(query, "state"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
928 } else if(!strcmp(id, "zip")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
929 y = xmlnode_new_child(query, "zip"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
930 } else if(!strcmp(id, "phone")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
931 y = xmlnode_new_child(query, "phone"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
932 } else if(!strcmp(id, "url")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
933 y = xmlnode_new_child(query, "url"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
934 } else if(!strcmp(id, "date")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
935 y = xmlnode_new_child(query, "date"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
936 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
937 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
938 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
939 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
|
940 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
|
941 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
|
942 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
|
943 } |
18695
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
944 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
|
945 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
|
946 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
947 } |
19696
481749fc0b6b
merge of '1c7910841138381c841363256ca3c7905b1f26b0'
Daniel Atallah <daniel.atallah@gmail.com>
diff
changeset
|
948 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
949 |
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
|
950 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
|
951 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
|
952 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
|
953 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
|
954 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
|
955 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
956 |
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
|
957 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
|
958 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
959 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
|
960 g_free(cbdata); |
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 |
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
|
964 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
|
965 { |
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
|
966 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
|
967 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
|
968 if(account->registration_cb) |
17608
a8b1159fd95b
Simplified registration callback per request of Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17607
diff
changeset
|
969 (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
|
970 jabber_connection_schedule_close(cbdata->js); |
20276
c1d3d25e8c49
Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents:
20187
diff
changeset
|
971 } |
17599
8c3fbc353a9c
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17596
diff
changeset
|
972 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
|
973 g_free(cbdata); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
974 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
975 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
976 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
|
977 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
978 xmlnode *query; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
979 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
|
980 char *to = data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
981 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
982 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
|
983 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
|
984 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
|
985 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
|
986 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
987 xmlnode_insert_child(query, result); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
988 |
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
|
989 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
|
990 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
991 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
992 |
25933
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25930
diff
changeset
|
993 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
|
994 const char *id, xmlnode *query) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
995 { |
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
|
996 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
|
997 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
|
998 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
|
999 PurpleRequestField *field; |
25933
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25930
diff
changeset
|
1000 xmlnode *x, *y; |
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
|
1001 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
|
1002 JabberRegisterCBData *cbdata; |
18695
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1003 gboolean registered = FALSE; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1004 |
25933
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25930
diff
changeset
|
1005 if (type != JABBER_IQ_RESULT) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1006 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1007 |
21592
68b036c452f3
The Jabber registration process depends upon having a non-NULL cbdata->who,
Evan Schoenberg <evan.s@dreskin.net>
parents:
21591
diff
changeset
|
1008 if (!from) |
68b036c452f3
The Jabber registration process depends upon having a non-NULL cbdata->who,
Evan Schoenberg <evan.s@dreskin.net>
parents:
21591
diff
changeset
|
1009 from = js->serverFQDN; |
68b036c452f3
The Jabber registration process depends upon having a non-NULL cbdata->who,
Evan Schoenberg <evan.s@dreskin.net>
parents:
21591
diff
changeset
|
1010 g_return_if_fail(from != NULL); |
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
|
1011 |
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
|
1012 if(js->registration) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1013 /* get rid of the login thingy */ |
15823 | 1014 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
|
1015 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1016 |
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
|
1017 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
|
1018 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
|
1019 |
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
|
1020 if(js->registration) { |
15823 | 1021 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
|
1022 _("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
|
1023 if(account->registration_cb) |
17608
a8b1159fd95b
Simplified registration callback per request of Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17607
diff
changeset
|
1024 (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
|
1025 jabber_connection_schedule_close(js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1026 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1027 } |
17599
8c3fbc353a9c
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17596
diff
changeset
|
1028 } |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25442
diff
changeset
|
1029 |
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
|
1030 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
|
1031 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
|
1032 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
|
1033 |
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
|
1034 } 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
|
1035 xmlnode *url; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1036 |
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
|
1037 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
|
1038 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
|
1039 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
|
1040 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
|
1041 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
|
1042 |
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
|
1043 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
|
1044 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
|
1045 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
|
1046 (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
|
1047 jabber_connection_schedule_close(js); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1048 } |
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
|
1049 return; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1050 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1051 } |
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
|
1052 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1053 |
21326
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1054 /* 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
|
1055 |
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
|
1056 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
|
1057 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
|
1058 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
|
1059 |
26329
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25985
diff
changeset
|
1060 if(xmlnode_get_child(query, "username")) { |
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25985
diff
changeset
|
1061 if(js->registration) |
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25985
diff
changeset
|
1062 field = purple_request_field_string_new("username", _("Username"), js->user->node, FALSE); |
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25985
diff
changeset
|
1063 else |
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25985
diff
changeset
|
1064 field = purple_request_field_string_new("username", _("Username"), NULL, FALSE); |
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25985
diff
changeset
|
1065 |
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25985
diff
changeset
|
1066 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
|
1067 } |
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25985
diff
changeset
|
1068 if(xmlnode_get_child(query, "password")) { |
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25985
diff
changeset
|
1069 if(js->registration) |
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25985
diff
changeset
|
1070 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
|
1071 purple_connection_get_password(js->gc), FALSE); |
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25985
diff
changeset
|
1072 else |
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25985
diff
changeset
|
1073 field = purple_request_field_string_new("password", _("Password"), NULL, FALSE); |
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25985
diff
changeset
|
1074 |
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25985
diff
changeset
|
1075 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
|
1076 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
|
1077 } |
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
|
1078 if(xmlnode_get_child(query, "name")) { |
17599
8c3fbc353a9c
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17596
diff
changeset
|
1079 if(js->registration) |
15823 | 1080 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
|
1081 purple_account_get_alias(js->gc->account), FALSE); |
17599
8c3fbc353a9c
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17596
diff
changeset
|
1082 else |
21326
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1083 field = purple_request_field_string_new("name", _("Name"), NULL, FALSE); |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1084 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
|
1085 } |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1086 if(xmlnode_get_child(query, "email")) { |
23182
e0bcb8cfda74
Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@wiktel.com>
parents:
22933
diff
changeset
|
1087 field = purple_request_field_string_new("email", _("Email"), NULL, FALSE); |
21326
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1088 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
|
1089 } |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1090 if(xmlnode_get_child(query, "nick")) { |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1091 field = purple_request_field_string_new("nick", _("Nickname"), NULL, FALSE); |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1092 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
|
1093 } |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1094 if(xmlnode_get_child(query, "first")) { |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1095 field = purple_request_field_string_new("first", _("First name"), NULL, FALSE); |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1096 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
|
1097 } |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1098 if(xmlnode_get_child(query, "last")) { |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1099 field = purple_request_field_string_new("last", _("Last name"), NULL, FALSE); |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1100 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
|
1101 } |
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
|
1102 if(xmlnode_get_child(query, "address")) { |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1103 field = purple_request_field_string_new("address", _("Address"), NULL, FALSE); |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1104 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
|
1105 } |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1106 if(xmlnode_get_child(query, "city")) { |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1107 field = purple_request_field_string_new("city", _("City"), NULL, FALSE); |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1108 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
|
1109 } |
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
|
1110 if(xmlnode_get_child(query, "state")) { |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1111 field = purple_request_field_string_new("state", _("State"), NULL, FALSE); |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1112 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
|
1113 } |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1114 if(xmlnode_get_child(query, "zip")) { |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1115 field = purple_request_field_string_new("zip", _("Postal code"), NULL, FALSE); |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1116 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
|
1117 } |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1118 if(xmlnode_get_child(query, "phone")) { |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1119 field = purple_request_field_string_new("phone", _("Phone"), NULL, FALSE); |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1120 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
|
1121 } |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1122 if(xmlnode_get_child(query, "url")) { |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1123 field = purple_request_field_string_new("url", _("URL"), NULL, FALSE); |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1124 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
|
1125 } |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1126 if(xmlnode_get_child(query, "date")) { |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1127 field = purple_request_field_string_new("date", _("Date"), NULL, FALSE); |
6ba02326c9e1
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21284
diff
changeset
|
1128 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
|
1129 } |
18695
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1130 if(registered) { |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1131 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
|
1132 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
|
1133 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1134 |
20276
c1d3d25e8c49
Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents:
20187
diff
changeset
|
1135 if((y = xmlnode_get_child(query, "instructions"))) |
c1d3d25e8c49
Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents:
20187
diff
changeset
|
1136 instructions = xmlnode_get_data(y); |
18695
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1137 else if(registered) |
91eece1ad9bc
Added the ability to unregister from a gateway.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1138 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
|
1139 "to change your account registration.")); |
20276
c1d3d25e8c49
Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents:
20187
diff
changeset
|
1140 else |
c1d3d25e8c49
Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents:
20187
diff
changeset
|
1141 instructions = g_strdup(_("Please fill out the information below " |
c1d3d25e8c49
Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents:
20187
diff
changeset
|
1142 "to register your new account.")); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1143 |
17599
8c3fbc353a9c
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17596
diff
changeset
|
1144 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
|
1145 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
|
1146 cbdata->who = g_strdup(from); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1147 |
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
|
1148 if(js->registration) |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
1149 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
|
1150 _("Register New XMPP Account"), instructions, fields, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1151 _("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
|
1152 _("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
|
1153 purple_connection_get_account(js->gc), NULL, NULL, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
1154 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
|
1155 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
|
1156 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
|
1157 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
|
1158 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
|
1159 :g_strdup_printf(_("Register New Account at %s"), from); |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
1160 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
|
1161 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
|
1162 (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
|
1163 _("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
|
1164 purple_connection_get_account(js->gc), NULL, NULL, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
1165 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
|
1166 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
|
1167 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1168 |
20276
c1d3d25e8c49
Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents:
20187
diff
changeset
|
1169 g_free(instructions); |
c1d3d25e8c49
Merged xmpp leak fixes
Evan Schoenberg <evan.s@dreskin.net>
parents:
20187
diff
changeset
|
1170 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1171 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1172 void jabber_register_start(JabberStream *js) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1173 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1174 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1175 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1176 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
|
1177 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1178 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1179 |
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
|
1180 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
|
1181 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
|
1182 |
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
|
1183 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
|
1184 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
|
1185 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
|
1186 } |
8c3fbc353a9c
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17596
diff
changeset
|
1187 |
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
|
1188 void jabber_register_account(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1189 { |
15823 | 1190 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
|
1191 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1192 JabberBuddy *my_jb = NULL; |
15823 | 1193 const char *connect_server = purple_account_get_string(account, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1194 "connect_server", ""); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1195 const char *server; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1196 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1197 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
|
1198 js->gc = gc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1199 js->registration = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1200 js->iq_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1201 g_free, g_free); |
15823 | 1202 js->user = jabber_id_new(purple_account_get_username(account)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1203 js->next_id = g_random_int(); |
21978
cacc01b50a23
Fixes for incorrectly displaying user tune emblem and empty current media.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21973
diff
changeset
|
1204 js->old_length = 0; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1205 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1206 if(!js->user) { |
21358 | 1207 purple_connection_error_reason (gc, |
1208 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, | |
20117
f24a2cacacd1
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents:
20076
diff
changeset
|
1209 _("Invalid XMPP ID")); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1210 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1211 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1212 |
15823 | 1213 js->write_buffer = purple_circ_buffer_new(512); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1214 |
15823 | 1215 if((my_jb = jabber_buddy_find(js, purple_account_get_username(account), TRUE))) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1216 my_jb->subscription |= JABBER_SUB_BOTH; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1217 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1218 server = connect_server[0] ? connect_server : js->user->domain; |
22034
d63892ade0a6
Now checking the hostname supplied by the user, or the host-part of the JID when no host name is given against the CN of the domain. This makes libpurple comply to the RFC. Fixes http://trac.adiumx.com/ticket/8787
Andreas Monitzer <pidgin@monitzer.com>
parents:
22000
diff
changeset
|
1219 js->certificate_CN = g_strdup(server); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1220 |
26162
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26145
diff
changeset
|
1221 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
|
1222 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
|
1223 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
|
1224 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1225 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
|
1226 |
15823 | 1227 if(purple_account_get_bool(account, "old_ssl", FALSE)) { |
1228 if(purple_ssl_is_supported()) { | |
1229 js->gsc = purple_ssl_connect(account, server, | |
1230 purple_account_get_int(account, "port", 5222), | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1231 jabber_login_callback_ssl, jabber_ssl_connect_failure, gc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1232 } else { |
21358 | 1233 purple_connection_error_reason (gc, |
1234 PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, | |
20117
f24a2cacacd1
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents:
20076
diff
changeset
|
1235 _("SSL support unavailable")); |
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 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1238 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1239 if(!js->gsc) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1240 if (connect_server[0]) { |
17007 | 1241 jabber_login_connect(js, js->user->domain, server, |
15823 | 1242 purple_account_get_int(account, |
23643
224169be5830
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23398
diff
changeset
|
1243 "port", 5222), TRUE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1244 } else { |
15823 | 1245 js->srv_query_data = purple_srv_resolve("xmpp-client", |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1246 "tcp", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1247 js->user->domain, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1248 srv_resolved_cb, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1249 js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1250 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1251 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1252 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1253 |
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
|
1254 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
|
1255 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
|
1256 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
|
1257 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
|
1258 { |
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
|
1259 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
|
1260 |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
26546
diff
changeset
|
1261 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
|
1262 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
|
1263 |
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
|
1264 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
|
1265 _("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
|
1266 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
|
1267 if(js->unregistration_cb) |
18921
ba3b22cd280b
Mixed up TRUE and FALSE.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18920
diff
changeset
|
1268 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
|
1269 } 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
|
1270 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
|
1271 _("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
|
1272 if(js->unregistration_cb) |
18921
ba3b22cd280b
Mixed up TRUE and FALSE.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18920
diff
changeset
|
1273 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
|
1274 } |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18695
diff
changeset
|
1275 } |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18695
diff
changeset
|
1276 |
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
|
1277 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
|
1278 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
|
1279 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
|
1280 |
ab38146f8f78
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19999
diff
changeset
|
1281 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
|
1282 |
ab38146f8f78
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19999
diff
changeset
|
1283 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
|
1284 |
ab38146f8f78
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19999
diff
changeset
|
1285 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
|
1286 |
ab38146f8f78
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19999
diff
changeset
|
1287 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
|
1288 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
|
1289 |
ab38146f8f78
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19999
diff
changeset
|
1290 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
|
1291 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
|
1292 } |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18695
diff
changeset
|
1293 |
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
|
1294 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
|
1295 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
|
1296 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
|
1297 |
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
|
1298 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
|
1299 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
|
1300 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
|
1301 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
|
1302 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
|
1303 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
|
1304 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
|
1305 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
|
1306 } |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25442
diff
changeset
|
1307 |
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
|
1308 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
|
1309 |
ab38146f8f78
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19999
diff
changeset
|
1310 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
|
1311 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
|
1312 return; |
ab38146f8f78
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19999
diff
changeset
|
1313 } |
ab38146f8f78
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19999
diff
changeset
|
1314 |
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
|
1315 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
|
1316 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
|
1317 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
|
1318 |
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
|
1319 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
|
1320 } |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18695
diff
changeset
|
1321 |
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
|
1322 void jabber_close(PurpleConnection *gc) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1323 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1324 JabberStream *js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1325 |
25667
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25666
diff
changeset
|
1326 /* 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
|
1327 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
|
1328 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1329 /* 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
|
1330 * 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
|
1331 * on some SSL backends. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1332 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1333 if (!gc->disconnect_timeout) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1334 jabber_send_raw(js, "</stream:stream>", -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1335 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1336 if (js->srv_query_data) |
15823 | 1337 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
|
1338 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1339 if(js->gsc) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1340 #ifdef HAVE_OPENSSL |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1341 if (!gc->disconnect_timeout) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1342 #endif |
15823 | 1343 purple_ssl_close(js->gsc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1344 } else if (js->fd > 0) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1345 if(js->gc->inpa) |
15823 | 1346 purple_input_remove(js->gc->inpa); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1347 close(js->fd); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1348 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1349 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1350 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
|
1351 |
17603
7a3a66c6530a
Fixed a leak: The XML parser was never cleaned up on disconnect.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17599
diff
changeset
|
1352 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
|
1353 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1354 if(js->iq_callbacks) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1355 g_hash_table_destroy(js->iq_callbacks); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1356 if(js->buddies) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1357 g_hash_table_destroy(js->buddies); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1358 if(js->chats) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1359 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
|
1360 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1361 while(js->chat_servers) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1362 g_free(js->chat_servers->data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1363 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
|
1364 } |
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
|
1365 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1366 while(js->user_directories) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1367 g_free(js->user_directories->data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1368 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
|
1369 } |
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
|
1370 |
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
|
1371 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
|
1372 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
|
1373 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
|
1374 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
|
1375 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
|
1376 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
|
1377 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
|
1378 } |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21592
diff
changeset
|
1379 |
23744
3c3032be12de
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23644
diff
changeset
|
1380 while(js->url_datas) { |
3c3032be12de
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23644
diff
changeset
|
1381 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
|
1382 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
|
1383 } |
3c3032be12de
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23644
diff
changeset
|
1384 |
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
|
1385 g_free(js->stream_id); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1386 if(js->user) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1387 jabber_id_free(js->user); |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21592
diff
changeset
|
1388 g_free(js->avatar_hash); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21592
diff
changeset
|
1389 |
15823 | 1390 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
|
1391 if(js->writeh) |
15823 | 1392 purple_input_remove(js->writeh); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1393 #ifdef HAVE_CYRUS_SASL |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1394 if(js->sasl) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1395 sasl_dispose(&js->sasl); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1396 if(js->sasl_mechs) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1397 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
|
1398 g_free(js->sasl_cb); |
18929
67cb28c0ec89
applied changes from e52b685d84ca8874da6e3e71199829e513500642
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18163
diff
changeset
|
1399 #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
|
1400 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
|
1401 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
|
1402 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
|
1403 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
|
1404 g_free(cmd->node); |
17620
11dd7969dd4b
Fixed copy/paste error.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17617
diff
changeset
|
1405 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
|
1406 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
|
1407 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
|
1408 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1409 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
|
1410 g_free(js->certificate_CN); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1411 g_free(js->gmail_last_time); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1412 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
|
1413 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
|
1414 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
|
1415 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
|
1416 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
|
1417 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
|
1418 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
|
1419 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
|
1420 g_free(js->expected_rspauth); |
26329
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25985
diff
changeset
|
1421 g_free(js->last_disco_server); |
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
|
1422 |
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
|
1423 if (js->keepalive_timeout != -1) |
eaaac273d80c
Keep track of the keepalive timeout source so it can be removed when the account disconnects. This prevents a possible crash if the timeout fired after the account disconnected.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21948
diff
changeset
|
1424 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
|
1425 |
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
|
1426 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
|
1427 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
|
1428 |
26162
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26145
diff
changeset
|
1429 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
|
1430 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
|
1431 |
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26145
diff
changeset
|
1432 /* 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
|
1433 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
|
1434 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
|
1435 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
|
1436 } |
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26145
diff
changeset
|
1437 |
23644
fa8567fa0ca0
Fix a stupid mistake in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23643
diff
changeset
|
1438 g_free(js); |
fa8567fa0ca0
Fix a stupid mistake in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23643
diff
changeset
|
1439 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1440 gc->proto_data = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1441 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1442 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1443 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
|
1444 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1445 js->state = state; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1446 switch(state) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1447 case JABBER_STREAM_OFFLINE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1448 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1449 case JABBER_STREAM_CONNECTING: |
15823 | 1450 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
|
1451 JABBER_CONNECT_STEPS); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1452 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1453 case JABBER_STREAM_INITIALIZING: |
15823 | 1454 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
|
1455 js->gsc ? 5 : 2, JABBER_CONNECT_STEPS); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1456 jabber_stream_init(js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1457 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
|
1458 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
|
1459 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
|
1460 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
|
1461 break; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1462 case JABBER_STREAM_AUTHENTICATING: |
15823 | 1463 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
|
1464 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
|
1465 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
|
1466 jabber_register_start(js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1467 } 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
|
1468 /* 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
|
1469 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
|
1470 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
|
1471 */ |
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
|
1472 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
|
1473 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
|
1474 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
|
1475 } |
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
|
1476 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1477 jabber_auth_start_old(js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1478 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1479 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1480 case JABBER_STREAM_REINITIALIZING: |
15823 | 1481 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
|
1482 (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
|
1483 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1484 /* 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
|
1485 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
|
1486 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1487 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1488 case JABBER_STREAM_CONNECTED: |
16822
a77901ef0ebb
this should fix jabber buddy icons (but it will re-introduce the behavior of overwriting your vCard whenever you sign in).
Nathan Walp <nwalp@pidgin.im>
parents:
16728
diff
changeset
|
1489 /* now we can alert the core that we're ready to send status */ |
15823 | 1490 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
|
1491 jabber_disco_items_server(js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1492 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1493 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1494 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1495 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1496 char *jabber_get_next_id(JabberStream *js) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1497 { |
15823 | 1498 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
|
1499 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1500 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1501 |
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
|
1502 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
|
1503 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1504 JabberStream *js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1505 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1506 js->idle = idle ? time(NULL) - idle : idle; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1507 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1508 |
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
|
1509 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
|
1510 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
|
1511 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
|
1512 { |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1513 xmlnode *blocklist, *item; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1514 PurpleAccount *account; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1515 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1516 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
|
1517 "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
|
1518 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
|
1519 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1520 if (blocklist == NULL) |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1521 return; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1522 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1523 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
|
1524 while (item != NULL) { |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1525 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
|
1526 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1527 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
|
1528 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
|
1529 } |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1530 } |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1531 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1532 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
|
1533 { |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1534 JabberIq *iq; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1535 xmlnode *blocklist; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1536 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1537 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
|
1538 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1539 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
|
1540 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
|
1541 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1542 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
|
1543 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1544 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
|
1545 } |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1546 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1547 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
|
1548 { |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1549 JabberStream *js; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1550 JabberIq *iq; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1551 xmlnode *block, *item; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1552 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1553 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
|
1554 if (js == NULL) |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1555 return; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1556 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1557 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
|
1558 { |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1559 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
|
1560 return; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1561 } |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1562 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1563 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
|
1564 { |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1565 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
|
1566 _("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
|
1567 return; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1568 } |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1569 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1570 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
|
1571 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1572 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
|
1573 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
|
1574 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1575 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
|
1576 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
|
1577 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1578 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
|
1579 } |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1580 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1581 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
|
1582 { |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1583 JabberStream *js; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1584 JabberIq *iq; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1585 xmlnode *unblock, *item; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1586 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1587 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
|
1588 if (js == NULL) |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1589 return; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1590 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1591 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
|
1592 { |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1593 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
|
1594 return; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1595 } |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1596 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1597 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
|
1598 return; |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1599 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1600 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
|
1601 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1602 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
|
1603 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
|
1604 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1605 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
|
1606 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
|
1607 |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1608 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
|
1609 } |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
24772
diff
changeset
|
1610 |
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
|
1611 void jabber_add_feature(const char *shortname, const char *namespace, JabberFeatureEnabled cb) { |
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
|
1612 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
|
1613 |
ab38146f8f78
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19999
diff
changeset
|
1614 g_return_if_fail(shortname != NULL); |
ab38146f8f78
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19999
diff
changeset
|
1615 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
|
1616 |
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
|
1617 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
|
1618 feat->shortname = g_strdup(shortname); |
2e0799b916b9
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents:
17568
diff
changeset
|
1619 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
|
1620 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
|
1621 |
17572
2e0799b916b9
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents:
17568
diff
changeset
|
1622 /* try to remove just in case it already exists in the list */ |
2e0799b916b9
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents:
17568
diff
changeset
|
1623 jabber_remove_feature(shortname); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25442
diff
changeset
|
1624 |
17572
2e0799b916b9
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents:
17568
diff
changeset
|
1625 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
|
1626 } |
95affacf6f82
Added the ability to define extensions to caps
Andreas Monitzer <pidgin@monitzer.com>
parents:
17562
diff
changeset
|
1627 |
17566
0370da969e8a
Implemented adding callbacks for PEP events. Moved the feature list to be application-global instead of per-connection (makes more sense).
Andreas Monitzer <pidgin@monitzer.com>
parents:
17563
diff
changeset
|
1628 void jabber_remove_feature(const char *shortname) { |
17572
2e0799b916b9
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents:
17568
diff
changeset
|
1629 GList *feature; |
2e0799b916b9
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents:
17568
diff
changeset
|
1630 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
|
1631 JabberFeature *feat = (JabberFeature*)feature->data; |
2e0799b916b9
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents:
17568
diff
changeset
|
1632 if(!strcmp(feat->shortname, shortname)) { |
2e0799b916b9
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents:
17568
diff
changeset
|
1633 g_free(feat->shortname); |
2e0799b916b9
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents:
17568
diff
changeset
|
1634 g_free(feat->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
|
1635 |
17572
2e0799b916b9
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents:
17568
diff
changeset
|
1636 g_free(feature->data); |
21538 | 1637 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
|
1638 break; |
2e0799b916b9
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents:
17568
diff
changeset
|
1639 } |
2e0799b916b9
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents:
17568
diff
changeset
|
1640 } |
17563
95affacf6f82
Added the ability to define extensions to caps
Andreas Monitzer <pidgin@monitzer.com>
parents:
17562
diff
changeset
|
1641 } |
95affacf6f82
Added the ability to define extensions to caps
Andreas Monitzer <pidgin@monitzer.com>
parents:
17562
diff
changeset
|
1642 |
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
|
1643 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
|
1644 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1645 return "jabber"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1646 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1647 |
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
|
1648 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
|
1649 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1650 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1651 JabberBuddy *jb = NULL; |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
1652 PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(b)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1653 |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
1654 if(!gc) |
15498
0d4890637238
clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents:
15463
diff
changeset
|
1655 return NULL; |
0d4890637238
clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents:
15463
diff
changeset
|
1656 |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
1657 js = gc->proto_data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1658 if(js) |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
1659 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
|
1660 |
15823 | 1661 if(!PURPLE_BUDDY_IS_ONLINE(b)) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1662 if(jb && (jb->subscription & JABBER_SUB_PENDING || |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1663 !(jb->subscription & JABBER_SUB_TO))) |
15463 | 1664 return "not-authorized"; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1665 } |
15463 | 1666 return NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1667 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1668 |
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
|
1669 char *jabber_status_text(PurpleBuddy *b) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1670 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1671 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
|
1672 JabberBuddy *jb = NULL; |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
1673 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
|
1674 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
|
1675 |
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
1676 if (gc && gc->proto_data) |
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
1677 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
|
1678 |
15823 | 1679 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
|
1680 ret = g_strdup(_("Not Authorized")); |
15823 | 1681 } 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
|
1682 ret = g_strdup(jb->error_msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1683 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1684 char *stripped; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1685 |
15823 | 1686 if(!(stripped = purple_markup_strip_html(jabber_buddy_get_status_msg(jb)))) { |
20571
c97e3ab9ef11
Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents:
20570
diff
changeset
|
1687 PurplePresence *presence = purple_buddy_get_presence(b); |
c97e3ab9ef11
Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents:
20570
diff
changeset
|
1688 if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) { |
c97e3ab9ef11
Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents:
20570
diff
changeset
|
1689 PurpleStatus *status = purple_presence_get_status(presence, "tune"); |
c97e3ab9ef11
Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents:
20570
diff
changeset
|
1690 stripped = g_strdup(purple_status_get_attr_string(status, PURPLE_TUNE_TITLE)); |
c97e3ab9ef11
Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents:
20570
diff
changeset
|
1691 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1692 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1693 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1694 if(stripped) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1695 ret = g_markup_escape_text(stripped, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1696 g_free(stripped); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1697 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1698 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1699 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1700 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1701 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1702 |
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
|
1703 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
|
1704 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1705 JabberBuddy *jb; |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
1706 PurpleAccount *account; |
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
1707 PurpleConnection *gc; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1708 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1709 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
|
1710 |
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
1711 account = purple_buddy_get_account(b); |
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
1712 g_return_if_fail(account != NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1713 |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
1714 gc = purple_account_get_connection(account); |
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
1715 g_return_if_fail(gc != NULL); |
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
1716 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
|
1717 |
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
1718 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
|
1719 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1720 if(jb) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1721 JabberBuddyResource *jbr = NULL; |
20571
c97e3ab9ef11
Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents:
20570
diff
changeset
|
1722 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
|
1723 const char *sub; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1724 GList *l; |
19722
eedf2918aace
Don't put "Mood: \(null\) \(null\)" on XMPP buddies
Sean Egan <seanegan@gmail.com>
parents:
19696
diff
changeset
|
1725 const char *mood; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1726 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1727 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
|
1728 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
|
1729 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1730 if(jb->subscription & JABBER_SUB_FROM) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1731 if(jb->subscription & JABBER_SUB_TO) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1732 sub = _("Both"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1733 else if(jb->subscription & JABBER_SUB_PENDING) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1734 sub = _("From (To pending)"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1735 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1736 sub = _("From"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1737 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1738 if(jb->subscription & JABBER_SUB_TO) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1739 sub = _("To"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1740 else if(jb->subscription & JABBER_SUB_PENDING) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1741 sub = _("None (To pending)"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1742 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1743 sub = _("None"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1744 } |
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
|
1745 |
15823 | 1746 purple_notify_user_info_add_pair(user_info, _("Subscription"), sub); |
23271
e7b6767f263b
The status type says that mood and moodtext are strings, so we don't
Mark Doliner <mark@kingant.net>
parents:
23182
diff
changeset
|
1747 |
20571
c97e3ab9ef11
Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents:
20570
diff
changeset
|
1748 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
|
1749 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
|
1750 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
|
1751 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
|
1752 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
|
1753 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
|
1754 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
|
1755 |
17573
2f067d8fb19a
Fixed a few small mistakes I discovered while testing user mood in Adium.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17572
diff
changeset
|
1756 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
|
1757 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
|
1758 } else |
2f067d8fb19a
Fixed a few small mistakes I discovered while testing user mood in Adium.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17572
diff
changeset
|
1759 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
|
1760 } |
22000
af0426c34c27
Utility functions to set and format song information. Closes #4398.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21978
diff
changeset
|
1761 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
|
1762 PurpleStatus *tune = purple_presence_get_status(presence, "tune"); |
c97e3ab9ef11
Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents:
20570
diff
changeset
|
1763 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
|
1764 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
|
1765 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
|
1766 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
|
1767 if (playing) { |
af0426c34c27
Utility functions to set and format song information. Closes #4398.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21978
diff
changeset
|
1768 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
|
1769 g_free(playing); |
af0426c34c27
Utility functions to set and format song information. Closes #4398.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21978
diff
changeset
|
1770 } |
20571
c97e3ab9ef11
Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents:
20570
diff
changeset
|
1771 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1772 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1773 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1774 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
|
1775 char *text = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1776 char *res = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1777 char *label, *value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1778 const char *state; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1779 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1780 jbr = l->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1781 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1782 if(jbr->status) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1783 char *tmp; |
15823 | 1784 text = purple_strreplace(jbr->status, "\n", "<br />\n"); |
1785 tmp = purple_markup_strip_html(text); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1786 g_free(text); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1787 text = g_markup_escape_text(tmp, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1788 g_free(tmp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1789 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1790 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1791 if(jbr->name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1792 res = g_strdup_printf(" (%s)", jbr->name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1793 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1794 state = jabber_buddy_state_get_name(jbr->state); |
15823 | 1795 if (text != NULL && !purple_utf8_strcasecmp(state, text)) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1796 g_free(text); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1797 text = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1798 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1799 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1800 label = g_strdup_printf("%s%s", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1801 _("Status"), (res ? res : "")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1802 value = g_strdup_printf("%s%s%s", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1803 state, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1804 (text ? ": " : ""), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1805 (text ? text : "")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1806 |
15823 | 1807 purple_notify_user_info_add_pair(user_info, label, value); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1808 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1809 g_free(label); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1810 g_free(value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1811 g_free(text); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1812 g_free(res); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1813 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1814 |
15823 | 1815 if(!PURPLE_BUDDY_IS_ONLINE(b) && jb->error_msg) { |
1816 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
|
1817 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1818 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1819 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1820 |
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
|
1821 GList *jabber_status_types(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1822 { |
15823 | 1823 PurpleStatusType *type; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1824 GList *types = NULL; |
15823 | 1825 PurpleValue *priority_value; |
24122
04d8a514d2bb
Updated support for XEP-0224.
Marcus Lundblad <ml@update.uu.se>
parents:
23988
diff
changeset
|
1826 PurpleValue *buzz_enabled; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1827 |
15823 | 1828 priority_value = purple_value_new(PURPLE_TYPE_INT); |
1829 purple_value_set_int(priority_value, 1); | |
24122
04d8a514d2bb
Updated support for XEP-0224.
Marcus Lundblad <ml@update.uu.se>
parents:
23988
diff
changeset
|
1830 buzz_enabled = purple_value_new(PURPLE_TYPE_BOOLEAN); |
04d8a514d2bb
Updated support for XEP-0224.
Marcus Lundblad <ml@update.uu.se>
parents:
23988
diff
changeset
|
1831 purple_value_set_boolean(buzz_enabled, TRUE); |
15823 | 1832 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
|
1833 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
|
1834 NULL, TRUE, TRUE, FALSE, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1835 "priority", _("Priority"), priority_value, |
15823 | 1836 "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
|
1837 "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
|
1838 "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
|
1839 "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
|
1840 "buzz", _("Allow Buzz"), buzz_enabled, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1841 NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1842 types = g_list_append(types, type); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1843 |
15823 | 1844 priority_value = purple_value_new(PURPLE_TYPE_INT); |
1845 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
|
1846 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
|
1847 purple_value_set_boolean(buzz_enabled, TRUE); |
15823 | 1848 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
|
1849 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
|
1850 _("Chatty"), TRUE, TRUE, FALSE, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1851 "priority", _("Priority"), priority_value, |
15823 | 1852 "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
|
1853 "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
|
1854 "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
|
1855 "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
|
1856 "buzz", _("Allow Buzz"), buzz_enabled, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1857 NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1858 types = g_list_append(types, type); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1859 |
15823 | 1860 priority_value = purple_value_new(PURPLE_TYPE_INT); |
1861 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
|
1862 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
|
1863 purple_value_set_boolean(buzz_enabled, TRUE); |
15823 | 1864 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
|
1865 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
|
1866 NULL, TRUE, TRUE, FALSE, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1867 "priority", _("Priority"), priority_value, |
15823 | 1868 "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
|
1869 "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
|
1870 "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
|
1871 "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
|
1872 "buzz", _("Allow Buzz"), buzz_enabled, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1873 NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1874 types = g_list_append(types, type); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1875 |
15823 | 1876 priority_value = purple_value_new(PURPLE_TYPE_INT); |
1877 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
|
1878 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
|
1879 purple_value_set_boolean(buzz_enabled, TRUE); |
15823 | 1880 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
|
1881 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
|
1882 NULL, TRUE, TRUE, FALSE, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1883 "priority", _("Priority"), priority_value, |
15823 | 1884 "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
|
1885 "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
|
1886 "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
|
1887 "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
|
1888 "buzz", _("Allow Buzz"), buzz_enabled, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1889 NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1890 types = g_list_append(types, type); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1891 |
15823 | 1892 priority_value = purple_value_new(PURPLE_TYPE_INT); |
1893 purple_value_set_int(priority_value, 0); | |
1894 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
|
1895 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
|
1896 _("Do Not Disturb"), TRUE, TRUE, FALSE, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1897 "priority", _("Priority"), priority_value, |
15823 | 1898 "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
|
1899 "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
|
1900 "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
|
1901 "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
|
1902 NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1903 types = g_list_append(types, type); |
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 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1906 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
|
1907 m = g_list_append(m, _("Invisible")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1908 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1909 |
15823 | 1910 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
|
1911 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
|
1912 NULL, TRUE, TRUE, FALSE, |
15823 | 1913 "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
|
1914 NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1915 types = g_list_append(types, type); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1916 |
20570
5913725cbcd6
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20076
diff
changeset
|
1917 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
|
1918 "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
|
1919 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
|
1920 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
|
1921 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
|
1922 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
|
1923 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
|
1924 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
|
1925 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
|
1926 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
|
1927 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
|
1928 NULL); |
5913725cbcd6
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20076
diff
changeset
|
1929 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
|
1930 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1931 return types; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1932 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1933 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1934 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
|
1935 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
|
1936 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
|
1937 xmlnode *packet, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1938 { |
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
|
1939 if (type == JABBER_IQ_RESULT) { |
15823 | 1940 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
|
1941 _("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
|
1942 |
647b841ea945
This patch prevents changing the saved account password for XMPP accounts
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21000
diff
changeset
|
1943 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
|
1944 } 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
|
1945 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
|
1946 |
15823 | 1947 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
|
1948 _("Error changing password"), msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1949 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1950 } |
21058
647b841ea945
This patch prevents changing the saved account password for XMPP accounts
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21000
diff
changeset
|
1951 |
647b841ea945
This patch prevents changing the saved account password for XMPP accounts
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21000
diff
changeset
|
1952 g_free(data); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1953 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1954 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1955 static void jabber_password_change_cb(JabberStream *js, |
15823 | 1956 PurpleRequestFields *fields) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1957 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1958 const char *p1, *p2; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1959 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1960 xmlnode *query, *y; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1961 |
15823 | 1962 p1 = purple_request_fields_get_string(fields, "password1"); |
1963 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
|
1964 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1965 if(strcmp(p1, p2)) { |
15823 | 1966 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
|
1967 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1968 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1969 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1970 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
|
1971 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1972 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
|
1973 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1974 query = xmlnode_get_child(iq->node, "query"); |
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 y = xmlnode_new_child(query, "username"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1977 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
|
1978 y = xmlnode_new_child(query, "password"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1979 xmlnode_insert_data(y, p1, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1980 |
21058
647b841ea945
This patch prevents changing the saved account password for XMPP accounts
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21000
diff
changeset
|
1981 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
|
1982 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1983 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1984 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1985 |
15823 | 1986 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
|
1987 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1988 |
15823 | 1989 PurpleConnection *gc = (PurpleConnection *) action->context; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1990 JabberStream *js = gc->proto_data; |
15823 | 1991 PurpleRequestFields *fields; |
1992 PurpleRequestFieldGroup *group; | |
1993 PurpleRequestField *field; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1994 |
15823 | 1995 fields = purple_request_fields_new(); |
1996 group = purple_request_field_group_new(NULL); | |
1997 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
|
1998 |
15823 | 1999 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
|
2000 "", FALSE); |
15823 | 2001 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
|
2002 purple_request_field_set_required(field, TRUE); |
15823 | 2003 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
|
2004 |
15823 | 2005 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
|
2006 "", FALSE); |
15823 | 2007 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
|
2008 purple_request_field_set_required(field, TRUE); |
15823 | 2009 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
|
2010 |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
2011 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
|
2012 _("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
|
2013 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
|
2014 _("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
|
2015 purple_connection_get_account(gc), NULL, NULL, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
2016 js); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2017 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2018 |
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
|
2019 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
|
2020 { |
17575
5fc8a8a25008
Implemented a mood menu action (non-functional right now for some reason)
Andreas Monitzer <pidgin@monitzer.com>
parents:
17573
diff
changeset
|
2021 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
|
2022 JabberStream *js = gc->proto_data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2023 GList *m = NULL; |
15823 | 2024 PurplePluginAction *act; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2025 |
15823 | 2026 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
|
2027 jabber_setup_set_info); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2028 m = g_list_append(m, act); |
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 /* if (js->protocol_options & CHANGE_PASSWORD) { */ |
15823 | 2031 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
|
2032 jabber_password_change); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2033 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2034 /* } */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2035 |
15823 | 2036 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
|
2037 jabber_user_search_begin); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2038 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2039 |
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
|
2040 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
|
2041 |
17575
5fc8a8a25008
Implemented a mood menu action (non-functional right now for some reason)
Andreas Monitzer <pidgin@monitzer.com>
parents:
17573
diff
changeset
|
2042 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
|
2043 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
|
2044 |
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
|
2045 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
|
2046 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
|
2047 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2048 return m; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2049 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2050 |
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
|
2051 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
|
2052 { |
15823 | 2053 PurpleBlistNode *gnode, *cnode; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2054 JabberID *jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2055 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2056 if(!(jid = jabber_id_new(name))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2057 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2058 |
25289
aa876d48b5b2
Some more struct hiding.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24294
diff
changeset
|
2059 for(gnode = purple_blist_get_root(); gnode; |
aa876d48b5b2
Some more struct hiding.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24294
diff
changeset
|
2060 gnode = purple_blist_node_get_sibling_next(gnode)) { |
aa876d48b5b2
Some more struct hiding.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24294
diff
changeset
|
2061 for(cnode = purple_blist_node_get_first_child(gnode); |
aa876d48b5b2
Some more struct hiding.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24294
diff
changeset
|
2062 cnode; |
aa876d48b5b2
Some more struct hiding.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24294
diff
changeset
|
2063 cnode = purple_blist_node_get_sibling_next(cnode)) { |
15823 | 2064 PurpleChat *chat = (PurpleChat*)cnode; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2065 const char *room, *server; |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
2066 GHashTable *components; |
15823 | 2067 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
|
2068 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2069 |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
2070 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
|
2071 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2072 |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
2073 components = purple_chat_get_components(chat); |
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
2074 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
|
2075 continue; |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23988
diff
changeset
|
2076 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
|
2077 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2078 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2079 if(jid->node && jid->domain && |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2080 !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
|
2081 jabber_id_free(jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2082 return chat; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2083 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2084 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2085 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2086 jabber_id_free(jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2087 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2088 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2089 |
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
|
2090 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
|
2091 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2092 JabberStream *js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2093 JabberID *jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2094 JabberBuddy *jb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2095 JabberBuddyResource *jbr; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2096 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2097 if(!(jid = jabber_id_new(who))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2098 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2099 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2100 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
|
2101 (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
|
2102 if(jbr->thread_id) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2103 g_free(jbr->thread_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2104 jbr->thread_id = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2105 } |
15648
193456f03b9c
Sending XEP 85 'gone' messages
Sean Egan <seanegan@gmail.com>
parents:
15607
diff
changeset
|
2106 if(jbr->chat_states == JABBER_CHAT_STATES_SUPPORTED) |
193456f03b9c
Sending XEP 85 'gone' messages
Sean Egan <seanegan@gmail.com>
parents:
15607
diff
changeset
|
2107 jabber_message_conv_closed(js, who); |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2110 jabber_id_free(jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2111 } |
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 |
20814
bde477ec6a71
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents:
20792
diff
changeset
|
2114 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
|
2115 xmlnode *packet, |
21358 | 2116 PurpleConnectionError *reason) |
15374
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 xmlnode *error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2119 const char *code = NULL, *text = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2120 const char *xmlns = xmlnode_get_namespace(packet); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2121 char *cdata = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2122 |
20814
bde477ec6a71
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents:
20792
diff
changeset
|
2123 #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
|
2124 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
|
2125 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2126 if((error = xmlnode_get_child(packet, "error"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2127 cdata = xmlnode_get_data(error); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2128 code = xmlnode_get_attrib(error, "code"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2129 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2130 /* Stanza errors */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2131 if(xmlnode_get_child(error, "bad-request")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2132 text = _("Bad Request"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2133 } else if(xmlnode_get_child(error, "conflict")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2134 text = _("Conflict"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2135 } 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
|
2136 text = _("Feature Not Implemented"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2137 } else if(xmlnode_get_child(error, "forbidden")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2138 text = _("Forbidden"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2139 } else if(xmlnode_get_child(error, "gone")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2140 text = _("Gone"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2141 } 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
|
2142 text = _("Internal Server Error"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2143 } else if(xmlnode_get_child(error, "item-not-found")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2144 text = _("Item Not Found"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2145 } 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
|
2146 text = _("Malformed XMPP ID"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2147 } 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
|
2148 text = _("Not Acceptable"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2149 } 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
|
2150 text = _("Not Allowed"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2151 } 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
|
2152 text = _("Not Authorized"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2153 } else if(xmlnode_get_child(error, "payment-required")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2154 text = _("Payment Required"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2155 } 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
|
2156 text = _("Recipient Unavailable"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2157 } else if(xmlnode_get_child(error, "redirect")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2158 /* XXX */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2159 } 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
|
2160 text = _("Registration Required"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2161 } 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
|
2162 text = _("Remote Server Not Found"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2163 } 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
|
2164 text = _("Remote Server Timeout"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2165 } 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
|
2166 text = _("Server Overloaded"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2167 } 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
|
2168 text = _("Service Unavailable"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2169 } 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
|
2170 text = _("Subscription Required"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2171 } 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
|
2172 text = _("Unexpected Request"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2173 } 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
|
2174 text = _("Unknown Error"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2175 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2176 } 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
|
2177 /* 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
|
2178 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
|
2179 if(xmlnode_get_child(packet, "aborted")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2180 text = _("Authorization Aborted"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2181 } 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
|
2182 text = _("Incorrect encoding in authorization"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2183 } 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
|
2184 text = _("Invalid authzid"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2185 } 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
|
2186 text = _("Invalid Authorization Mechanism"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2187 } 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
|
2188 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
|
2189 text = _("Authorization mechanism too weak"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2190 } 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
|
2191 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
|
2192 /* 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
|
2193 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
|
2194 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
|
2195 text = _("Not Authorized"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2196 } 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
|
2197 text = _("Temporary Authentication Failure"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2198 } 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
|
2199 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
|
2200 text = _("Authentication Failure"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2201 } |
15918
4be5d38ee117
Correctly handle the Jabber disconnection error for signing onto the
Mark Doliner <mark@kingant.net>
parents:
15916
diff
changeset
|
2202 } 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
|
2203 (!strcmp(packet->name, "error") && xmlns && |
15919 | 2204 !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
|
2205 /* Most common reason as default: */ |
21358 | 2206 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
|
2207 if(xmlnode_get_child(packet, "bad-format")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2208 text = _("Bad Format"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2209 } 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
|
2210 text = _("Bad Namespace Prefix"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2211 } else if(xmlnode_get_child(packet, "conflict")) { |
21358 | 2212 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
|
2213 text = _("Resource Conflict"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2214 } 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
|
2215 text = _("Connection Timeout"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2216 } 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
|
2217 text = _("Host Gone"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2218 } 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
|
2219 text = _("Host Unknown"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2220 } 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
|
2221 text = _("Improper Addressing"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2222 } 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
|
2223 text = _("Internal Server Error"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2224 } 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
|
2225 text = _("Invalid ID"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2226 } 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
|
2227 text = _("Invalid Namespace"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2228 } 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
|
2229 text = _("Invalid XML"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2230 } 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
|
2231 text = _("Non-matching Hosts"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2232 } 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
|
2233 text = _("Not Authorized"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2234 } 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
|
2235 text = _("Policy Violation"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2236 } 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
|
2237 text = _("Remote Connection Failed"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2238 } 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
|
2239 text = _("Resource Constraint"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2240 } 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
|
2241 text = _("Restricted XML"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2242 } 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
|
2243 text = _("See Other Host"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2244 } 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
|
2245 text = _("System Shutdown"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2246 } 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
|
2247 text = _("Undefined Condition"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2248 } 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
|
2249 text = _("Unsupported Encoding"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2250 } 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
|
2251 text = _("Unsupported Stanza Type"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2252 } 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
|
2253 text = _("Unsupported Version"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2254 } 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
|
2255 text = _("XML Not Well Formed"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2256 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2257 text = _("Stream Error"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2258 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2259 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2260 |
20814
bde477ec6a71
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents:
20792
diff
changeset
|
2261 #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
|
2262 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2263 if(text || cdata) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2264 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
|
2265 code ? ": " : "", text ? text : cdata); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2266 g_free(cdata); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2267 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2268 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2269 return NULL; |
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 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2272 |
15823 | 2273 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
|
2274 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
|
2275 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2276 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
|
2277 |
259f8635eeff
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents:
18323
diff
changeset
|
2278 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
|
2279 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
|
2280 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2281 jabber_chat_request_room_configure(chat); |
15823 | 2282 return PURPLE_CMD_RET_OK; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2283 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2284 |
15823 | 2285 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
|
2286 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
|
2287 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2288 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
|
2289 |
259f8635eeff
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents:
18323
diff
changeset
|
2290 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
|
2291 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
|
2292 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2293 jabber_chat_register(chat); |
15823 | 2294 return PURPLE_CMD_RET_OK; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2295 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2296 |
15823 | 2297 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
|
2298 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
|
2299 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2300 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
|
2301 |
259f8635eeff
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents:
18323
diff
changeset
|
2302 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
|
2303 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
|
2304 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2305 jabber_chat_change_topic(chat, args ? args[0] : NULL); |
15823 | 2306 return PURPLE_CMD_RET_OK; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2307 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2308 |
15823 | 2309 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
|
2310 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
|
2311 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2312 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
|
2313 |
18711
259f8635eeff
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents:
18323
diff
changeset
|
2314 if(!chat || !args || !args[0]) |
15823 | 2315 return PURPLE_CMD_RET_FAILED; |
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 jabber_chat_change_nick(chat, args[0]); |
15823 | 2318 return PURPLE_CMD_RET_OK; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2319 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2320 |
15823 | 2321 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
|
2322 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
|
2323 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2324 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
|
2325 |
259f8635eeff
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents:
18323
diff
changeset
|
2326 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
|
2327 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
|
2328 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2329 jabber_chat_part(chat, args ? args[0] : NULL); |
15823 | 2330 return PURPLE_CMD_RET_OK; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2331 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2332 |
15823 | 2333 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
|
2334 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
|
2335 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2336 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
|
2337 |
18711
259f8635eeff
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents:
18323
diff
changeset
|
2338 if(!chat || !args || !args[0]) |
15823 | 2339 return PURPLE_CMD_RET_FAILED; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2340 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2341 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
|
2342 *error = g_strdup_printf(_("Unable to ban user %s"), args[0]); |
15823 | 2343 return PURPLE_CMD_RET_FAILED; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2344 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2345 |
15823 | 2346 return PURPLE_CMD_RET_OK; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2347 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2348 |
15823 | 2349 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
|
2350 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
|
2351 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2352 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
|
2353 |
18711
259f8635eeff
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents:
18323
diff
changeset
|
2354 if (!chat || !args || !args[0] || !args[1]) |
15823 | 2355 return PURPLE_CMD_RET_FAILED; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2356 |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25442
diff
changeset
|
2357 if (strcmp(args[1], "owner") != 0 && |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2358 strcmp(args[1], "admin") != 0 && |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2359 strcmp(args[1], "member") != 0 && |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2360 strcmp(args[1], "outcast") != 0 && |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2361 strcmp(args[1], "none") != 0) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2362 *error = g_strdup_printf(_("Unknown affiliation: \"%s\""), args[1]); |
15823 | 2363 return PURPLE_CMD_RET_FAILED; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2364 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2365 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2366 if (!jabber_chat_affiliate_user(chat, args[0], args[1])) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2367 *error = g_strdup_printf(_("Unable to affiliate user %s as \"%s\""), args[0], args[1]); |
15823 | 2368 return PURPLE_CMD_RET_FAILED; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2369 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2370 |
15823 | 2371 return PURPLE_CMD_RET_OK; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2372 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2373 |
15823 | 2374 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
|
2375 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
|
2376 { |
18855
28a7c9dbbc2b
Fix uninitialized variable access.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18711
diff
changeset
|
2377 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
|
2378 |
18711
259f8635eeff
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents:
18323
diff
changeset
|
2379 if (!chat || !args || !args[0] || !args[1]) |
15823 | 2380 return PURPLE_CMD_RET_FAILED; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2381 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2382 if (strcmp(args[1], "moderator") != 0 && |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2383 strcmp(args[1], "participant") != 0 && |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2384 strcmp(args[1], "visitor") != 0 && |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2385 strcmp(args[1], "none") != 0) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2386 *error = g_strdup_printf(_("Unknown role: \"%s\""), args[1]); |
15823 | 2387 return PURPLE_CMD_RET_FAILED; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2388 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2389 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2390 if (!jabber_chat_role_user(chat, args[0], args[1])) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2391 *error = g_strdup_printf(_("Unable to set role \"%s\" for user: %s"), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2392 args[1], args[0]); |
15823 | 2393 return PURPLE_CMD_RET_FAILED; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2394 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2395 |
15823 | 2396 return PURPLE_CMD_RET_OK; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2397 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2398 |
15823 | 2399 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
|
2400 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
|
2401 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2402 if(!args || !args[0]) |
15823 | 2403 return PURPLE_CMD_RET_FAILED; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2404 |
15823 | 2405 jabber_chat_invite(purple_conversation_get_gc(conv), |
2406 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
|
2407 args[0]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2408 |
15823 | 2409 return PURPLE_CMD_RET_OK; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2410 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2411 |
15823 | 2412 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
|
2413 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
|
2414 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2415 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
|
2416 GHashTable *components; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2417 |
18711
259f8635eeff
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents:
18323
diff
changeset
|
2418 if(!chat || !args || !args[0]) |
15823 | 2419 return PURPLE_CMD_RET_FAILED; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2420 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2421 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
|
2422 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2423 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
|
2424 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
|
2425 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
|
2426 if(args[1]) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2427 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
|
2428 |
15823 | 2429 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
|
2430 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2431 g_hash_table_destroy(components); |
15823 | 2432 return PURPLE_CMD_RET_OK; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2433 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2434 |
15823 | 2435 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
|
2436 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
|
2437 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2438 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
|
2439 |
18711
259f8635eeff
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents:
18323
diff
changeset
|
2440 if(!chat || !args || !args[0]) |
15823 | 2441 return PURPLE_CMD_RET_FAILED; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2442 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2443 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
|
2444 *error = g_strdup_printf(_("Unable to kick user %s"), args[0]); |
15823 | 2445 return PURPLE_CMD_RET_FAILED; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2446 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2447 |
15823 | 2448 return PURPLE_CMD_RET_OK; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2449 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2450 |
15823 | 2451 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
|
2452 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
|
2453 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2454 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
|
2455 char *who; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2456 |
18711
259f8635eeff
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <mark@kingant.net>
parents:
18323
diff
changeset
|
2457 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
|
2458 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
|
2459 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2460 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
|
2461 |
15823 | 2462 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
|
2463 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2464 g_free(who); |
15823 | 2465 return PURPLE_CMD_RET_OK; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2466 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2467 |
17562
6ab1089e2101
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents:
17561
diff
changeset
|
2468 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
|
2469 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
|
2470 { |
25984
d24b476cc60f
Fix merge (i.e. reapply my changes here).
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
2471 PurpleAccount *account; |
d24b476cc60f
Fix merge (i.e. reapply my changes here).
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
2472 PurpleConnection *pc; |
d24b476cc60f
Fix merge (i.e. reapply my changes here).
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
2473 |
17562
6ab1089e2101
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents:
17561
diff
changeset
|
2474 if(!args || !args[0]) |
6ab1089e2101
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents:
17561
diff
changeset
|
2475 return PURPLE_CMD_RET_FAILED; |
6ab1089e2101
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents:
17561
diff
changeset
|
2476 |
25984
d24b476cc60f
Fix merge (i.e. reapply my changes here).
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
2477 account = purple_conversation_get_account(conv); |
d24b476cc60f
Fix merge (i.e. reapply my changes here).
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
2478 pc = purple_account_get_connection(account); |
d24b476cc60f
Fix merge (i.e. reapply my changes here).
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
2479 |
d24b476cc60f
Fix merge (i.e. reapply my changes here).
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
2480 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
|
2481 *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
|
2482 return PURPLE_CMD_RET_FAILED; |
6ab1089e2101
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents:
17561
diff
changeset
|
2483 } |
6ab1089e2101
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents:
17561
diff
changeset
|
2484 |
6ab1089e2101
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents:
17561
diff
changeset
|
2485 return PURPLE_CMD_RET_OK; |
6ab1089e2101
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents:
17561
diff
changeset
|
2486 } |
6ab1089e2101
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents:
17561
diff
changeset
|
2487 |
20852
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2488 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
|
2489 |
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2490 JabberBuddy *jb; |
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2491 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
|
2492 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
|
2493 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
|
2494 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
|
2495 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
|
2496 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
|
2497 |
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2498 if(!username) |
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2499 return FALSE; |
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2500 |
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2501 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
|
2502 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
|
2503 *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
|
2504 "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
|
2505 return FALSE; |
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2506 } |
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2507 |
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2508 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
|
2509 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
|
2510 *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
|
2511 alias); |
20852
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2512 return FALSE; |
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2513 } |
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2514 |
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
|
2515 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
|
2516 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
|
2517 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
|
2518 |
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
|
2519 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
|
2520 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
|
2521 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
|
2522 |
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
|
2523 /* 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
|
2524 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
|
2525 |
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
|
2526 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
|
2527 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
|
2528 |
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
|
2529 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
|
2530 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
|
2531 |
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
|
2532 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
|
2533 } 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
|
2534 *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
|
2535 "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
|
2536 return FALSE; |
20852
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2537 } |
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2538 } |
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2539 |
17615
cca457b9158b
disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents:
17614
diff
changeset
|
2540 static PurpleCmdRet jabber_cmd_buzz(PurpleConversation *conv, |
cca457b9158b
disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents:
17614
diff
changeset
|
2541 const char *cmd, char **args, char **error, void *data) |
cca457b9158b
disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents:
17614
diff
changeset
|
2542 { |
cca457b9158b
disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents:
17614
diff
changeset
|
2543 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
|
2544 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
|
2545 |
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
|
2546 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
|
2547 /* 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
|
2548 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
|
2549 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
|
2550 } 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
|
2551 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
|
2552 } |
a64d90cff01f
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <ml@update.uu.se>
parents:
24123
diff
changeset
|
2553 } 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
|
2554 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
|
2555 } |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25442
diff
changeset
|
2556 |
25197
8dee1fb9d8e9
Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <ml@update.uu.se>
parents:
25196
diff
changeset
|
2557 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
|
2558 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
|
2559 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
|
2560 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
|
2561 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
|
2562 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
|
2563 |
25197
8dee1fb9d8e9
Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <ml@update.uu.se>
parents:
25196
diff
changeset
|
2564 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
|
2565 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
|
2566 else |
8dee1fb9d8e9
Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <ml@update.uu.se>
parents:
25196
diff
changeset
|
2567 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
|
2568 |
25197
8dee1fb9d8e9
Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <ml@update.uu.se>
parents:
25196
diff
changeset
|
2569 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
|
2570 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
|
2571 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
|
2572 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
|
2573 |
25197
8dee1fb9d8e9
Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <ml@update.uu.se>
parents:
25196
diff
changeset
|
2574 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
|
2575 } else { |
17615
cca457b9158b
disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents:
17614
diff
changeset
|
2576 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
|
2577 } |
17615
cca457b9158b
disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents:
17614
diff
changeset
|
2578 } |
cca457b9158b
disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents:
17614
diff
changeset
|
2579 |
20149
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2580 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
|
2581 { |
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2582 static GList *types = NULL; |
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2583 |
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2584 if (!types) { |
22097
eab7d03edfcb
This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22034
diff
changeset
|
2585 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
|
2586 _("%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
|
2587 } |
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2588 |
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2589 return types; |
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2590 } |
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2591 |
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2592 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
|
2593 { |
20852
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2594 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
|
2595 gchar *error = NULL; |
20149
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2596 |
20852
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2597 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
|
2598 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
|
2599 g_free(error); |
20149
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2600 return FALSE; |
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2601 } |
20852
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2602 |
6cc03752fe59
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20851
diff
changeset
|
2603 return TRUE; |
20149
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2604 } |
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2605 |
be2538a92099
Comment a partial implementation of the libpurple attention API for
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
20076
diff
changeset
|
2606 |
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
|
2607 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
|
2608 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2609 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2610 } |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25635
diff
changeset
|
2611 |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2612 #ifdef USE_VV |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2613 typedef struct { |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
2614 PurpleAccount *account; |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2615 gchar *who; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2616 PurpleMediaSessionType type; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2617 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2618 } JabberMediaRequest; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2619 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2620 static void |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2621 jabber_media_cancel_cb(JabberMediaRequest *request, |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2622 PurpleRequestFields *fields) |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2623 { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2624 g_free(request->who); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2625 g_free(request); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2626 } |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2627 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2628 static void |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2629 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
|
2630 { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2631 PurpleRequestField *field = |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2632 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
|
2633 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
|
2634 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
|
2635 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
|
2636 (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
|
2637 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
|
2638 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2639 g_free(who); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2640 g_free(request->who); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2641 g_free(request); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2642 } |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2643 #endif |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2644 |
26447
34eb898478b4
Don't assume a PurpleMedia instance will be created immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26417
diff
changeset
|
2645 gboolean |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
2646 jabber_initiate_media(PurpleAccount *account, const char *who, |
25720
551a462b346a
Changed PurpleMediaStreamType to PurpleMediaSessionType.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25718
diff
changeset
|
2647 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
|
2648 { |
26416
6f0200f1e497
Clean up usage of USE_VV in the XMPP protocol.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26361
diff
changeset
|
2649 #ifdef USE_VV |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
2650 JabberStream *js = (JabberStream *) |
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
2651 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
|
2652 JabberBuddy *jb; |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2653 JabberBuddyResource *jbr = NULL; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2654 char *resource; |
26081
44a528094cbf
Support initiating voice calls to GTalk and Gmail.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26062
diff
changeset
|
2655 |
44a528094cbf
Support initiating voice calls to GTalk and Gmail.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26062
diff
changeset
|
2656 if (!js) { |
44a528094cbf
Support initiating voice calls to GTalk and Gmail.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26062
diff
changeset
|
2657 purple_debug_error("jabber", |
44a528094cbf
Support initiating voice calls to GTalk and Gmail.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26062
diff
changeset
|
2658 "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
|
2659 return FALSE; |
26081
44a528094cbf
Support initiating voice calls to GTalk and Gmail.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26062
diff
changeset
|
2660 } |
44a528094cbf
Support initiating voice calls to GTalk and Gmail.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26062
diff
changeset
|
2661 |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2662 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2663 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
|
2664 /* 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
|
2665 * default or anything, just do it */ |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2666 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2667 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
|
2668 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
|
2669 g_free(resource); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2670 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2671 if (type & PURPLE_MEDIA_AUDIO && |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2672 !jabber_resource_has_capability(jbr, |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2673 JINGLE_APP_RTP_SUPPORT_AUDIO) && |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2674 jabber_resource_has_capability(jbr, |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2675 GOOGLE_VOICE_CAP)) |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
2676 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
|
2677 else |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
2678 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
|
2679 } |
44a528094cbf
Support initiating voice calls to GTalk and Gmail.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26062
diff
changeset
|
2680 |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2681 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
|
2682 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2683 if(!jb || !jb->resources) { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2684 /* 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
|
2685 * 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
|
2686 * 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
|
2687 char *msg; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2688 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2689 if(!jb) { |
26518
28f1512b0f94
Minor grammatical message fixes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26514
diff
changeset
|
2690 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
|
2691 } else if(jb->subscription & JABBER_SUB_TO) { |
26518
28f1512b0f94
Minor grammatical message fixes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26514
diff
changeset
|
2692 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
|
2693 } else { |
26518
28f1512b0f94
Minor grammatical message fixes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26514
diff
changeset
|
2694 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
|
2695 } |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2696 |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
2697 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
|
2698 _("Media Initiation Failed"), msg); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2699 g_free(msg); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2700 return FALSE; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2701 } else if(!jb->resources->next) { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2702 /* 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
|
2703 * 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
|
2704 gchar *name; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2705 gboolean result; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2706 jbr = jb->resources->data; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2707 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
|
2708 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
|
2709 g_free(name); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2710 return result; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2711 } else { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2712 /* we've got multiple resources, |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2713 * 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
|
2714 GList *l; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2715 char *msg; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2716 PurpleRequestFields *fields; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2717 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
|
2718 "resource", _("Resource"), 0); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2719 PurpleRequestFieldGroup *group; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2720 JabberMediaRequest *request; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2721 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2722 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
|
2723 { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2724 JabberBuddyResource *ljbr = l->data; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2725 PurpleMediaCaps caps; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2726 gchar *name; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2727 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
|
2728 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
|
2729 g_free(name); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2730 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2731 if ((type & PURPLE_MEDIA_AUDIO) && |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2732 (type & PURPLE_MEDIA_VIDEO)) { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2733 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
|
2734 jbr = ljbr; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2735 purple_request_field_choice_add( |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2736 field, jbr->name); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2737 } |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2738 } else if (type & (PURPLE_MEDIA_AUDIO) && |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2739 (caps & PURPLE_MEDIA_CAPS_AUDIO)) { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2740 jbr = ljbr; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2741 purple_request_field_choice_add( |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2742 field, jbr->name); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2743 }else if (type & (PURPLE_MEDIA_VIDEO) && |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2744 (caps & PURPLE_MEDIA_CAPS_VIDEO)) { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2745 jbr = ljbr; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2746 purple_request_field_choice_add( |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2747 field, jbr->name); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2748 } |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2749 } |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2750 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2751 if (jbr == NULL) { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2752 purple_debug_error("jabber", |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2753 "No resources available\n"); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2754 return FALSE; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2755 } |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2756 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2757 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
|
2758 field)) <= 1) { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2759 gchar *name; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2760 gboolean result; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2761 purple_request_field_destroy(field); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2762 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
|
2763 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
|
2764 g_free(name); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2765 return result; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2766 } |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2767 |
26518
28f1512b0f94
Minor grammatical message fixes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26514
diff
changeset
|
2768 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
|
2769 fields = purple_request_fields_new(); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2770 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
|
2771 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
|
2772 request->account = account; |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2773 request->who = g_strdup(who); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2774 request->type = type; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2775 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2776 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
|
2777 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
|
2778 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
|
2779 NULL, fields, _("Initiate Media"), |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2780 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
|
2781 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
|
2782 account, who, NULL, request); |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2783 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2784 g_free(msg); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2785 return TRUE; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2786 } |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2787 #endif |
26447
34eb898478b4
Don't assume a PurpleMedia instance will be created immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26417
diff
changeset
|
2788 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
|
2789 } |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25635
diff
changeset
|
2790 |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
2791 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
|
2792 { |
26416
6f0200f1e497
Clean up usage of USE_VV in the XMPP protocol.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26361
diff
changeset
|
2793 #ifdef USE_VV |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
2794 JabberStream *js = (JabberStream *) |
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26559
diff
changeset
|
2795 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
|
2796 JabberBuddy *jb; |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2797 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
|
2798 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
|
2799 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
|
2800 |
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
|
2801 if (!js) { |
26500
da651b0f40a1
Demote debug error to info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26447
diff
changeset
|
2802 purple_debug_info("jabber", |
da651b0f40a1
Demote debug error to info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26447
diff
changeset
|
2803 "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
|
2804 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
|
2805 } |
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
|
2806 |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2807 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
|
2808 /* 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
|
2809 * default or anything, just do it */ |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2810 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2811 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
|
2812 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
|
2813 g_free(resource); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2814 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2815 if (!jbr) { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2816 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
|
2817 " 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
|
2818 return caps; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2819 } |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2820 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2821 if (jabber_resource_has_capability(jbr, |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2822 JINGLE_APP_RTP_SUPPORT_AUDIO)) |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2823 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
|
2824 PURPLE_MEDIA_CAPS_AUDIO; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2825 if (jabber_resource_has_capability(jbr, |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2826 JINGLE_APP_RTP_SUPPORT_VIDEO)) |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2827 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
|
2828 PURPLE_MEDIA_CAPS_VIDEO; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2829 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
|
2830 PURPLE_MEDIA_CAPS_VIDEO) |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2831 caps |= PURPLE_MEDIA_CAPS_AUDIO_VIDEO; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2832 if (caps != PURPLE_MEDIA_CAPS_NONE) { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2833 if (!jabber_resource_has_capability(jbr, |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2834 JINGLE_TRANSPORT_ICEUDP) && |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2835 !jabber_resource_has_capability(jbr, |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2836 JINGLE_TRANSPORT_RAWUDP)) { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2837 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
|
2838 "support the same transport types\n"); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2839 caps = PURPLE_MEDIA_CAPS_NONE; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2840 } else |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2841 caps |= PURPLE_MEDIA_CAPS_MODIFY_SESSION | |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2842 PURPLE_MEDIA_CAPS_CHANGE_DIRECTION; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2843 } |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2844 if (jabber_resource_has_capability(jbr, GOOGLE_VOICE_CAP)) |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2845 caps |= PURPLE_MEDIA_CAPS_AUDIO; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2846 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
|
2847 } |
26046
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26043
diff
changeset
|
2848 |
26514
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2849 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
|
2850 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2851 if(!jb || !jb->resources) { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2852 /* 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
|
2853 * 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
|
2854 * someone who is offline. */ |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2855 return caps; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2856 } else if(!jb->resources->next) { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2857 /* 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
|
2858 gchar *name; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2859 jbr = jb->resources->data; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2860 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
|
2861 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
|
2862 g_free(name); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2863 } else { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2864 /* 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
|
2865 GList *l; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2866 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2867 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
|
2868 { |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2869 gchar *name; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2870 jbr = l->data; |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2871 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
|
2872 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
|
2873 g_free(name); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26500
diff
changeset
|
2874 } |
26046
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26043
diff
changeset
|
2875 } |
26190
d6e23439b77c
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26168
diff
changeset
|
2876 |
d6e23439b77c
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26168
diff
changeset
|
2877 return caps; |
26416
6f0200f1e497
Clean up usage of USE_VV in the XMPP protocol.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26361
diff
changeset
|
2878 #else |
6f0200f1e497
Clean up usage of USE_VV in the XMPP protocol.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26361
diff
changeset
|
2879 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
|
2880 #endif |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25635
diff
changeset
|
2881 } |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25635
diff
changeset
|
2882 |
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
|
2883 void jabber_register_commands(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2884 { |
15823 | 2885 purple_cmd_register("config", "", PURPLE_CMD_P_PRPL, |
2886 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
|
2887 "prpl-jabber", jabber_cmd_chat_config, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2888 _("config: Configure a chat room."), NULL); |
15823 | 2889 purple_cmd_register("configure", "", PURPLE_CMD_P_PRPL, |
2890 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
|
2891 "prpl-jabber", jabber_cmd_chat_config, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2892 _("configure: Configure a chat room."), NULL); |
15823 | 2893 purple_cmd_register("nick", "s", PURPLE_CMD_P_PRPL, |
2894 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
|
2895 "prpl-jabber", jabber_cmd_chat_nick, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2896 _("nick <new nickname>: Change your nickname."), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2897 NULL); |
15823 | 2898 purple_cmd_register("part", "s", PURPLE_CMD_P_PRPL, |
2899 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
2900 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
|
2901 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
|
2902 NULL); |
15823 | 2903 purple_cmd_register("register", "", PURPLE_CMD_P_PRPL, |
2904 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
|
2905 "prpl-jabber", jabber_cmd_chat_register, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2906 _("register: Register with a chat room."), NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2907 /* XXX: there needs to be a core /topic cmd, methinks */ |
15823 | 2908 purple_cmd_register("topic", "s", PURPLE_CMD_P_PRPL, |
2909 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
2910 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
|
2911 jabber_cmd_chat_topic, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2912 _("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
|
2913 NULL); |
15823 | 2914 purple_cmd_register("ban", "ws", PURPLE_CMD_P_PRPL, |
2915 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
2916 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
|
2917 jabber_cmd_chat_ban, |
22602
9a84976c8e76
Correct some help strings for Jabber slash commands
Mark Doliner <mark@kingant.net>
parents:
22448
diff
changeset
|
2918 _("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
|
2919 NULL); |
15823 | 2920 purple_cmd_register("affiliate", "ws", PURPLE_CMD_P_PRPL, |
2921 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
2922 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
|
2923 jabber_cmd_chat_affiliate, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2924 _("affiliate <user> <owner|admin|member|outcast|none>: Set a user's affiliation with the room."), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2925 NULL); |
15823 | 2926 purple_cmd_register("role", "ws", PURPLE_CMD_P_PRPL, |
2927 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
2928 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
|
2929 jabber_cmd_chat_role, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2930 _("role <user> <moderator|participant|visitor|none>: Set a user's role in the room."), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2931 NULL); |
15823 | 2932 purple_cmd_register("invite", "ws", PURPLE_CMD_P_PRPL, |
2933 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
2934 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
|
2935 jabber_cmd_chat_invite, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2936 _("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
|
2937 NULL); |
15823 | 2938 purple_cmd_register("join", "ws", PURPLE_CMD_P_PRPL, |
2939 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
2940 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
|
2941 jabber_cmd_chat_join, |
22602
9a84976c8e76
Correct some help strings for Jabber slash commands
Mark Doliner <mark@kingant.net>
parents:
22448
diff
changeset
|
2942 _("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
|
2943 NULL); |
15823 | 2944 purple_cmd_register("kick", "ws", PURPLE_CMD_P_PRPL, |
2945 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
2946 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
|
2947 jabber_cmd_chat_kick, |
22602
9a84976c8e76
Correct some help strings for Jabber slash commands
Mark Doliner <mark@kingant.net>
parents:
22448
diff
changeset
|
2948 _("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
|
2949 NULL); |
15823 | 2950 purple_cmd_register("msg", "ws", PURPLE_CMD_P_PRPL, |
2951 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
|
2952 "prpl-jabber", jabber_cmd_chat_msg, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2953 _("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
|
2954 NULL); |
17562
6ab1089e2101
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents:
17561
diff
changeset
|
2955 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
|
2956 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
|
2957 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
|
2958 "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
|
2959 _("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
|
2960 NULL); |
24154
b3ab1c23cdf6
Register the /buzz command using PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS.
Marcus Lundblad <ml@update.uu.se>
parents:
24153
diff
changeset
|
2961 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
|
2962 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
|
2963 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, |
17615
cca457b9158b
disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents:
17614
diff
changeset
|
2964 "prpl-jabber", jabber_cmd_buzz, |
cca457b9158b
disapproval of revision '217714a0fa711773c0d419f8cd82297ffc339507'
Andreas Monitzer <pidgin@monitzer.com>
parents:
17614
diff
changeset
|
2965 _("buzz: Buzz a user to get their attention"), NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2966 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2967 |
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
|
2968 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
|
2969 jabber_init_plugin(PurplePlugin *plugin) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2970 { |
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
|
2971 my_protocol = plugin; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2972 } |