Fri, 24 Nov 2017 01:36:19 -0600
fix up jabber for the xfer cleanups
| 2086 | 1 | /* |
| 15884 | 2 | * purple - Jabber Protocol Plugin |
| 2086 | 3 | * |
|
28322
ac8fec1d2234
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents:
28266
diff
changeset
|
4 | * Purple is the legal property of its developers, whose names are too numerous |
|
ac8fec1d2234
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents:
28266
diff
changeset
|
5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
ac8fec1d2234
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents:
28266
diff
changeset
|
6 | * source distribution. |
| 2086 | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify | |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2 of the License, or | |
| 11 | * (at your option) any later version. | |
| 7014 | 12 | * |
| 2086 | 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19341
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 2086 | 21 | * |
| 22 | */ | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
23 | #include "internal.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
24 | |
| 7014 | 25 | #include "account.h" |
| 26 | #include "accountopt.h" | |
|
34706
02cb08146888
Renamed blist.[ch] to buddylist.[ch]
Ankit Vani <a@nevitus.org>
parents:
34703
diff
changeset
|
27 | #include "buddylist.h" |
|
27286
f637c4c27815
Fixup after propagating new caps stuff
Marcus Lundblad <malu@pidgin.im>
parents:
27285
diff
changeset
|
28 | #include "core.h" |
| 9130 | 29 | #include "cmds.h" |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10504
diff
changeset
|
30 | #include "connection.h" |
|
15952
c087855dc551
Re-arrange #includes so 'make check' stands a chance of passing during
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
31 | #include "conversation.h" |
| 7014 | 32 | #include "debug.h" |
|
34227
6d016a081401
HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34111
diff
changeset
|
33 | #include "http.h" |
| 7014 | 34 | #include "message.h" |
| 7072 | 35 | #include "notify.h" |
| 8713 | 36 | #include "pluginpref.h" |
|
14175
2bc5a80c5071
[gaim-migrate @ 16747]
Mark Doliner <markdoliner@pidgin.im>
parents:
14170
diff
changeset
|
37 | #include "proxy.h" |
|
36543
a8c3fecee2d3
Renamed prpl.[ch] to protocol.[ch]
Ankit Vani <a@nevitus.org>
parents:
36541
diff
changeset
|
38 | #include "protocol.h" |
| 7072 | 39 | #include "request.h" |
| 7014 | 40 | #include "server.h" |
|
25532
10e7f850b235
Patch from Paul Aurich to fix reporting idle when reconnecting only when we're
Marcus Lundblad <malu@pidgin.im>
parents:
25531
diff
changeset
|
41 | #include "status.h" |
|
7095
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7072
diff
changeset
|
42 | #include "util.h" |
| 9943 | 43 | #include "version.h" |
|
15952
c087855dc551
Re-arrange #includes so 'make check' stands a chance of passing during
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
44 | #include "xmlnode.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
45 | |
| 7014 | 46 | #include "auth.h" |
| 47 | #include "buddy.h" | |
|
26072
e8fce2b2b9fe
propagate from branch 'im.pidgin.pidgin' (head b4bbfacd7f2050d87deeda12ea7bb3adc3608cb7)
Paul Aurich <darkrain42@pidgin.im>
diff
changeset
|
48 | #include "caps.h" |
| 7014 | 49 | #include "chat.h" |
|
23626
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23325
diff
changeset
|
50 | #include "data.h" |
| 8312 | 51 | #include "disco.h" |
|
29913
58f5122fbcd3
First shot at refactoring the Google-specific XMPP code.
Marcus Lundblad <malu@pidgin.im>
parents:
29910
diff
changeset
|
52 | #include "google/google.h" |
|
36889
4dfe09057bed
Register jingle types dynamically
Ankit Vani <a@nevitus.org>
parents:
36862
diff
changeset
|
53 | #include "google/google_p2p.h" |
|
29913
58f5122fbcd3
First shot at refactoring the Google-specific XMPP code.
Marcus Lundblad <malu@pidgin.im>
parents:
29910
diff
changeset
|
54 | #include "google/google_roster.h" |
|
58f5122fbcd3
First shot at refactoring the Google-specific XMPP code.
Marcus Lundblad <malu@pidgin.im>
parents:
29910
diff
changeset
|
55 | #include "google/google_session.h" |
|
28879
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
56 | #include "ibb.h" |
| 7014 | 57 | #include "iq.h" |
| 58 | #include "jutil.h" | |
| 59 | #include "message.h" | |
| 60 | #include "parser.h" | |
| 61 | #include "presence.h" | |
| 62 | #include "jabber.h" | |
| 63 | #include "roster.h" | |
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
64 | #include "ping.h" |
|
9466
b6425eab60ca
[gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents:
9414
diff
changeset
|
65 | #include "si.h" |
|
29412
c27d9bb60878
Show the translated mood message (again), if it matches one of the moods we
Marcus Lundblad <malu@pidgin.im>
parents:
29407
diff
changeset
|
66 | #include "usermood.h" |
| 7923 | 67 | #include "xdata.h" |
|
17768
7be011945a1b
added preliminary frame for pep-support
Andreas Monitzer <am@adiumx.com>
parents:
17767
diff
changeset
|
68 | #include "pep.h" |
|
17817
8e0f271aab78
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 <am@adiumx.com>
parents:
17815
diff
changeset
|
69 | #include "adhoccommands.h" |
|
36668
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
70 | #include "xmpp.h" |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
71 | #include "gtalk.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
72 | |
|
26143
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
26117
diff
changeset
|
73 | #include "jingle/jingle.h" |
|
37164
aea7e3b20138
Added send_dtmf to protocol media interface
Ankit Vani <a@nevitus.org>
parents:
37158
diff
changeset
|
74 | #include "jingle/content.h" |
|
36889
4dfe09057bed
Register jingle types dynamically
Ankit Vani <a@nevitus.org>
parents:
36862
diff
changeset
|
75 | #include "jingle/iceudp.h" |
|
4dfe09057bed
Register jingle types dynamically
Ankit Vani <a@nevitus.org>
parents:
36862
diff
changeset
|
76 | #include "jingle/rawudp.h" |
|
26143
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
26117
diff
changeset
|
77 | #include "jingle/rtp.h" |
|
37164
aea7e3b20138
Added send_dtmf to protocol media interface
Ankit Vani <a@nevitus.org>
parents:
37158
diff
changeset
|
78 | #include "jingle/session.h" |
|
23626
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23325
diff
changeset
|
79 | |
|
29771
b276f3e127af
jabber: Don't ping more often than once a minute.
Paul Aurich <darkrain42@pidgin.im>
parents:
29749
diff
changeset
|
80 | #define PING_TIMEOUT 60 |
|
30056
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
81 | /* Send a whitespace keepalive to the server if we haven't sent |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
82 | * anything in the last 120 seconds |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
83 | */ |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
84 | #define DEFAULT_INACTIVITY_TIME 120 |
|
29771
b276f3e127af
jabber: Don't ping more often than once a minute.
Paul Aurich <darkrain42@pidgin.im>
parents:
29749
diff
changeset
|
85 | |
| 21623 | 86 | GList *jabber_features = NULL; |
|
23586
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23428
diff
changeset
|
87 | GList *jabber_identities = NULL; |
|
29845
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
88 | |
|
36668
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
89 | static PurpleProtocol *xmpp_protocol = NULL; |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
90 | static PurpleProtocol *gtalk_protocol = NULL; |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
91 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
92 | static GHashTable *jabber_cmds = NULL; /* PurpleProtocol * => GSList of ids */ |
|
4249
62583b5d3663
[gaim-migrate @ 4499]
Robert McQueen <robot101@debian.org>
parents:
4245
diff
changeset
|
93 | |
|
29844
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
94 | static gint plugin_ref = 0; |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
95 | |
|
18912
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18755
diff
changeset
|
96 | static void jabber_unregister_account_cb(JabberStream *js); |
|
4249
62583b5d3663
[gaim-migrate @ 4499]
Robert McQueen <robot101@debian.org>
parents:
4245
diff
changeset
|
97 | |
| 7014 | 98 | static void jabber_stream_init(JabberStream *js) |
| 99 | { | |
| 100 | char *open_stream; | |
|
3340
7e59a209931d
[gaim-migrate @ 3359]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3337
diff
changeset
|
101 | |
|
37423
d2f0259aa43f
Remove NULL-checks before free(). No functional change.
Michael McConville <mmcco@mykolab.com>
parents:
37417
diff
changeset
|
102 | g_free(js->stream_id); |
|
d2f0259aa43f
Remove NULL-checks before free(). No functional change.
Michael McConville <mmcco@mykolab.com>
parents:
37417
diff
changeset
|
103 | js->stream_id = NULL; |
|
29865
3a23d291568e
jabber: Clear the stream header when restarting a stream, and be
Paul Aurich <darkrain42@pidgin.im>
parents:
29864
diff
changeset
|
104 | |
| 7014 | 105 | open_stream = g_strdup_printf("<stream:stream to='%s' " |
|
28984
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28982
diff
changeset
|
106 | "xmlns='" NS_XMPP_CLIENT "' " |
|
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28982
diff
changeset
|
107 | "xmlns:stream='" NS_XMPP_STREAMS "' " |
| 7395 | 108 | "version='1.0'>", |
| 7291 | 109 | js->user->domain); |
| 13808 | 110 | /* setup the parser fresh for each stream */ |
| 111 | jabber_parser_setup(js); | |
| 7642 | 112 | jabber_send_raw(js, open_stream, -1); |
| 14062 | 113 | js->reinit = FALSE; |
| 7014 | 114 | g_free(open_stream); |
| 2086 | 115 | } |
| 116 | ||
| 7395 | 117 | static void |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26686
diff
changeset
|
118 | jabber_session_initialized_cb(JabberStream *js, const char *from, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26686
diff
changeset
|
119 | JabberIqType type, const char *id, |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
120 | PurpleXmlNode *packet, gpointer data) |
| 3311 | 121 | { |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26686
diff
changeset
|
122 | if (type == JABBER_IQ_RESULT) { |
|
25799
f2b56ff62042
Wait until receiving the roster to tell the core we're logged in
Paul Aurich <darkrain42@pidgin.im>
parents:
25798
diff
changeset
|
123 | jabber_disco_items_server(js); |
|
18912
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18755
diff
changeset
|
124 | if(js->unregistration) |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18755
diff
changeset
|
125 | jabber_unregister_account_cb(js); |
| 7014 | 126 | } else { |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31997
diff
changeset
|
127 | purple_connection_error(js->gc, |
| 21279 | 128 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
129 | ("Error initializing session")); |
| 3311 | 130 | } |
| 131 | } | |
| 132 | ||
| 7014 | 133 | static void jabber_session_init(JabberStream *js) |
| 3311 | 134 | { |
| 7014 | 135 | JabberIq *iq = jabber_iq_new(js, JABBER_IQ_SET); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
136 | PurpleXmlNode *session; |
| 3311 | 137 | |
| 7395 | 138 | jabber_iq_set_callback(iq, jabber_session_initialized_cb, NULL); |
| 3311 | 139 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
140 | session = purple_xmlnode_new_child(iq->node, "session"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
141 | purple_xmlnode_set_namespace(session, NS_XMPP_SESSION); |
| 3311 | 142 | |
| 7014 | 143 | jabber_iq_send(iq); |
| 3311 | 144 | } |
| 145 | ||
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26686
diff
changeset
|
146 | static void jabber_bind_result_cb(JabberStream *js, const char *from, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26686
diff
changeset
|
147 | JabberIqType type, const char *id, |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
148 | PurpleXmlNode *packet, gpointer data) |
| 7395 | 149 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
150 | PurpleXmlNode *bind; |
| 8401 | 151 | |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26686
diff
changeset
|
152 | if (type == JABBER_IQ_RESULT && |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
153 | (bind = purple_xmlnode_get_child_with_namespace(packet, "bind", NS_XMPP_BIND))) { |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
154 | PurpleXmlNode *jid; |
| 8401 | 155 | char *full_jid; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
156 | if((jid = purple_xmlnode_get_child(bind, "jid")) && (full_jid = purple_xmlnode_get_data(jid))) { |
| 8401 | 157 | jabber_id_free(js->user); |
|
28070
df31e9d5ad88
jabber: Stop fall-through on connection error.
Paul Aurich <darkrain42@pidgin.im>
parents:
28064
diff
changeset
|
158 | |
|
df31e9d5ad88
jabber: Stop fall-through on connection error.
Paul Aurich <darkrain42@pidgin.im>
parents:
28064
diff
changeset
|
159 | js->user = jabber_id_new(full_jid); |
|
df31e9d5ad88
jabber: Stop fall-through on connection error.
Paul Aurich <darkrain42@pidgin.im>
parents:
28064
diff
changeset
|
160 | if (js->user == NULL) { |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31997
diff
changeset
|
161 | purple_connection_error(js->gc, |
| 21279 | 162 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27605
diff
changeset
|
163 | _("Invalid response from server")); |
|
28070
df31e9d5ad88
jabber: Stop fall-through on connection error.
Paul Aurich <darkrain42@pidgin.im>
parents:
28064
diff
changeset
|
164 | g_free(full_jid); |
|
df31e9d5ad88
jabber: Stop fall-through on connection error.
Paul Aurich <darkrain42@pidgin.im>
parents:
28064
diff
changeset
|
165 | return; |
| 8401 | 166 | } |
|
28070
df31e9d5ad88
jabber: Stop fall-through on connection error.
Paul Aurich <darkrain42@pidgin.im>
parents:
28064
diff
changeset
|
167 | |
|
28071
a0706162fefd
jabber: Store the "own JabberBuddy" in the JabberStream* struct.
Paul Aurich <darkrain42@pidgin.im>
parents:
28070
diff
changeset
|
168 | js->user_jb = jabber_buddy_find(js, full_jid, TRUE); |
|
a0706162fefd
jabber: Store the "own JabberBuddy" in the JabberStream* struct.
Paul Aurich <darkrain42@pidgin.im>
parents:
28070
diff
changeset
|
169 | js->user_jb->subscription |= JABBER_SUB_BOTH; |
|
24430
77ba88ca54a6
Set the connection display name to the server-assigned full jid for XMPP
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
170 | |
|
77ba88ca54a6
Set the connection display name to the server-assigned full jid for XMPP
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
171 | purple_connection_set_display_name(js->gc, full_jid); |
|
77ba88ca54a6
Set the connection display name to the server-assigned full jid for XMPP
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
172 | |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10490
diff
changeset
|
173 | g_free(full_jid); |
| 8401 | 174 | } |
| 175 | } else { | |
| 21279 | 176 | PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
177 | char *msg = jabber_parse_error(js, packet, &reason); |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31997
diff
changeset
|
178 | purple_connection_error(js->gc, reason, msg); |
| 8401 | 179 | g_free(msg); |
|
30013
e9b97a2ae2a6
jabber: If binding fails, don't continue trying to initialize the session.
Paul Aurich <darkrain42@pidgin.im>
parents:
29979
diff
changeset
|
180 | |
|
e9b97a2ae2a6
jabber: If binding fails, don't continue trying to initialize the session.
Paul Aurich <darkrain42@pidgin.im>
parents:
29979
diff
changeset
|
181 | return; |
| 8401 | 182 | } |
| 7395 | 183 | |
| 184 | jabber_session_init(js); | |
| 185 | } | |
| 186 | ||
|
24819
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
187 | static char *jabber_prep_resource(char *input) { |
|
25600
251e085b3cfa
Grab only the "short" hostname on systems (like Fedora/RedHat, but others too)
Matěj Cepl <mcepl@redhat.com>
parents:
25573
diff
changeset
|
188 | char hostname[256], /* current hostname */ |
|
251e085b3cfa
Grab only the "short" hostname on systems (like Fedora/RedHat, but others too)
Matěj Cepl <mcepl@redhat.com>
parents:
25573
diff
changeset
|
189 | *dot = NULL; |
|
24819
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
190 | |
|
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
191 | /* Empty resource == don't send any */ |
|
25304
75bdc442f70c
Slightly modified version of a fix fqueze proposed for a crash with the empty
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
25290
diff
changeset
|
192 | if (input == NULL || *input == '\0') |
|
24819
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
193 | return NULL; |
|
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
194 | |
|
24833
d2257d9b0ffa
Avoid needlessly calling gethostname() if __HOSTNAME__ doesn't appear in the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24828
diff
changeset
|
195 | if (strstr(input, "__HOSTNAME__") == NULL) |
| 24850 | 196 | return g_strdup(input); |
|
24833
d2257d9b0ffa
Avoid needlessly calling gethostname() if __HOSTNAME__ doesn't appear in the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24828
diff
changeset
|
197 | |
|
24819
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
198 | /* Replace __HOSTNAME__ with hostname */ |
|
24824
2da1f210b9a2
me likes this better, References #5565
Ka-Hing Cheung <khc@pidgin.im>
parents:
24820
diff
changeset
|
199 | if (gethostname(hostname, sizeof(hostname) - 1)) { |
|
2da1f210b9a2
me likes this better, References #5565
Ka-Hing Cheung <khc@pidgin.im>
parents:
24820
diff
changeset
|
200 | purple_debug_warning("jabber", "gethostname: %s\n", g_strerror(errno)); |
|
2da1f210b9a2
me likes this better, References #5565
Ka-Hing Cheung <khc@pidgin.im>
parents:
24820
diff
changeset
|
201 | /* according to glibc doc, the only time an error is returned |
|
2da1f210b9a2
me likes this better, References #5565
Ka-Hing Cheung <khc@pidgin.im>
parents:
24820
diff
changeset
|
202 | is if the hostname is longer than the buffer, in which case |
|
2da1f210b9a2
me likes this better, References #5565
Ka-Hing Cheung <khc@pidgin.im>
parents:
24820
diff
changeset
|
203 | glibc 2.2+ would still fill the buffer with partial |
|
2da1f210b9a2
me likes this better, References #5565
Ka-Hing Cheung <khc@pidgin.im>
parents:
24820
diff
changeset
|
204 | hostname, so maybe we want to detect that and use it |
|
2da1f210b9a2
me likes this better, References #5565
Ka-Hing Cheung <khc@pidgin.im>
parents:
24820
diff
changeset
|
205 | instead |
|
2da1f210b9a2
me likes this better, References #5565
Ka-Hing Cheung <khc@pidgin.im>
parents:
24820
diff
changeset
|
206 | */ |
|
31963
4b77c9940154
Change another hostname lookup fallback to use g_strlcpy.
Ethan Blanton <elb@pidgin.im>
parents:
31928
diff
changeset
|
207 | g_strlcpy(hostname, "localhost", sizeof(hostname)); |
|
24819
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
208 | } |
|
24824
2da1f210b9a2
me likes this better, References #5565
Ka-Hing Cheung <khc@pidgin.im>
parents:
24820
diff
changeset
|
209 | hostname[sizeof(hostname) - 1] = '\0'; |
|
24819
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
210 | |
|
25600
251e085b3cfa
Grab only the "short" hostname on systems (like Fedora/RedHat, but others too)
Matěj Cepl <mcepl@redhat.com>
parents:
25573
diff
changeset
|
211 | /* We want only the short hostname, not the FQDN - this will prevent the |
|
251e085b3cfa
Grab only the "short" hostname on systems (like Fedora/RedHat, but others too)
Matěj Cepl <mcepl@redhat.com>
parents:
25573
diff
changeset
|
212 | * resource string from being unreasonably long on systems which stuff the |
|
251e085b3cfa
Grab only the "short" hostname on systems (like Fedora/RedHat, but others too)
Matěj Cepl <mcepl@redhat.com>
parents:
25573
diff
changeset
|
213 | * whole FQDN in the hostname */ |
|
251e085b3cfa
Grab only the "short" hostname on systems (like Fedora/RedHat, but others too)
Matěj Cepl <mcepl@redhat.com>
parents:
25573
diff
changeset
|
214 | if((dot = strchr(hostname, '.'))) |
|
30687
93133347cbcf
< QuLogic> on line 208 of jabber.c, should that be *dot?
Paul Aurich <darkrain42@pidgin.im>
parents:
30587
diff
changeset
|
215 | *dot = '\0'; |
|
25600
251e085b3cfa
Grab only the "short" hostname on systems (like Fedora/RedHat, but others too)
Matěj Cepl <mcepl@redhat.com>
parents:
25573
diff
changeset
|
216 | |
|
24819
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
217 | return purple_strreplace(input, "__HOSTNAME__", hostname); |
|
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
218 | } |
|
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
219 | |
|
30156
6ec7dbe44c83
jabber: I never understood why this was in auth.c anyway...
Paul Aurich <darkrain42@pidgin.im>
parents:
30155
diff
changeset
|
220 | static gboolean |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
221 | jabber_process_starttls(JabberStream *js, PurpleXmlNode *packet) |
|
30156
6ec7dbe44c83
jabber: I never understood why this was in auth.c anyway...
Paul Aurich <darkrain42@pidgin.im>
parents:
30155
diff
changeset
|
222 | { |
|
37939
8df8870e946c
Remove unused variables and functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37656
diff
changeset
|
223 | #if 0 |
|
37654
164b6f7c60b0
Fix a dead assignment
Gary Kramlich <grim@reaperworld.com>
parents:
37646
diff
changeset
|
224 | PurpleXmlNode *starttls; |
|
164b6f7c60b0
Fix a dead assignment
Gary Kramlich <grim@reaperworld.com>
parents:
37646
diff
changeset
|
225 | |
|
30156
6ec7dbe44c83
jabber: I never understood why this was in auth.c anyway...
Paul Aurich <darkrain42@pidgin.im>
parents:
30155
diff
changeset
|
226 | PurpleAccount *account; |
|
6ec7dbe44c83
jabber: I never understood why this was in auth.c anyway...
Paul Aurich <darkrain42@pidgin.im>
parents:
30155
diff
changeset
|
227 | |
|
6ec7dbe44c83
jabber: I never understood why this was in auth.c anyway...
Paul Aurich <darkrain42@pidgin.im>
parents:
30155
diff
changeset
|
228 | account = purple_connection_get_account(js->gc); |
|
6ec7dbe44c83
jabber: I never understood why this was in auth.c anyway...
Paul Aurich <darkrain42@pidgin.im>
parents:
30155
diff
changeset
|
229 | |
|
30820
647b57aa1a3a
jabber: Commit some non-existent code.
Paul Aurich <darkrain42@pidgin.im>
parents:
30816
diff
changeset
|
230 | /* |
|
647b57aa1a3a
jabber: Commit some non-existent code.
Paul Aurich <darkrain42@pidgin.im>
parents:
30816
diff
changeset
|
231 | * This code DOES NOT EXIST, will never be enabled by default, and |
|
647b57aa1a3a
jabber: Commit some non-existent code.
Paul Aurich <darkrain42@pidgin.im>
parents:
30816
diff
changeset
|
232 | * will never ever be supported (by me). |
|
647b57aa1a3a
jabber: Commit some non-existent code.
Paul Aurich <darkrain42@pidgin.im>
parents:
30816
diff
changeset
|
233 | * It's literally *only* for developer testing. |
|
647b57aa1a3a
jabber: Commit some non-existent code.
Paul Aurich <darkrain42@pidgin.im>
parents:
30816
diff
changeset
|
234 | */ |
|
647b57aa1a3a
jabber: Commit some non-existent code.
Paul Aurich <darkrain42@pidgin.im>
parents:
30816
diff
changeset
|
235 | { |
|
647b57aa1a3a
jabber: Commit some non-existent code.
Paul Aurich <darkrain42@pidgin.im>
parents:
30816
diff
changeset
|
236 | const gchar *connection_security = purple_account_get_string(account, "connection_security", JABBER_DEFAULT_REQUIRE_TLS); |
| 38358 | 237 | if (!purple_strequal(connection_security, "none")) { |
|
30820
647b57aa1a3a
jabber: Commit some non-existent code.
Paul Aurich <darkrain42@pidgin.im>
parents:
30816
diff
changeset
|
238 | jabber_send_raw(js, |
|
647b57aa1a3a
jabber: Commit some non-existent code.
Paul Aurich <darkrain42@pidgin.im>
parents:
30816
diff
changeset
|
239 | "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>", -1); |
|
647b57aa1a3a
jabber: Commit some non-existent code.
Paul Aurich <darkrain42@pidgin.im>
parents:
30816
diff
changeset
|
240 | return TRUE; |
|
647b57aa1a3a
jabber: Commit some non-existent code.
Paul Aurich <darkrain42@pidgin.im>
parents:
30816
diff
changeset
|
241 | } |
|
647b57aa1a3a
jabber: Commit some non-existent code.
Paul Aurich <darkrain42@pidgin.im>
parents:
30816
diff
changeset
|
242 | } |
|
647b57aa1a3a
jabber: Commit some non-existent code.
Paul Aurich <darkrain42@pidgin.im>
parents:
30816
diff
changeset
|
243 | #else |
|
37417
b29ee022017f
Require SSL/TLS support. ok'd by elb@
Michael McConville <mmcco@mykolab.com>
parents:
37384
diff
changeset
|
244 | jabber_send_raw(js, |
|
b29ee022017f
Require SSL/TLS support. ok'd by elb@
Michael McConville <mmcco@mykolab.com>
parents:
37384
diff
changeset
|
245 | "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>", -1); |
|
b29ee022017f
Require SSL/TLS support. ok'd by elb@
Michael McConville <mmcco@mykolab.com>
parents:
37384
diff
changeset
|
246 | return TRUE; |
|
30820
647b57aa1a3a
jabber: Commit some non-existent code.
Paul Aurich <darkrain42@pidgin.im>
parents:
30816
diff
changeset
|
247 | #endif |
|
30458
66c86178c6fc
We've already checked for the existance of the starttls node, so we know
Mark Doliner <markdoliner@pidgin.im>
parents:
30448
diff
changeset
|
248 | |
|
37656
0efbeb2be432
some more scan build fixes
Gary Kramlich <grim@reaperworld.com>
parents:
37654
diff
changeset
|
249 | #if 0 |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
250 | starttls = purple_xmlnode_get_child(packet, "starttls"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
251 | if(purple_xmlnode_get_child(starttls, "required")) { |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31997
diff
changeset
|
252 | purple_connection_error(js->gc, |
|
30156
6ec7dbe44c83
jabber: I never understood why this was in auth.c anyway...
Paul Aurich <darkrain42@pidgin.im>
parents:
30155
diff
changeset
|
253 | PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, |
|
6ec7dbe44c83
jabber: I never understood why this was in auth.c anyway...
Paul Aurich <darkrain42@pidgin.im>
parents:
30155
diff
changeset
|
254 | _("Server requires TLS/SSL, but no TLS/SSL support was found.")); |
|
30458
66c86178c6fc
We've already checked for the existance of the starttls node, so we know
Mark Doliner <markdoliner@pidgin.im>
parents:
30448
diff
changeset
|
255 | return TRUE; |
|
66c86178c6fc
We've already checked for the existance of the starttls node, so we know
Mark Doliner <markdoliner@pidgin.im>
parents:
30448
diff
changeset
|
256 | } |
|
66c86178c6fc
We've already checked for the existance of the starttls node, so we know
Mark Doliner <markdoliner@pidgin.im>
parents:
30448
diff
changeset
|
257 | |
|
38256
035f00c4fd87
Replace misused g_str_equal() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38091
diff
changeset
|
258 | if (purple_strequal("require_tls", purple_account_get_string(account, "connection_security", JABBER_DEFAULT_REQUIRE_TLS))) { |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31997
diff
changeset
|
259 | purple_connection_error(js->gc, |
|
30458
66c86178c6fc
We've already checked for the existance of the starttls node, so we know
Mark Doliner <markdoliner@pidgin.im>
parents:
30448
diff
changeset
|
260 | PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, |
|
30156
6ec7dbe44c83
jabber: I never understood why this was in auth.c anyway...
Paul Aurich <darkrain42@pidgin.im>
parents:
30155
diff
changeset
|
261 | _("You require encryption, but no TLS/SSL support was found.")); |
|
30458
66c86178c6fc
We've already checked for the existance of the starttls node, so we know
Mark Doliner <markdoliner@pidgin.im>
parents:
30448
diff
changeset
|
262 | return TRUE; |
|
30156
6ec7dbe44c83
jabber: I never understood why this was in auth.c anyway...
Paul Aurich <darkrain42@pidgin.im>
parents:
30155
diff
changeset
|
263 | } |
|
6ec7dbe44c83
jabber: I never understood why this was in auth.c anyway...
Paul Aurich <darkrain42@pidgin.im>
parents:
30155
diff
changeset
|
264 | |
|
6ec7dbe44c83
jabber: I never understood why this was in auth.c anyway...
Paul Aurich <darkrain42@pidgin.im>
parents:
30155
diff
changeset
|
265 | return FALSE; |
|
37656
0efbeb2be432
some more scan build fixes
Gary Kramlich <grim@reaperworld.com>
parents:
37654
diff
changeset
|
266 | #endif |
|
30156
6ec7dbe44c83
jabber: I never understood why this was in auth.c anyway...
Paul Aurich <darkrain42@pidgin.im>
parents:
30155
diff
changeset
|
267 | } |
|
6ec7dbe44c83
jabber: I never understood why this was in auth.c anyway...
Paul Aurich <darkrain42@pidgin.im>
parents:
30155
diff
changeset
|
268 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
269 | void jabber_stream_features_parse(JabberStream *js, PurpleXmlNode *packet) |
| 7395 | 270 | { |
|
30740
017077f79a0f
jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents:
30723
diff
changeset
|
271 | PurpleAccount *account = purple_connection_get_account(js->gc); |
|
017077f79a0f
jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents:
30723
diff
changeset
|
272 | const char *connection_security = |
|
017077f79a0f
jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents:
30723
diff
changeset
|
273 | purple_account_get_string(account, "connection_security", JABBER_DEFAULT_REQUIRE_TLS); |
|
017077f79a0f
jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents:
30723
diff
changeset
|
274 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
275 | if (purple_xmlnode_get_child(packet, "starttls")) { |
|
30740
017077f79a0f
jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents:
30723
diff
changeset
|
276 | if (jabber_process_starttls(js, packet)) { |
|
28623
4f7f9d7bb23d
jabber: Re-arrange the code that detects legacy servers so that we don't stomp over "Host Unknown" errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
28610
diff
changeset
|
277 | jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING_ENCRYPTION); |
| 8296 | 278 | return; |
|
28623
4f7f9d7bb23d
jabber: Re-arrange the code that detects legacy servers so that we don't stomp over "Host Unknown" errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
28610
diff
changeset
|
279 | } |
|
38256
035f00c4fd87
Replace misused g_str_equal() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38091
diff
changeset
|
280 | } else if (purple_strequal(connection_security, "require_tls") && !jabber_stream_is_ssl(js)) { |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31997
diff
changeset
|
281 | purple_connection_error(js->gc, |
| 21279 | 282 | PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
283 | _("You require encryption, but it is not available on this server.")); |
|
17830
ae563ca41109
Added an option to require SSL or TLS when connecting to an XMPP server.
Andreas Monitzer <am@adiumx.com>
parents:
17828
diff
changeset
|
284 | return; |
| 8296 | 285 | } |
| 286 | ||
| 10988 | 287 | if(js->registration) { |
| 288 | jabber_register_start(js); | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
289 | } else if(purple_xmlnode_get_child(packet, "mechanisms")) { |
|
28623
4f7f9d7bb23d
jabber: Re-arrange the code that detects legacy servers so that we don't stomp over "Host Unknown" errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
28610
diff
changeset
|
290 | jabber_stream_set_state(js, JABBER_STREAM_AUTHENTICATING); |
| 7395 | 291 | jabber_auth_start(js, packet); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
292 | } else if(purple_xmlnode_get_child(packet, "bind")) { |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
293 | PurpleXmlNode *bind, *resource; |
|
24819
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
294 | char *requested_resource; |
| 7395 | 295 | JabberIq *iq = jabber_iq_new(js, JABBER_IQ_SET); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
296 | bind = purple_xmlnode_new_child(iq->node, "bind"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
297 | purple_xmlnode_set_namespace(bind, NS_XMPP_BIND); |
|
24819
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
298 | requested_resource = jabber_prep_resource(js->user->resource); |
|
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
299 | |
|
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
300 | if (requested_resource != NULL) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
301 | resource = purple_xmlnode_new_child(bind, "resource"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
302 | purple_xmlnode_insert_data(resource, requested_resource, -1); |
|
25087
b26db53e5b66
Use g_free instead of free.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24850
diff
changeset
|
303 | g_free(requested_resource); |
|
24819
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
304 | } |
| 7395 | 305 | |
| 306 | jabber_iq_set_callback(iq, jabber_bind_result_cb, NULL); | |
| 307 | ||
| 308 | jabber_iq_send(iq); | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
309 | } else if (purple_xmlnode_get_child_with_namespace(packet, "ver", NS_ROSTER_VERSIONING)) { |
|
29096
362b96f6f3da
jabber: Roster Versioning support.
Paul Aurich <darkrain42@pidgin.im>
parents:
29094
diff
changeset
|
310 | js->server_caps |= JABBER_CAP_ROSTER_VERSIONING; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
311 | } else /* if(purple_xmlnode_get_child_with_namespace(packet, "auth")) */ { |
| 8296 | 312 | /* If we get an empty stream:features packet, or we explicitly get |
| 313 | * an auth feature with namespace http://jabber.org/features/iq-auth | |
| 314 | * we should revert back to iq:auth authentication, even though we're | |
| 315 | * connecting to an XMPP server. */ | |
| 316 | jabber_stream_set_state(js, JABBER_STREAM_AUTHENTICATING); | |
|
28855
c5bc85f9c00e
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <darkrain42@pidgin.im>
parents:
28832
diff
changeset
|
317 | jabber_auth_start_old(js); |
| 7395 | 318 | } |
| 319 | } | |
| 320 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
321 | static void jabber_stream_handle_error(JabberStream *js, PurpleXmlNode *packet) |
| 3311 | 322 | { |
| 21279 | 323 | PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
324 | char *msg = jabber_parse_error(js, packet, &reason); |
| 3311 | 325 | |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31997
diff
changeset
|
326 | purple_connection_error(js->gc, reason, msg); |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
327 | |
| 8401 | 328 | g_free(msg); |
| 2086 | 329 | } |
| 330 | ||
| 7014 | 331 | static void tls_init(JabberStream *js); |
| 2086 | 332 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
333 | void jabber_process_packet(JabberStream *js, PurpleXmlNode **packet) |
| 2086 | 334 | { |
|
29864
76caf53857f5
jabber: The parser is namespace-aware, so don't match on "stream:features".
Paul Aurich <darkrain42@pidgin.im>
parents:
29853
diff
changeset
|
335 | const char *name; |
| 15980 | 336 | const char *xmlns; |
| 337 | ||
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36613
diff
changeset
|
338 | purple_signal_emit(purple_connection_get_protocol(js->gc), "jabber-receiving-xmlnode", js->gc, packet); |
| 14358 | 339 | |
| 340 | /* if the signal leaves us with a null packet, we're done */ | |
|
17828
6957bf9d7330
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 <am@adiumx.com>
parents:
17827
diff
changeset
|
341 | if(NULL == *packet) |
| 14358 | 342 | return; |
| 343 | ||
|
29864
76caf53857f5
jabber: The parser is namespace-aware, so don't match on "stream:features".
Paul Aurich <darkrain42@pidgin.im>
parents:
29853
diff
changeset
|
344 | name = (*packet)->name; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
345 | xmlns = purple_xmlnode_get_namespace(*packet); |
| 15980 | 346 | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
347 | if(purple_strequal((*packet)->name, "iq")) { |
|
17828
6957bf9d7330
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 <am@adiumx.com>
parents:
17827
diff
changeset
|
348 | jabber_iq_parse(js, *packet); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
349 | } else if(purple_strequal((*packet)->name, "presence")) { |
|
17828
6957bf9d7330
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 <am@adiumx.com>
parents:
17827
diff
changeset
|
350 | jabber_presence_parse(js, *packet); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
351 | } else if(purple_strequal((*packet)->name, "message")) { |
|
17828
6957bf9d7330
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 <am@adiumx.com>
parents:
17827
diff
changeset
|
352 | jabber_message_parse(js, *packet); |
|
29864
76caf53857f5
jabber: The parser is namespace-aware, so don't match on "stream:features".
Paul Aurich <darkrain42@pidgin.im>
parents:
29853
diff
changeset
|
353 | } else if (purple_strequal(xmlns, NS_XMPP_STREAMS)) { |
|
38256
035f00c4fd87
Replace misused g_str_equal() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38091
diff
changeset
|
354 | if (purple_strequal(name, "features")) |
|
29864
76caf53857f5
jabber: The parser is namespace-aware, so don't match on "stream:features".
Paul Aurich <darkrain42@pidgin.im>
parents:
29853
diff
changeset
|
355 | jabber_stream_features_parse(js, *packet); |
|
38256
035f00c4fd87
Replace misused g_str_equal() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38091
diff
changeset
|
356 | else if (purple_strequal(name, "error")) |
|
29864
76caf53857f5
jabber: The parser is namespace-aware, so don't match on "stream:features".
Paul Aurich <darkrain42@pidgin.im>
parents:
29853
diff
changeset
|
357 | jabber_stream_handle_error(js, *packet); |
|
76caf53857f5
jabber: The parser is namespace-aware, so don't match on "stream:features".
Paul Aurich <darkrain42@pidgin.im>
parents:
29853
diff
changeset
|
358 | } else if (purple_strequal(xmlns, NS_XMPP_SASL)) { |
|
76caf53857f5
jabber: The parser is namespace-aware, so don't match on "stream:features".
Paul Aurich <darkrain42@pidgin.im>
parents:
29853
diff
changeset
|
359 | if (js->state != JABBER_STREAM_AUTHENTICATING) |
|
76caf53857f5
jabber: The parser is namespace-aware, so don't match on "stream:features".
Paul Aurich <darkrain42@pidgin.im>
parents:
29853
diff
changeset
|
360 | purple_debug_warning("jabber", "Ignoring spurious SASL stanza %s\n", name); |
|
76caf53857f5
jabber: The parser is namespace-aware, so don't match on "stream:features".
Paul Aurich <darkrain42@pidgin.im>
parents:
29853
diff
changeset
|
361 | else { |
|
38256
035f00c4fd87
Replace misused g_str_equal() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38091
diff
changeset
|
362 | if (purple_strequal(name, "challenge")) |
|
29864
76caf53857f5
jabber: The parser is namespace-aware, so don't match on "stream:features".
Paul Aurich <darkrain42@pidgin.im>
parents:
29853
diff
changeset
|
363 | jabber_auth_handle_challenge(js, *packet); |
|
38256
035f00c4fd87
Replace misused g_str_equal() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38091
diff
changeset
|
364 | else if (purple_strequal(name, "success")) |
|
29864
76caf53857f5
jabber: The parser is namespace-aware, so don't match on "stream:features".
Paul Aurich <darkrain42@pidgin.im>
parents:
29853
diff
changeset
|
365 | jabber_auth_handle_success(js, *packet); |
|
38256
035f00c4fd87
Replace misused g_str_equal() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38091
diff
changeset
|
366 | else if (purple_strequal(name, "failure")) |
|
29864
76caf53857f5
jabber: The parser is namespace-aware, so don't match on "stream:features".
Paul Aurich <darkrain42@pidgin.im>
parents:
29853
diff
changeset
|
367 | jabber_auth_handle_failure(js, *packet); |
|
76caf53857f5
jabber: The parser is namespace-aware, so don't match on "stream:features".
Paul Aurich <darkrain42@pidgin.im>
parents:
29853
diff
changeset
|
368 | } |
|
76caf53857f5
jabber: The parser is namespace-aware, so don't match on "stream:features".
Paul Aurich <darkrain42@pidgin.im>
parents:
29853
diff
changeset
|
369 | } else if (purple_strequal(xmlns, NS_XMPP_TLS)) { |
|
76caf53857f5
jabber: The parser is namespace-aware, so don't match on "stream:features".
Paul Aurich <darkrain42@pidgin.im>
parents:
29853
diff
changeset
|
370 | if (js->state != JABBER_STREAM_INITIALIZING_ENCRYPTION || js->gsc) |
|
76caf53857f5
jabber: The parser is namespace-aware, so don't match on "stream:features".
Paul Aurich <darkrain42@pidgin.im>
parents:
29853
diff
changeset
|
371 | purple_debug_warning("jabber", "Ignoring spurious %s\n", name); |
|
76caf53857f5
jabber: The parser is namespace-aware, so don't match on "stream:features".
Paul Aurich <darkrain42@pidgin.im>
parents:
29853
diff
changeset
|
372 | else { |
|
38256
035f00c4fd87
Replace misused g_str_equal() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38091
diff
changeset
|
373 | if (purple_strequal(name, "proceed")) |
|
29864
76caf53857f5
jabber: The parser is namespace-aware, so don't match on "stream:features".
Paul Aurich <darkrain42@pidgin.im>
parents:
29853
diff
changeset
|
374 | tls_init(js); |
|
76caf53857f5
jabber: The parser is namespace-aware, so don't match on "stream:features".
Paul Aurich <darkrain42@pidgin.im>
parents:
29853
diff
changeset
|
375 | /* TODO: Handle <failure/>, I guess? */ |
|
76caf53857f5
jabber: The parser is namespace-aware, so don't match on "stream:features".
Paul Aurich <darkrain42@pidgin.im>
parents:
29853
diff
changeset
|
376 | } |
| 7014 | 377 | } else { |
|
28828
7c1855f037e7
jabber: Convert to purple_debug_* convenience functions.
Paul Aurich <darkrain42@pidgin.im>
parents:
28827
diff
changeset
|
378 | purple_debug_warning("jabber", "Unknown packet: %s\n", (*packet)->name); |
| 2086 | 379 | } |
| 380 | } | |
| 381 | ||
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
382 | static int jabber_do_send(JabberStream *js, const char *data, int len) |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
383 | { |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
384 | int ret; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
385 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
386 | if (js->gsc) |
| 15884 | 387 | ret = purple_ssl_write(js->gsc, data, len); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
388 | else |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
389 | ret = write(js->fd, data, len); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
390 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
391 | return ret; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
392 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
393 | |
| 15884 | 394 | static void jabber_send_cb(gpointer data, gint source, PurpleInputCondition cond) |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
395 | { |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
396 | JabberStream *js = data; |
|
34529
68cf25486001
GObjectify PurpleCircBuffer as PurpleCircularBuffer (from gobjectification branch)
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
397 | const gchar *output = NULL; |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
398 | int ret, writelen; |
|
34529
68cf25486001
GObjectify PurpleCircBuffer as PurpleCircularBuffer (from gobjectification branch)
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
399 | |
|
68cf25486001
GObjectify PurpleCircBuffer as PurpleCircularBuffer (from gobjectification branch)
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
400 | writelen = purple_circular_buffer_get_max_read(js->write_buffer); |
|
68cf25486001
GObjectify PurpleCircBuffer as PurpleCircularBuffer (from gobjectification branch)
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
401 | output = purple_circular_buffer_get_output(js->write_buffer); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
402 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
403 | if (writelen == 0) { |
| 15884 | 404 | purple_input_remove(js->writeh); |
|
13746
790924f38349
[gaim-migrate @ 16155]
Mark Doliner <markdoliner@pidgin.im>
parents:
13546
diff
changeset
|
405 | js->writeh = 0; |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
406 | return; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
407 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
408 | |
|
34529
68cf25486001
GObjectify PurpleCircBuffer as PurpleCircularBuffer (from gobjectification branch)
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
409 | ret = jabber_do_send(js, output, writelen); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
410 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
411 | if (ret < 0 && errno == EAGAIN) |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
412 | return; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
413 | else if (ret <= 0) { |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27605
diff
changeset
|
414 | gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), |
|
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27605
diff
changeset
|
415 | g_strerror(errno)); |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31997
diff
changeset
|
416 | purple_connection_error(js->gc, |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27605
diff
changeset
|
417 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
|
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27605
diff
changeset
|
418 | g_free(tmp); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
419 | return; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
420 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
421 | |
|
34529
68cf25486001
GObjectify PurpleCircBuffer as PurpleCircularBuffer (from gobjectification branch)
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
422 | purple_circular_buffer_mark_read(js->write_buffer, ret); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
423 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
424 | |
|
23519
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
425 | static gboolean do_jabber_send_raw(JabberStream *js, const char *data, int len) |
| 2086 | 426 | { |
| 7014 | 427 | int ret; |
|
23519
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
428 | gboolean success = TRUE; |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
429 | |
|
30155
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
430 | g_return_val_if_fail(len > 0, FALSE); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
431 | |
|
30056
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
432 | if (js->state == JABBER_STREAM_CONNECTED) |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
433 | jabber_stream_restart_inactivity_timer(js); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
434 | |
|
13746
790924f38349
[gaim-migrate @ 16155]
Mark Doliner <markdoliner@pidgin.im>
parents:
13546
diff
changeset
|
435 | if (js->writeh == 0) |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
436 | ret = jabber_do_send(js, data, len); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
437 | else { |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
438 | ret = -1; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
439 | errno = EAGAIN; |
|
2814
91cc1a0cdee0
[gaim-migrate @ 2827]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2800
diff
changeset
|
440 | } |
|
91cc1a0cdee0
[gaim-migrate @ 2827]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2800
diff
changeset
|
441 | |
|
23519
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
442 | if (ret < 0 && errno != EAGAIN) { |
|
29262
6ec383410c8e
jabber: When doing writes while disconnecting, 'ignore' errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
29222
diff
changeset
|
443 | PurpleAccount *account = purple_connection_get_account(js->gc); |
|
6ec383410c8e
jabber: When doing writes while disconnecting, 'ignore' errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
29222
diff
changeset
|
444 | /* |
|
6ec383410c8e
jabber: When doing writes while disconnecting, 'ignore' errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
29222
diff
changeset
|
445 | * The server may have closed the socket (on a stream error), so if |
|
6ec383410c8e
jabber: When doing writes while disconnecting, 'ignore' errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
29222
diff
changeset
|
446 | * we're disconnecting, don't generate (possibly another) error that |
|
6ec383410c8e
jabber: When doing writes while disconnecting, 'ignore' errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
29222
diff
changeset
|
447 | * (for some UIs) would mask the first. |
|
6ec383410c8e
jabber: When doing writes while disconnecting, 'ignore' errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
29222
diff
changeset
|
448 | */ |
|
32722
50ed95d90d55
Add purple_account_is_disconnecting() accessor function.
Andrew Victor <andrew.victor@mxit.com>
parents:
32721
diff
changeset
|
449 | if (!purple_account_is_disconnecting(account)) { |
|
29262
6ec383410c8e
jabber: When doing writes while disconnecting, 'ignore' errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
29222
diff
changeset
|
450 | gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), |
|
6ec383410c8e
jabber: When doing writes while disconnecting, 'ignore' errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
29222
diff
changeset
|
451 | g_strerror(errno)); |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31997
diff
changeset
|
452 | purple_connection_error(js->gc, |
|
29262
6ec383410c8e
jabber: When doing writes while disconnecting, 'ignore' errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
29222
diff
changeset
|
453 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
|
6ec383410c8e
jabber: When doing writes while disconnecting, 'ignore' errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
29222
diff
changeset
|
454 | g_free(tmp); |
|
6ec383410c8e
jabber: When doing writes while disconnecting, 'ignore' errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
29222
diff
changeset
|
455 | } |
|
6ec383410c8e
jabber: When doing writes while disconnecting, 'ignore' errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
29222
diff
changeset
|
456 | |
|
23519
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
457 | success = FALSE; |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
458 | } else if (ret < len) { |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
459 | if (ret < 0) |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
460 | ret = 0; |
|
13746
790924f38349
[gaim-migrate @ 16155]
Mark Doliner <markdoliner@pidgin.im>
parents:
13546
diff
changeset
|
461 | if (js->writeh == 0) |
| 15884 | 462 | js->writeh = purple_input_add( |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
463 | js->gsc ? js->gsc->fd : js->fd, |
| 15884 | 464 | PURPLE_INPUT_WRITE, jabber_send_cb, js); |
|
34529
68cf25486001
GObjectify PurpleCircBuffer as PurpleCircularBuffer (from gobjectification branch)
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
465 | purple_circular_buffer_append(js->write_buffer, |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
466 | data + ret, len - ret); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
467 | } |
|
23519
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
468 | |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
469 | return success; |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
470 | } |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
471 | |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
472 | void jabber_send_raw(JabberStream *js, const char *data, int len) |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
473 | { |
|
30155
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
474 | PurpleConnection *gc; |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
475 | PurpleAccount *account; |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
476 | |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
477 | gc = js->gc; |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
478 | account = purple_connection_get_account(gc); |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
479 | |
|
35997
23e05a4a90b3
Silence some already dismissed coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35235
diff
changeset
|
480 | g_return_if_fail(data != NULL); |
|
23e05a4a90b3
Silence some already dismissed coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35235
diff
changeset
|
481 | |
|
23519
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
482 | /* because printing a tab to debug every minute gets old */ |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
483 | if (data && !purple_strequal(data, "\t")) { |
|
28827
76ec9a15f1a8
jabber: Print account name on sent stanzas in the debug log.
Paul Aurich <darkrain42@pidgin.im>
parents:
28760
diff
changeset
|
484 | const char *username; |
|
25328
95d3adda6822
Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <darkrain42@pidgin.im>
parents:
25304
diff
changeset
|
485 | char *text = NULL, *last_part = NULL, *tag_start = NULL; |
|
95d3adda6822
Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <darkrain42@pidgin.im>
parents:
25304
diff
changeset
|
486 | |
|
95d3adda6822
Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <darkrain42@pidgin.im>
parents:
25304
diff
changeset
|
487 | /* Because debug logs with plaintext passwords make me sad */ |
|
31128
116e599c707f
jabber: Print out plaintext-equivalent passwords when PURPLE_UNSAFE_DEBUG is set.
Paul Aurich <darkrain42@pidgin.im>
parents:
30845
diff
changeset
|
488 | if (!purple_debug_is_unsafe() && js->state != JABBER_STREAM_CONNECTED && |
|
25328
95d3adda6822
Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <darkrain42@pidgin.im>
parents:
25304
diff
changeset
|
489 | /* Either <auth> or <query><password>... */ |
|
95d3adda6822
Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <darkrain42@pidgin.im>
parents:
25304
diff
changeset
|
490 | (((tag_start = strstr(data, "<auth ")) && |
|
28984
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28982
diff
changeset
|
491 | strstr(data, "xmlns='" NS_XMPP_SASL "'")) || |
|
25328
95d3adda6822
Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <darkrain42@pidgin.im>
parents:
25304
diff
changeset
|
492 | ((tag_start = strstr(data, "<query ")) && |
|
95d3adda6822
Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <darkrain42@pidgin.im>
parents:
25304
diff
changeset
|
493 | strstr(data, "xmlns='jabber:iq:auth'>") && |
|
95d3adda6822
Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <darkrain42@pidgin.im>
parents:
25304
diff
changeset
|
494 | (tag_start = strstr(tag_start, "<password>"))))) { |
|
95d3adda6822
Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <darkrain42@pidgin.im>
parents:
25304
diff
changeset
|
495 | char *data_start, *tag_end = strchr(tag_start, '>'); |
|
95d3adda6822
Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <darkrain42@pidgin.im>
parents:
25304
diff
changeset
|
496 | text = g_strdup(data); |
|
95d3adda6822
Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <darkrain42@pidgin.im>
parents:
25304
diff
changeset
|
497 | |
|
25739
a10f2ed69334
*** Plucked rev b786784e (datallah@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents:
25727
diff
changeset
|
498 | /* Better to print out some wacky debugging than crash |
|
a10f2ed69334
*** Plucked rev b786784e (datallah@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents:
25727
diff
changeset
|
499 | * due to a plugin sending bad xml */ |
|
a10f2ed69334
*** Plucked rev b786784e (datallah@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents:
25727
diff
changeset
|
500 | if (tag_end == NULL) |
|
a10f2ed69334
*** Plucked rev b786784e (datallah@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents:
25727
diff
changeset
|
501 | tag_end = tag_start; |
|
a10f2ed69334
*** Plucked rev b786784e (datallah@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents:
25727
diff
changeset
|
502 | |
|
25328
95d3adda6822
Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <darkrain42@pidgin.im>
parents:
25304
diff
changeset
|
503 | data_start = text + (tag_end - data) + 1; |
|
95d3adda6822
Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <darkrain42@pidgin.im>
parents:
25304
diff
changeset
|
504 | |
|
95d3adda6822
Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <darkrain42@pidgin.im>
parents:
25304
diff
changeset
|
505 | last_part = strchr(data_start, '<'); |
|
95d3adda6822
Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <darkrain42@pidgin.im>
parents:
25304
diff
changeset
|
506 | *data_start = '\0'; |
|
95d3adda6822
Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <darkrain42@pidgin.im>
parents:
25304
diff
changeset
|
507 | } |
|
95d3adda6822
Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <darkrain42@pidgin.im>
parents:
25304
diff
changeset
|
508 | |
|
30155
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
509 | username = purple_connection_get_display_name(gc); |
|
28827
76ec9a15f1a8
jabber: Print account name on sent stanzas in the debug log.
Paul Aurich <darkrain42@pidgin.im>
parents:
28760
diff
changeset
|
510 | if (!username) |
|
30155
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
511 | username = purple_account_get_username(account); |
|
28827
76ec9a15f1a8
jabber: Print account name on sent stanzas in the debug log.
Paul Aurich <darkrain42@pidgin.im>
parents:
28760
diff
changeset
|
512 | |
|
76ec9a15f1a8
jabber: Print account name on sent stanzas in the debug log.
Paul Aurich <darkrain42@pidgin.im>
parents:
28760
diff
changeset
|
513 | purple_debug_misc("jabber", "Sending%s (%s): %s%s%s\n", |
|
76ec9a15f1a8
jabber: Print account name on sent stanzas in the debug log.
Paul Aurich <darkrain42@pidgin.im>
parents:
28760
diff
changeset
|
514 | jabber_stream_is_ssl(js) ? " (ssl)" : "", username, |
|
76ec9a15f1a8
jabber: Print account name on sent stanzas in the debug log.
Paul Aurich <darkrain42@pidgin.im>
parents:
28760
diff
changeset
|
515 | text ? text : data, |
|
25328
95d3adda6822
Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <darkrain42@pidgin.im>
parents:
25304
diff
changeset
|
516 | last_part ? "password removed" : "", |
|
95d3adda6822
Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <darkrain42@pidgin.im>
parents:
25304
diff
changeset
|
517 | last_part ? last_part : ""); |
|
95d3adda6822
Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <darkrain42@pidgin.im>
parents:
25304
diff
changeset
|
518 | |
|
95d3adda6822
Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <darkrain42@pidgin.im>
parents:
25304
diff
changeset
|
519 | g_free(text); |
|
95d3adda6822
Don't log passwords for XMPP when using SASL PLAIN or old-style IQ Auth so
Paul Aurich <darkrain42@pidgin.im>
parents:
25304
diff
changeset
|
520 | } |
|
23519
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
521 | |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36613
diff
changeset
|
522 | purple_signal_emit(purple_connection_get_protocol(gc), "jabber-sending-text", gc, &data); |
|
23519
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
523 | if (data == NULL) |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
524 | return; |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
525 | |
|
30155
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
526 | if (len == -1) |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
527 | len = strlen(data); |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
528 | |
|
23519
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
529 | /* If we've got a security layer, we need to encode the data, |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
530 | * splitting it on the maximum buffer length negotiated */ |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
531 | #ifdef HAVE_CYRUS_SASL |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
532 | if (js->sasl_maxbuf>0) { |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
533 | int pos = 0; |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
534 | |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
535 | if (!js->gsc && js->fd<0) |
|
30153
3cee3e2efd03
jabber: I don't see how this is possible, and it looks like an error to me.
Paul Aurich <darkrain42@pidgin.im>
parents:
30150
diff
changeset
|
536 | g_return_if_reached(); |
|
23519
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
537 | |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
538 | while (pos < len) { |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
539 | int towrite; |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
540 | const char *out; |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
541 | unsigned olen; |
|
30155
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
542 | int rc; |
|
23519
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
543 | |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
544 | towrite = MIN((len - pos), js->sasl_maxbuf); |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
545 | |
|
30155
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
546 | rc = sasl_encode(js->sasl, &data[pos], towrite, |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
547 | &out, &olen); |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
548 | if (rc != SASL_OK) { |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
549 | gchar *error = |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
550 | g_strdup_printf(_("SASL error: %s"), |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
551 | sasl_errdetail(js->sasl)); |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
552 | purple_debug_error("jabber", |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
553 | "sasl_encode error %d: %s\n", rc, |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
554 | sasl_errdetail(js->sasl)); |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31997
diff
changeset
|
555 | purple_connection_error(gc, |
|
30155
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
556 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
557 | error); |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
558 | g_free(error); |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
559 | return; |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
560 | } |
|
23519
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
561 | pos += towrite; |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
562 | |
|
30155
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
563 | /* do_jabber_send_raw returns FALSE when it throws a |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
564 | * connection error. |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
565 | */ |
|
23519
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
566 | if (!do_jabber_send_raw(js, out, olen)) |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
567 | break; |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
568 | } |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
569 | return; |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
570 | } |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
571 | #endif |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
572 | |
|
28064
6b6e3949132f
jabber: Remove js->use_bosh
Paul Aurich <darkrain42@pidgin.im>
parents:
28049
diff
changeset
|
573 | if (js->bosh) |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34238
diff
changeset
|
574 | jabber_bosh_connection_send(js->bosh, data); |
|
24873
7d1e91d5ec46
Jabber BOSH: more fixes.
Paul Aurich <darkrain42@pidgin.im>
parents:
24872
diff
changeset
|
575 | else |
|
23955
18bd5d80fb7b
explicit merge of '8d5884281cfb1c7a26fe80c919e38fa13f7a0c4b'
Paul Aurich <darkrain42@pidgin.im>
diff
changeset
|
576 | do_jabber_send_raw(js, data, len); |
| 14604 | 577 | } |
| 7014 | 578 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
579 | int jabber_protocol_send_raw(PurpleConnection *gc, const char *buf, int len) |
| 14604 | 580 | { |
|
30155
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
581 | JabberStream *js = purple_connection_get_protocol_data(gc); |
|
30448
736dde71e3ec
jabber: Stricter checks on the send_raw prpl function.
Paul Aurich <darkrain42@pidgin.im>
parents:
30156
diff
changeset
|
582 | |
|
736dde71e3ec
jabber: Stricter checks on the send_raw prpl function.
Paul Aurich <darkrain42@pidgin.im>
parents:
30156
diff
changeset
|
583 | g_return_val_if_fail(js != NULL, -1); |
|
736dde71e3ec
jabber: Stricter checks on the send_raw prpl function.
Paul Aurich <darkrain42@pidgin.im>
parents:
30156
diff
changeset
|
584 | /* TODO: It's probably worthwhile to restrict this to when the account |
|
736dde71e3ec
jabber: Stricter checks on the send_raw prpl function.
Paul Aurich <darkrain42@pidgin.im>
parents:
30156
diff
changeset
|
585 | * state is CONNECTED, but I can /almost/ envision reasons for wanting |
|
736dde71e3ec
jabber: Stricter checks on the send_raw prpl function.
Paul Aurich <darkrain42@pidgin.im>
parents:
30156
diff
changeset
|
586 | * to do things during the connection process. |
|
736dde71e3ec
jabber: Stricter checks on the send_raw prpl function.
Paul Aurich <darkrain42@pidgin.im>
parents:
30156
diff
changeset
|
587 | */ |
|
736dde71e3ec
jabber: Stricter checks on the send_raw prpl function.
Paul Aurich <darkrain42@pidgin.im>
parents:
30156
diff
changeset
|
588 | |
| 14604 | 589 | jabber_send_raw(js, buf, len); |
|
36256
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
36025
diff
changeset
|
590 | return (len < 0 ? (int)strlen(buf) : len); |
|
2814
91cc1a0cdee0
[gaim-migrate @ 2827]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2800
diff
changeset
|
591 | } |
|
91cc1a0cdee0
[gaim-migrate @ 2827]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2800
diff
changeset
|
592 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
593 | void jabber_send_signal_cb(PurpleConnection *pc, PurpleXmlNode **packet, |
|
27225
48c94daedc1c
Use the jabber-sending-xmlnode signal to send all XMPP stanzas.
Paul Aurich <darkrain42@pidgin.im>
parents:
27223
diff
changeset
|
594 | gpointer unused) |
| 2086 | 595 | { |
|
27924
ef40c7484edc
Set the namespace properly on stanzas for BOSH.
Paul Aurich <darkrain42@pidgin.im>
parents:
27918
diff
changeset
|
596 | JabberStream *js; |
| 7014 | 597 | char *txt; |
| 7642 | 598 | int len; |
| 2086 | 599 | |
|
27225
48c94daedc1c
Use the jabber-sending-xmlnode signal to send all XMPP stanzas.
Paul Aurich <darkrain42@pidgin.im>
parents:
27223
diff
changeset
|
600 | if (NULL == packet) |
| 14358 | 601 | return; |
| 602 | ||
|
36068
e9b9320a985a
Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36055
diff
changeset
|
603 | PURPLE_ASSERT_CONNECTION_IS_VALID(pc); |
| 14358 | 604 | |
|
27924
ef40c7484edc
Set the namespace properly on stanzas for BOSH.
Paul Aurich <darkrain42@pidgin.im>
parents:
27918
diff
changeset
|
605 | js = purple_connection_get_protocol_data(pc); |
|
28974
c781d3082146
Add some safety to jabber_send_signal_cb in case someone else was listening
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
28928
diff
changeset
|
606 | |
|
c781d3082146
Add some safety to jabber_send_signal_cb in case someone else was listening
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
28928
diff
changeset
|
607 | if (NULL == js) |
|
c781d3082146
Add some safety to jabber_send_signal_cb in case someone else was listening
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
28928
diff
changeset
|
608 | return; |
|
c781d3082146
Add some safety to jabber_send_signal_cb in case someone else was listening
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
28928
diff
changeset
|
609 | |
|
28064
6b6e3949132f
jabber: Remove js->use_bosh
Paul Aurich <darkrain42@pidgin.im>
parents:
28049
diff
changeset
|
610 | if (js->bosh) |
|
38256
035f00c4fd87
Replace misused g_str_equal() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38091
diff
changeset
|
611 | if (purple_strequal((*packet)->name, "message") || |
|
035f00c4fd87
Replace misused g_str_equal() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38091
diff
changeset
|
612 | purple_strequal((*packet)->name, "iq") || |
|
035f00c4fd87
Replace misused g_str_equal() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38091
diff
changeset
|
613 | purple_strequal((*packet)->name, "presence")) |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
614 | purple_xmlnode_set_namespace(*packet, NS_XMPP_CLIENT); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
615 | txt = purple_xmlnode_to_str(*packet, &len); |
| 7642 | 616 | jabber_send_raw(js, txt, len); |
| 7014 | 617 | g_free(txt); |
| 2086 | 618 | } |
| 619 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
620 | void jabber_send(JabberStream *js, PurpleXmlNode *packet) |
|
21974
daa6296d122d
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@pidgin.im>
parents:
21929
diff
changeset
|
621 | { |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36613
diff
changeset
|
622 | purple_signal_emit(purple_connection_get_protocol(js->gc), "jabber-sending-xmlnode", js->gc, &packet); |
|
21974
daa6296d122d
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@pidgin.im>
parents:
21929
diff
changeset
|
623 | } |
|
daa6296d122d
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@pidgin.im>
parents:
21929
diff
changeset
|
624 | |
|
25555
dd0cb987435f
Make the XMPP keepalive use jabber_ping_jid instead of building it itself.
Paul Aurich <darkrain42@pidgin.im>
parents:
25552
diff
changeset
|
625 | static gboolean jabber_keepalive_timeout(PurpleConnection *gc) |
|
21974
daa6296d122d
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@pidgin.im>
parents:
21929
diff
changeset
|
626 | { |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
627 | JabberStream *js = purple_connection_get_protocol_data(gc); |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31997
diff
changeset
|
628 | purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27605
diff
changeset
|
629 | _("Ping timed out")); |
|
27304
b2dc447b8c0b
The XMPP keepalive timeout handle needs to be a guint.
Paul Aurich <darkrain42@pidgin.im>
parents:
27293
diff
changeset
|
630 | js->keepalive_timeout = 0; |
|
21974
daa6296d122d
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@pidgin.im>
parents:
21929
diff
changeset
|
631 | return FALSE; |
|
daa6296d122d
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@pidgin.im>
parents:
21929
diff
changeset
|
632 | } |
|
daa6296d122d
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@pidgin.im>
parents:
21929
diff
changeset
|
633 | |
|
16302
eb633ebf84f2
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@pidgin.im>
parents:
16180
diff
changeset
|
634 | void jabber_keepalive(PurpleConnection *gc) |
| 2086 | 635 | { |
|
29771
b276f3e127af
jabber: Don't ping more often than once a minute.
Paul Aurich <darkrain42@pidgin.im>
parents:
29749
diff
changeset
|
636 | JabberStream *js = purple_connection_get_protocol_data(gc); |
|
b276f3e127af
jabber: Don't ping more often than once a minute.
Paul Aurich <darkrain42@pidgin.im>
parents:
29749
diff
changeset
|
637 | time_t now = time(NULL); |
|
b276f3e127af
jabber: Don't ping more often than once a minute.
Paul Aurich <darkrain42@pidgin.im>
parents:
29749
diff
changeset
|
638 | |
|
b276f3e127af
jabber: Don't ping more often than once a minute.
Paul Aurich <darkrain42@pidgin.im>
parents:
29749
diff
changeset
|
639 | if (js->keepalive_timeout == 0 && (now - js->last_ping) >= PING_TIMEOUT) { |
|
b276f3e127af
jabber: Don't ping more often than once a minute.
Paul Aurich <darkrain42@pidgin.im>
parents:
29749
diff
changeset
|
640 | js->last_ping = now; |
|
b276f3e127af
jabber: Don't ping more often than once a minute.
Paul Aurich <darkrain42@pidgin.im>
parents:
29749
diff
changeset
|
641 | |
|
27143
977add4a215e
Stop trying to be clever with XMPP keepalive pings.
Paul Aurich <darkrain42@pidgin.im>
parents:
27110
diff
changeset
|
642 | jabber_keepalive_ping(js); |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
38358
diff
changeset
|
643 | js->keepalive_timeout = g_timeout_add_seconds(120, |
|
25555
dd0cb987435f
Make the XMPP keepalive use jabber_ping_jid instead of building it itself.
Paul Aurich <darkrain42@pidgin.im>
parents:
25552
diff
changeset
|
644 | (GSourceFunc)(jabber_keepalive_timeout), gc); |
|
22587
661321b20a01
Only allow one keepalive_timeout at a time. This prevents us from starting a
Evan Schoenberg <evands@pidgin.im>
parents:
22580
diff
changeset
|
645 | } |
| 2086 | 646 | } |
| 647 | ||
| 7014 | 648 | static void |
| 15884 | 649 | jabber_recv_cb_ssl(gpointer data, PurpleSslConnection *gsc, |
| 650 | PurpleInputCondition cond) | |
| 6764 | 651 | { |
| 15884 | 652 | PurpleConnection *gc = data; |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
653 | JabberStream *js = purple_connection_get_protocol_data(gc); |
| 6764 | 654 | int len; |
| 7014 | 655 | static char buf[4096]; |
| 6768 | 656 | |
|
36068
e9b9320a985a
Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36055
diff
changeset
|
657 | PURPLE_ASSERT_CONNECTION_IS_VALID(gc); |
| 6768 | 658 | |
| 15884 | 659 | while((len = purple_ssl_read(gsc, buf, sizeof(buf) - 1)) > 0) { |
|
32679
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
660 | purple_connection_update_last_received(gc); |
| 6764 | 661 | buf[len] = '\0'; |
|
34297
0f1f0b8c84f8
Fix some debug log warnings, adjust verbosity level
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34269
diff
changeset
|
662 | purple_debug_misc("jabber", "Recv (ssl)(%d): %s", len, buf); |
| 7014 | 663 | jabber_parser_process(js, buf, len); |
| 14062 | 664 | if(js->reinit) |
| 665 | jabber_stream_init(js); | |
| 13280 | 666 | } |
| 667 | ||
|
23539
19dd5b0bbe76
Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <markdoliner@pidgin.im>
parents:
23532
diff
changeset
|
668 | if(len < 0 && errno == EAGAIN) |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
669 | return; |
|
23539
19dd5b0bbe76
Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <markdoliner@pidgin.im>
parents:
23532
diff
changeset
|
670 | else { |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27605
diff
changeset
|
671 | gchar *tmp; |
|
23539
19dd5b0bbe76
Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <markdoliner@pidgin.im>
parents:
23532
diff
changeset
|
672 | if (len == 0) |
| 33740 | 673 | tmp = g_strdup(_("Server closed the connection")); |
|
23539
19dd5b0bbe76
Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <markdoliner@pidgin.im>
parents:
23532
diff
changeset
|
674 | else |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27605
diff
changeset
|
675 | tmp = g_strdup_printf(_("Lost connection with server: %s"), |
|
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27605
diff
changeset
|
676 | g_strerror(errno)); |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31997
diff
changeset
|
677 | purple_connection_error(js->gc, |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27605
diff
changeset
|
678 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
|
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27605
diff
changeset
|
679 | g_free(tmp); |
|
23539
19dd5b0bbe76
Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <markdoliner@pidgin.im>
parents:
23532
diff
changeset
|
680 | } |
| 2086 | 681 | } |
| 682 | ||
| 7014 | 683 | static void |
| 15884 | 684 | jabber_recv_cb(gpointer data, gint source, PurpleInputCondition condition) |
| 2086 | 685 | { |
| 15884 | 686 | PurpleConnection *gc = data; |
|
30155
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
687 | JabberStream *js = purple_connection_get_protocol_data(gc); |
| 7014 | 688 | int len; |
| 689 | static char buf[4096]; | |
| 2086 | 690 | |
|
36068
e9b9320a985a
Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36055
diff
changeset
|
691 | PURPLE_ASSERT_CONNECTION_IS_VALID(gc); |
| 2956 | 692 | |
| 7014 | 693 | if((len = read(js->fd, buf, sizeof(buf) - 1)) > 0) { |
|
32679
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
694 | purple_connection_update_last_received(gc); |
| 12508 | 695 | #ifdef HAVE_CYRUS_SASL |
|
30155
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
696 | if (js->sasl_maxbuf > 0) { |
| 12508 | 697 | const char *out; |
|
14697
518c0fae208e
[gaim-migrate @ 17381]
Daniel Atallah <datallah@pidgin.im>
parents:
14668
diff
changeset
|
698 | unsigned int olen; |
|
30155
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
699 | int rc; |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
700 | |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
701 | rc = sasl_decode(js->sasl, buf, len, &out, &olen); |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
702 | if (rc != SASL_OK) { |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
703 | gchar *error = |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
704 | g_strdup_printf(_("SASL error: %s"), |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
705 | sasl_errdetail(js->sasl)); |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
706 | purple_debug_error("jabber", |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
707 | "sasl_decode_error %d: %s\n", rc, |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
708 | sasl_errdetail(js->sasl)); |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31997
diff
changeset
|
709 | purple_connection_error(gc, |
|
30155
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
710 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
711 | error); |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
712 | } else if (olen > 0) { |
|
28828
7c1855f037e7
jabber: Convert to purple_debug_* convenience functions.
Paul Aurich <darkrain42@pidgin.im>
parents:
28827
diff
changeset
|
713 | purple_debug_info("jabber", "RecvSASL (%u): %s\n", olen, out); |
|
30155
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
714 | jabber_parser_process(js, out, olen); |
|
8e22b8cc78ee
jabber: A bunch of paranoia-induced Cyrus SASL changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
30153
diff
changeset
|
715 | if (js->reinit) |
| 14700 | 716 | jabber_stream_init(js); |
| 12508 | 717 | } |
| 718 | return; | |
| 719 | } | |
| 720 | #endif | |
| 7014 | 721 | buf[len] = '\0'; |
|
34297
0f1f0b8c84f8
Fix some debug log warnings, adjust verbosity level
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34269
diff
changeset
|
722 | purple_debug_misc("jabber", "Recv (%d): %s", len, buf); |
| 7014 | 723 | jabber_parser_process(js, buf, len); |
| 14700 | 724 | if(js->reinit) |
| 725 | jabber_stream_init(js); | |
|
23539
19dd5b0bbe76
Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <markdoliner@pidgin.im>
parents:
23532
diff
changeset
|
726 | } else if(len < 0 && errno == EAGAIN) { |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
727 | return; |
| 7177 | 728 | } else { |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27605
diff
changeset
|
729 | gchar *tmp; |
|
23539
19dd5b0bbe76
Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <markdoliner@pidgin.im>
parents:
23532
diff
changeset
|
730 | if (len == 0) |
| 33740 | 731 | tmp = g_strdup(_("Server closed the connection")); |
|
23539
19dd5b0bbe76
Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <markdoliner@pidgin.im>
parents:
23532
diff
changeset
|
732 | else |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27605
diff
changeset
|
733 | tmp = g_strdup_printf(_("Lost connection with server: %s"), |
|
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27605
diff
changeset
|
734 | g_strerror(errno)); |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31997
diff
changeset
|
735 | purple_connection_error(js->gc, |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27605
diff
changeset
|
736 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
|
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27605
diff
changeset
|
737 | g_free(tmp); |
| 7014 | 738 | } |
| 2086 | 739 | } |
| 740 | ||
| 7014 | 741 | static void |
| 15884 | 742 | jabber_login_callback_ssl(gpointer data, PurpleSslConnection *gsc, |
| 743 | PurpleInputCondition cond) | |
| 6764 | 744 | { |
| 15884 | 745 | PurpleConnection *gc = data; |
|
15023
c38f385a128a
[gaim-migrate @ 17740]
Evan Schoenberg <evands@pidgin.im>
parents:
14899
diff
changeset
|
746 | JabberStream *js; |
|
c38f385a128a
[gaim-migrate @ 17740]
Evan Schoenberg <evands@pidgin.im>
parents:
14899
diff
changeset
|
747 | |
|
36068
e9b9320a985a
Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36055
diff
changeset
|
748 | PURPLE_ASSERT_CONNECTION_IS_VALID(gc); |
|
15023
c38f385a128a
[gaim-migrate @ 17740]
Evan Schoenberg <evands@pidgin.im>
parents:
14899
diff
changeset
|
749 | |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
750 | js = purple_connection_get_protocol_data(gc); |
| 6764 | 751 | |
| 7014 | 752 | if(js->state == JABBER_STREAM_CONNECTING) |
| 7642 | 753 | jabber_send_raw(js, "<?xml version='1.0' ?>", -1); |
| 7014 | 754 | jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING); |
| 15884 | 755 | purple_ssl_input_add(gsc, jabber_recv_cb_ssl, gc); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
756 | |
|
17813
c5cc8ebf62c0
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 <am@adiumx.com>
parents:
17810
diff
changeset
|
757 | /* Tell the app that we're doing encryption */ |
|
c5cc8ebf62c0
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 <am@adiumx.com>
parents:
17810
diff
changeset
|
758 | jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING_ENCRYPTION); |
| 6764 | 759 | } |
| 760 | ||
|
27155
53502d71efdd
Remove trailing whitespace that has snuck in.
Paul Aurich <darkrain42@pidgin.im>
parents:
27143
diff
changeset
|
761 | static void |
|
37457
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
762 | txt_resolved_cb(GObject *sender, GAsyncResult *result, gpointer data) |
|
23607
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23604
diff
changeset
|
763 | { |
|
37457
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
764 | GError *error = NULL; |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
765 | GList *records = NULL, *l = NULL; |
|
24872
68de61b562f6
Jabber BOSH: Many fixes
Paul Aurich <darkrain42@pidgin.im>
parents:
24871
diff
changeset
|
766 | JabberStream *js = data; |
|
30845
ded677aa7cf6
jabber: Handle a corner case better by throwing an error instead of stalling
Paul Aurich <darkrain42@pidgin.im>
parents:
30838
diff
changeset
|
767 | gboolean found = FALSE; |
|
26766
854a2eaa3862
Hide PurpleTxtResponse and use a more purple API
Paul Aurich <darkrain42@pidgin.im>
parents:
26765
diff
changeset
|
768 | |
|
37517
a67be31f9c7e
Use the GResolver which was passed to g_resolver_lookup_*_async()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37516
diff
changeset
|
769 | records = g_resolver_lookup_records_finish(G_RESOLVER(sender), |
|
a67be31f9c7e
Use the GResolver which was passed to g_resolver_lookup_*_async()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37516
diff
changeset
|
770 | result, &error); |
|
37457
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
771 | if(error) { |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
772 | purple_debug_warning("jabber", "Unable to find alternative XMPP connection " |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
773 | "methods after failing to connect directly. : %s\n", |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
774 | error->message); |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
775 | |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
776 | purple_connection_error(js->gc, |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
777 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
778 | _("Unable to connect")); |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
779 | |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
780 | g_error_free(error); |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
781 | |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
782 | return; |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
783 | } |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
784 | |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
785 | for(l = records; l; l = l->next) { |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
786 | GVariantIter *iter = NULL; |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
787 | gchar *str = NULL; |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
788 | |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
789 | g_variant_get((GVariant *)l->data, "(as)", &iter); |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
790 | while(g_variant_iter_loop(iter, "s", &str)) { |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
791 | gchar **token = g_strsplit(str, "=", 2); |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
792 | |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
793 | if(!g_ascii_strcasecmp(token[0], "_xmpp-client-xbosh")) { |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
794 | purple_debug_info("jabber","Found alternative connection method using %s at %s.\n", token[0], token[1]); |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
795 | |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
796 | js->bosh = jabber_bosh_connection_new(js, token[1]); |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
797 | |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
798 | g_strfreev(token); |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
799 | |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
800 | break; |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
801 | } |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
802 | |
|
23608
42569940482d
* small bugfix in jabber_ipc_add_feature()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23607
diff
changeset
|
803 | g_strfreev(token); |
|
42569940482d
* small bugfix in jabber_ipc_add_feature()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23607
diff
changeset
|
804 | } |
|
37457
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
805 | |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
806 | g_variant_iter_free(iter); |
|
23607
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23604
diff
changeset
|
807 | } |
|
26766
854a2eaa3862
Hide PurpleTxtResponse and use a more purple API
Paul Aurich <darkrain42@pidgin.im>
parents:
26765
diff
changeset
|
808 | |
|
37457
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
809 | g_list_free_full(records, (GDestroyNotify)g_variant_unref); |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
810 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34238
diff
changeset
|
811 | if (js->bosh) |
|
30845
ded677aa7cf6
jabber: Handle a corner case better by throwing an error instead of stalling
Paul Aurich <darkrain42@pidgin.im>
parents:
30838
diff
changeset
|
812 | found = TRUE; |
|
ded677aa7cf6
jabber: Handle a corner case better by throwing an error instead of stalling
Paul Aurich <darkrain42@pidgin.im>
parents:
30838
diff
changeset
|
813 | |
|
ded677aa7cf6
jabber: Handle a corner case better by throwing an error instead of stalling
Paul Aurich <darkrain42@pidgin.im>
parents:
30838
diff
changeset
|
814 | if (!found) { |
|
ded677aa7cf6
jabber: Handle a corner case better by throwing an error instead of stalling
Paul Aurich <darkrain42@pidgin.im>
parents:
30838
diff
changeset
|
815 | purple_debug_warning("jabber", "Unable to find alternative XMPP connection " |
|
ded677aa7cf6
jabber: Handle a corner case better by throwing an error instead of stalling
Paul Aurich <darkrain42@pidgin.im>
parents:
30838
diff
changeset
|
816 | "methods after failing to connect directly.\n"); |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31997
diff
changeset
|
817 | purple_connection_error(js->gc, |
|
30845
ded677aa7cf6
jabber: Handle a corner case better by throwing an error instead of stalling
Paul Aurich <darkrain42@pidgin.im>
parents:
30838
diff
changeset
|
818 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
ded677aa7cf6
jabber: Handle a corner case better by throwing an error instead of stalling
Paul Aurich <darkrain42@pidgin.im>
parents:
30838
diff
changeset
|
819 | _("Unable to connect")); |
|
ded677aa7cf6
jabber: Handle a corner case better by throwing an error instead of stalling
Paul Aurich <darkrain42@pidgin.im>
parents:
30838
diff
changeset
|
820 | return; |
|
23611
d811757e19b5
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23608
diff
changeset
|
821 | } |
|
23607
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23604
diff
changeset
|
822 | } |
| 7014 | 823 | |
| 824 | static void | |
|
14175
2bc5a80c5071
[gaim-migrate @ 16747]
Mark Doliner <markdoliner@pidgin.im>
parents:
14170
diff
changeset
|
825 | jabber_login_callback(gpointer data, gint source, const gchar *error) |
| 6764 | 826 | { |
| 15884 | 827 | PurpleConnection *gc = data; |
|
29222
022a4164460c
jabber: Pedantically this bothered me, but changing the message to
Paul Aurich <darkrain42@pidgin.im>
parents:
29221
diff
changeset
|
828 | JabberStream *js = purple_connection_get_protocol_data(gc); |
| 2086 | 829 | |
|
8783
7be6da5bc279
[gaim-migrate @ 9545]
Mark Doliner <markdoliner@pidgin.im>
parents:
8778
diff
changeset
|
830 | if (source < 0) { |
|
37518
53c9ebedf2b7
Plug g_resolver_get_default() leaks
Mike Ruprecht <cmaiku@gmail.com>
parents:
37517
diff
changeset
|
831 | GResolver *resolver = g_resolver_get_default(); |
|
37457
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
832 | gchar *name = g_strdup_printf("_xmppconnect.%s", js->user->domain); |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
833 | |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
834 | purple_debug_info("jabber", "Couldn't connect directly to %s. Trying to find alternative connection methods, like BOSH.\n", js->user->domain); |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
835 | |
|
37518
53c9ebedf2b7
Plug g_resolver_get_default() leaks
Mike Ruprecht <cmaiku@gmail.com>
parents:
37517
diff
changeset
|
836 | g_resolver_lookup_records_async(resolver, |
|
37457
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
837 | name, |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
838 | G_RESOLVER_RECORD_TXT, |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
839 | js->cancellable, |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
840 | txt_resolved_cb, |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
841 | js); |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
842 | g_free(name); |
|
37518
53c9ebedf2b7
Plug g_resolver_get_default() leaks
Mike Ruprecht <cmaiku@gmail.com>
parents:
37517
diff
changeset
|
843 | g_object_unref(resolver); |
|
37457
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
844 | |
|
8783
7be6da5bc279
[gaim-migrate @ 9545]
Mark Doliner <markdoliner@pidgin.im>
parents:
8778
diff
changeset
|
845 | return; |
|
7be6da5bc279
[gaim-migrate @ 9545]
Mark Doliner <markdoliner@pidgin.im>
parents:
8778
diff
changeset
|
846 | } |
|
7be6da5bc279
[gaim-migrate @ 9545]
Mark Doliner <markdoliner@pidgin.im>
parents:
8778
diff
changeset
|
847 | |
| 7014 | 848 | js->fd = source; |
| 2956 | 849 | |
| 7014 | 850 | if(js->state == JABBER_STREAM_CONNECTING) |
| 7642 | 851 | jabber_send_raw(js, "<?xml version='1.0' ?>", -1); |
|
2300
06a3c10f4918
[gaim-migrate @ 2310]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2289
diff
changeset
|
852 | |
| 7014 | 853 | jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING); |
|
32684
edefbf316da1
Jabber: Move the "inpa" input watcher into protocol_data.
Andrew Victor <andrew.victor@mxit.com>
parents:
32679
diff
changeset
|
854 | js->inpa = purple_input_add(js->fd, PURPLE_INPUT_READ, jabber_recv_cb, gc); |
| 7014 | 855 | } |
| 2086 | 856 | |
| 7014 | 857 | static void |
| 15884 | 858 | jabber_ssl_connect_failure(PurpleSslConnection *gsc, PurpleSslErrorType error, |
| 7426 | 859 | gpointer data) |
| 860 | { | |
| 15884 | 861 | PurpleConnection *gc = data; |
|
15668
c8831ae23d4c
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 <evands@pidgin.im>
parents:
15558
diff
changeset
|
862 | JabberStream *js; |
| 7426 | 863 | |
|
36068
e9b9320a985a
Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36055
diff
changeset
|
864 | PURPLE_ASSERT_CONNECTION_IS_VALID(gc); |
|
15668
c8831ae23d4c
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 <evands@pidgin.im>
parents:
15558
diff
changeset
|
865 | |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
866 | js = purple_connection_get_protocol_data(gc); |
|
14312
6ce4512aa9a8
[gaim-migrate @ 16932]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
867 | js->gsc = NULL; |
|
6ce4512aa9a8
[gaim-migrate @ 16932]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
868 | |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
869 | purple_connection_ssl_error (gc, error); |
| 7426 | 870 | } |
| 871 | ||
| 7427 | 872 | static void tls_init(JabberStream *js) |
| 873 | { | |
|
32684
edefbf316da1
Jabber: Move the "inpa" input watcher into protocol_data.
Andrew Victor <andrew.victor@mxit.com>
parents:
32679
diff
changeset
|
874 | purple_input_remove(js->inpa); |
|
edefbf316da1
Jabber: Move the "inpa" input watcher into protocol_data.
Andrew Victor <andrew.victor@mxit.com>
parents:
32679
diff
changeset
|
875 | js->inpa = 0; |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32624
diff
changeset
|
876 | js->gsc = purple_ssl_connect_with_host_fd(purple_connection_get_account(js->gc), js->fd, |
|
22155
7c2034388bdb
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 <am@adiumx.com>
parents:
22133
diff
changeset
|
877 | jabber_login_callback_ssl, jabber_ssl_connect_failure, js->certificate_CN, js->gc); |
|
27918
b32f476d9e35
Clear out the fd when we pass it off to the SSL subsystem
Paul Aurich <darkrain42@pidgin.im>
parents:
27898
diff
changeset
|
878 | /* The fd is no longer our concern */ |
|
b32f476d9e35
Clear out the fd when we pass it off to the SSL subsystem
Paul Aurich <darkrain42@pidgin.im>
parents:
27898
diff
changeset
|
879 | js->fd = -1; |
| 7427 | 880 | } |
| 881 | ||
|
23910
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
882 | static gboolean jabber_login_connect(JabberStream *js, const char *domain, const char *host, int port, |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
883 | gboolean fatal_failure) |
| 11387 | 884 | { |
|
22468
c0f99a22627f
Use connect server as FQDN for SASL auth except when it is an IP address.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22277
diff
changeset
|
885 | /* host should be used in preference to domain to |
|
c0f99a22627f
Use connect server as FQDN for SASL auth except when it is an IP address.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22277
diff
changeset
|
886 | * allow SASL authentication to work with FQDN of the server, |
|
c0f99a22627f
Use connect server as FQDN for SASL auth except when it is an IP address.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22277
diff
changeset
|
887 | * but we use domain as fallback for when users enter IP address |
|
c0f99a22627f
Use connect server as FQDN for SASL auth except when it is an IP address.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22277
diff
changeset
|
888 | * in connect server */ |
|
23910
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
889 | g_free(js->serverFQDN); |
|
22468
c0f99a22627f
Use connect server as FQDN for SASL auth except when it is an IP address.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22277
diff
changeset
|
890 | if (purple_ip_address_is_valid(host)) |
|
c0f99a22627f
Use connect server as FQDN for SASL auth except when it is an IP address.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22277
diff
changeset
|
891 | js->serverFQDN = g_strdup(domain); |
|
c0f99a22627f
Use connect server as FQDN for SASL auth except when it is an IP address.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22277
diff
changeset
|
892 | else |
|
c0f99a22627f
Use connect server as FQDN for SASL auth except when it is an IP address.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22277
diff
changeset
|
893 | js->serverFQDN = g_strdup(host); |
|
15800
2d0ec4fe2681
pass the correct domain to cyrus sasl (sf patch 1663064)
Nathan Walp <nwalp@pidgin.im>
parents:
15783
diff
changeset
|
894 | |
|
27872
80d354ef1295
To make grim happy (or more upset).
Paul Aurich <darkrain42@pidgin.im>
parents:
27863
diff
changeset
|
895 | if (purple_proxy_connect(js->gc, purple_connection_get_account(js->gc), |
|
80d354ef1295
To make grim happy (or more upset).
Paul Aurich <darkrain42@pidgin.im>
parents:
27863
diff
changeset
|
896 | host, port, jabber_login_callback, js->gc) == NULL) { |
|
23910
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
897 | if (fatal_failure) { |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31997
diff
changeset
|
898 | purple_connection_error(js->gc, |
|
23910
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
899 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27605
diff
changeset
|
900 | _("Unable to connect")); |
|
23910
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
901 | } |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
902 | |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
903 | return FALSE; |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
904 | } |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
905 | |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
906 | return TRUE; |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
907 | } |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
908 | |
|
37457
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
909 | static void |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
910 | srv_resolved_cb(GObject *sender, GAsyncResult *result, gpointer data) |
|
23910
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
911 | { |
|
37457
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
912 | GError *error = NULL; |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
913 | GList *targets = NULL, *l = NULL; |
|
23910
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
914 | JabberStream *js = data; |
|
37457
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
915 | |
|
37517
a67be31f9c7e
Use the GResolver which was passed to g_resolver_lookup_*_async()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37516
diff
changeset
|
916 | targets = g_resolver_lookup_service_finish(G_RESOLVER(sender), |
|
a67be31f9c7e
Use the GResolver which was passed to g_resolver_lookup_*_async()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37516
diff
changeset
|
917 | result, &error); |
|
37457
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
918 | if(error) { |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
919 | purple_debug_warning("jabber", |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
920 | "SRV lookup failed, proceeding with normal connection : %s", |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
921 | error->message); |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
922 | |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
923 | g_error_free(error); |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
924 | |
| 17052 | 925 | jabber_login_connect(js, js->user->domain, js->user->domain, |
|
27872
80d354ef1295
To make grim happy (or more upset).
Paul Aurich <darkrain42@pidgin.im>
parents:
27863
diff
changeset
|
926 | purple_account_get_int(purple_connection_get_account(js->gc), "port", 5222), |
|
27898
4a6450d92e11
Move the IDN support into the DNS routines.
Paul Aurich <darkrain42@pidgin.im>
parents:
27872
diff
changeset
|
927 | TRUE); |
|
37457
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
928 | |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
929 | } else { |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
930 | for(l = targets; l; l = l->next) { |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
931 | GSrvTarget *target = (GSrvTarget *)l->data; |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
932 | const gchar *hostname = g_srv_target_get_hostname(target); |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
933 | guint port = g_srv_target_get_port(target); |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
934 | |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
935 | if(jabber_login_connect(js, hostname, hostname, port, FALSE)) { |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
936 | g_resolver_free_targets(targets); |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
937 | |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
938 | return; |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
939 | } |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
940 | } |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
941 | |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
942 | g_resolver_free_targets(targets); |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
943 | |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
944 | jabber_login_connect(js, js->user->domain, js->user->domain, |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
945 | purple_account_get_int(purple_connection_get_account(js->gc), "port", 5222), |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
946 | TRUE); |
| 11387 | 947 | } |
| 948 | } | |
| 949 | ||
|
27850
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
950 | static JabberStream * |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
951 | jabber_stream_new(PurpleAccount *account) |
| 2086 | 952 | { |
| 15884 | 953 | PurpleConnection *gc = purple_account_get_connection(account); |
| 7014 | 954 | JabberStream *js; |
|
25532
10e7f850b235
Patch from Paul Aurich to fix reporting idle when reconnecting only when we're
Marcus Lundblad <malu@pidgin.im>
parents:
25531
diff
changeset
|
955 | PurplePresence *presence; |
|
31487
6159afdf4553
disapproval of revision 'a47ab1a2fcf24f136b572c4ede8024299e18aff0'
Mark Doliner <markdoliner@pidgin.im>
parents:
31486
diff
changeset
|
956 | gchar *user; |
|
27860
2b75b87699c8
Support connecting to IDNA XMPP domains.
Paul Aurich <darkrain42@pidgin.im>
parents:
27850
diff
changeset
|
957 | gchar *slash; |
|
27850
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
958 | |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
959 | js = g_new0(JabberStream, 1); |
|
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
960 | purple_connection_set_protocol_data(gc, js); |
| 7014 | 961 | js->gc = gc; |
|
8013
03f5b77cdaf0
[gaim-migrate @ 8693]
Olivier Blin <blino@users.sourceforge.net>
parents:
8011
diff
changeset
|
962 | js->fd = -1; |
|
34269
26b4c9a54166
HTTP: Use PurpleHttpConnectionSet instead of GSLists of PurpleHttpConnection structs
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34268
diff
changeset
|
963 | js->http_conns = purple_http_connection_set_new(); |
|
36013
a351cbf422ed
Backport 68d162284480: facebook roster quirks
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35997
diff
changeset
|
964 | |
|
37457
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
965 | /* we might want to expose this at some point */ |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
966 | js->cancellable = g_cancellable_new(); |
|
27860
2b75b87699c8
Support connecting to IDNA XMPP domains.
Paul Aurich <darkrain42@pidgin.im>
parents:
27850
diff
changeset
|
967 | |
|
31487
6159afdf4553
disapproval of revision 'a47ab1a2fcf24f136b572c4ede8024299e18aff0'
Mark Doliner <markdoliner@pidgin.im>
parents:
31486
diff
changeset
|
968 | user = g_strdup(purple_account_get_username(account)); |
|
27860
2b75b87699c8
Support connecting to IDNA XMPP domains.
Paul Aurich <darkrain42@pidgin.im>
parents:
27850
diff
changeset
|
969 | /* jabber_id_new doesn't accept "user@domain/" as valid */ |
|
31487
6159afdf4553
disapproval of revision 'a47ab1a2fcf24f136b572c4ede8024299e18aff0'
Mark Doliner <markdoliner@pidgin.im>
parents:
31486
diff
changeset
|
970 | slash = strchr(user, '/'); |
|
27860
2b75b87699c8
Support connecting to IDNA XMPP domains.
Paul Aurich <darkrain42@pidgin.im>
parents:
27850
diff
changeset
|
971 | if (slash && *(slash + 1) == '\0') |
|
2b75b87699c8
Support connecting to IDNA XMPP domains.
Paul Aurich <darkrain42@pidgin.im>
parents:
27850
diff
changeset
|
972 | *slash = '\0'; |
|
31487
6159afdf4553
disapproval of revision 'a47ab1a2fcf24f136b572c4ede8024299e18aff0'
Mark Doliner <markdoliner@pidgin.im>
parents:
31486
diff
changeset
|
973 | js->user = jabber_id_new(user); |
|
27850
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
974 | |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
975 | if (!js->user) { |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31997
diff
changeset
|
976 | purple_connection_error(gc, |
|
27850
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
977 | PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
978 | _("Invalid XMPP ID")); |
|
31487
6159afdf4553
disapproval of revision 'a47ab1a2fcf24f136b572c4ede8024299e18aff0'
Mark Doliner <markdoliner@pidgin.im>
parents:
31486
diff
changeset
|
979 | g_free(user); |
|
27850
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
980 | /* Destroying the connection will free the JabberStream */ |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
981 | return NULL; |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
982 | } |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
983 | |
|
29979
f7f4478c8d19
jabber: Check at connection time that the user specified a JID with a node.
Paul Aurich <darkrain42@pidgin.im>
parents:
29910
diff
changeset
|
984 | if (!js->user->node || *(js->user->node) == '\0') { |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31997
diff
changeset
|
985 | purple_connection_error(gc, |
|
29979
f7f4478c8d19
jabber: Check at connection time that the user specified a JID with a node.
Paul Aurich <darkrain42@pidgin.im>
parents:
29910
diff
changeset
|
986 | PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, |
|
f7f4478c8d19
jabber: Check at connection time that the user specified a JID with a node.
Paul Aurich <darkrain42@pidgin.im>
parents:
29910
diff
changeset
|
987 | _("Invalid XMPP ID. Username portion must be set.")); |
|
31487
6159afdf4553
disapproval of revision 'a47ab1a2fcf24f136b572c4ede8024299e18aff0'
Mark Doliner <markdoliner@pidgin.im>
parents:
31486
diff
changeset
|
988 | g_free(user); |
|
27850
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
989 | /* Destroying the connection will free the JabberStream */ |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
990 | return NULL; |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
991 | } |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
992 | |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
993 | if (!js->user->domain || *(js->user->domain) == '\0') { |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31997
diff
changeset
|
994 | purple_connection_error(gc, |
|
27850
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
995 | PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
996 | _("Invalid XMPP ID. Domain must be set.")); |
|
31487
6159afdf4553
disapproval of revision 'a47ab1a2fcf24f136b572c4ede8024299e18aff0'
Mark Doliner <markdoliner@pidgin.im>
parents:
31486
diff
changeset
|
997 | g_free(user); |
|
27850
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
998 | /* Destroying the connection will free the JabberStream */ |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
999 | return NULL; |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1000 | } |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1001 | |
| 7014 | 1002 | js->buddies = g_hash_table_new_full(g_str_hash, g_str_equal, |
| 7116 | 1003 | g_free, (GDestroyNotify)jabber_buddy_free); |
|
27850
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1004 | |
|
30838
4742e16d437b
jabber: Set a connection display name even when using legacy auth
Paul Aurich <darkrain42@pidgin.im>
parents:
30821
diff
changeset
|
1005 | /* This is overridden during binding, but we need it here |
|
4742e16d437b
jabber: Set a connection display name even when using legacy auth
Paul Aurich <darkrain42@pidgin.im>
parents:
30821
diff
changeset
|
1006 | * in case the server only does legacy non-sasl auth!. |
|
4742e16d437b
jabber: Set a connection display name even when using legacy auth
Paul Aurich <darkrain42@pidgin.im>
parents:
30821
diff
changeset
|
1007 | */ |
|
31487
6159afdf4553
disapproval of revision 'a47ab1a2fcf24f136b572c4ede8024299e18aff0'
Mark Doliner <markdoliner@pidgin.im>
parents:
31486
diff
changeset
|
1008 | purple_connection_set_display_name(gc, user); |
|
6159afdf4553
disapproval of revision 'a47ab1a2fcf24f136b572c4ede8024299e18aff0'
Mark Doliner <markdoliner@pidgin.im>
parents:
31486
diff
changeset
|
1009 | |
|
6159afdf4553
disapproval of revision 'a47ab1a2fcf24f136b572c4ede8024299e18aff0'
Mark Doliner <markdoliner@pidgin.im>
parents:
31486
diff
changeset
|
1010 | js->user_jb = jabber_buddy_find(js, user, TRUE); |
|
6159afdf4553
disapproval of revision 'a47ab1a2fcf24f136b572c4ede8024299e18aff0'
Mark Doliner <markdoliner@pidgin.im>
parents:
31486
diff
changeset
|
1011 | g_free(user); |
|
28071
a0706162fefd
jabber: Store the "own JabberBuddy" in the JabberStream* struct.
Paul Aurich <darkrain42@pidgin.im>
parents:
28070
diff
changeset
|
1012 | if (!js->user_jb) { |
|
27850
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1013 | /* This basically *can't* fail, but for good measure... */ |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31997
diff
changeset
|
1014 | purple_connection_error(gc, |
|
27850
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1015 | PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1016 | _("Invalid XMPP ID")); |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1017 | /* Destroying the connection will free the JabberStream */ |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1018 | g_return_val_if_reached(NULL); |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1019 | } |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1020 | |
|
28071
a0706162fefd
jabber: Store the "own JabberBuddy" in the JabberStream* struct.
Paul Aurich <darkrain42@pidgin.im>
parents:
28070
diff
changeset
|
1021 | js->user_jb->subscription |= JABBER_SUB_BOTH; |
|
27850
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1022 | |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1023 | js->iq_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, |
|
35235
93d4bff19574
Prevent spoofing of iq replies by verifying that the 'from' address
Mark Doliner <mark@kingant.net>
parents:
33790
diff
changeset
|
1024 | g_free, (GDestroyNotify)jabber_iq_callbackdata_free); |
| 7014 | 1025 | js->chats = g_hash_table_new_full(g_str_hash, g_str_equal, |
| 8396 | 1026 | g_free, (GDestroyNotify)jabber_chat_free); |
| 7322 | 1027 | js->next_id = g_random_int(); |
|
34529
68cf25486001
GObjectify PurpleCircBuffer as PurpleCircularBuffer (from gobjectification branch)
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
1028 | js->write_buffer = purple_circular_buffer_new(512); |
|
22111
7b7ed5e93969
Fixes for incorrectly displaying user tune emblem and empty current media.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22101
diff
changeset
|
1029 | js->old_length = 0; |
|
27304
b2dc447b8c0b
The XMPP keepalive timeout handle needs to be a guint.
Paul Aurich <darkrain42@pidgin.im>
parents:
27293
diff
changeset
|
1030 | js->keepalive_timeout = 0; |
|
30056
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
1031 | js->max_inactivity = DEFAULT_INACTIVITY_TIME; |
|
26080
bfe333bf2ae8
Jabber: Default protocol version to 1.0.
Paul Aurich <darkrain42@pidgin.im>
parents:
26074
diff
changeset
|
1032 | /* Set the default protocol version to 1.0. Overridden in parser.c. */ |
|
29849
d7b910200dc5
jabber: Treat the version properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29848
diff
changeset
|
1033 | js->protocol_version.major = 1; |
|
d7b910200dc5
jabber: Treat the version properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29848
diff
changeset
|
1034 | js->protocol_version.minor = 0; |
|
23698
0815965bd80b
Moved jingle.c global variable "sessions" into JabberStream.
Michael Ruprecht <maiku@pidgin.im>
parents:
23697
diff
changeset
|
1035 | js->sessions = NULL; |
|
26286
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26269
diff
changeset
|
1036 | js->stun_ip = NULL; |
|
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26269
diff
changeset
|
1037 | js->stun_port = 0; |
|
28445
c3dbe0b64f44
Some unfinished code to take advantage of Google's relays
Marcus Lundblad <malu@pidgin.im>
parents:
28379
diff
changeset
|
1038 | js->google_relay_token = NULL; |
|
c3dbe0b64f44
Some unfinished code to take advantage of Google's relays
Marcus Lundblad <malu@pidgin.im>
parents:
28379
diff
changeset
|
1039 | js->google_relay_host = NULL; |
| 5613 | 1040 | |
|
25531
b348ceba3289
Set idle time on JabberStream when logging in
Marcus Lundblad <malu@pidgin.im>
parents:
25497
diff
changeset
|
1041 | /* if we are idle, set idle-ness on the stream (this could happen if we get |
|
b348ceba3289
Set idle time on JabberStream when logging in
Marcus Lundblad <malu@pidgin.im>
parents:
25497
diff
changeset
|
1042 | disconnected and the reconnects while being idle. I don't think it makes |
|
b348ceba3289
Set idle time on JabberStream when logging in
Marcus Lundblad <malu@pidgin.im>
parents:
25497
diff
changeset
|
1043 | sense to do this when registering a new account... */ |
|
25532
10e7f850b235
Patch from Paul Aurich to fix reporting idle when reconnecting only when we're
Marcus Lundblad <malu@pidgin.im>
parents:
25531
diff
changeset
|
1044 | presence = purple_account_get_presence(account); |
|
10e7f850b235
Patch from Paul Aurich to fix reporting idle when reconnecting only when we're
Marcus Lundblad <malu@pidgin.im>
parents:
25531
diff
changeset
|
1045 | if (purple_presence_is_idle(presence)) |
|
10e7f850b235
Patch from Paul Aurich to fix reporting idle when reconnecting only when we're
Marcus Lundblad <malu@pidgin.im>
parents:
25531
diff
changeset
|
1046 | js->idle = purple_presence_get_idle_time(presence); |
| 5613 | 1047 | |
|
27850
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1048 | return js; |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1049 | } |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1050 | |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1051 | static void |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1052 | jabber_stream_connect(JabberStream *js) |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1053 | { |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1054 | PurpleConnection *gc = js->gc; |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1055 | PurpleAccount *account = purple_connection_get_account(gc); |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1056 | const char *connect_server = purple_account_get_string(account, |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1057 | "connect_server", ""); |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1058 | const char *bosh_url = purple_account_get_string(account, |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1059 | "bosh_url", ""); |
| 10289 | 1060 | |
| 7014 | 1061 | jabber_stream_set_state(js, JABBER_STREAM_CONNECTING); |
| 2956 | 1062 | |
|
27397
690965a5ff24
Make "BOSH URL" its own account option.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
1063 | /* If both BOSH and a Connect Server are specified, we prefer BOSH. I'm not |
|
690965a5ff24
Make "BOSH URL" its own account option.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
1064 | * attached to that choice, though. |
|
690965a5ff24
Make "BOSH URL" its own account option.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
1065 | */ |
|
690965a5ff24
Make "BOSH URL" its own account option.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
1066 | if (*bosh_url) { |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34238
diff
changeset
|
1067 | js->bosh = jabber_bosh_connection_new(js, bosh_url); |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34238
diff
changeset
|
1068 | if (!js->bosh) { |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31997
diff
changeset
|
1069 | purple_connection_error(gc, |
|
25803
04c2dbd49ac2
Allow the user to specify their own BOSH url in the Connect Server option
Paul Aurich <darkrain42@pidgin.im>
parents:
25802
diff
changeset
|
1070 | PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, |
|
27397
690965a5ff24
Make "BOSH URL" its own account option.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
1071 | _("Malformed BOSH URL")); |
|
25803
04c2dbd49ac2
Allow the user to specify their own BOSH url in the Connect Server option
Paul Aurich <darkrain42@pidgin.im>
parents:
25802
diff
changeset
|
1072 | } |
|
27397
690965a5ff24
Make "BOSH URL" its own account option.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
1073 | |
|
24870
98e6bafdf33f
Add option for forcing BOSH (useful for debugging)
Paul Aurich <darkrain42@pidgin.im>
parents:
24868
diff
changeset
|
1074 | return; |
|
98e6bafdf33f
Add option for forcing BOSH (useful for debugging)
Paul Aurich <darkrain42@pidgin.im>
parents:
24868
diff
changeset
|
1075 | } |
|
98e6bafdf33f
Add option for forcing BOSH (useful for debugging)
Paul Aurich <darkrain42@pidgin.im>
parents:
24868
diff
changeset
|
1076 | |
|
27397
690965a5ff24
Make "BOSH URL" its own account option.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
1077 | js->certificate_CN = g_strdup(connect_server[0] ? connect_server : js->user->domain); |
|
690965a5ff24
Make "BOSH URL" its own account option.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
1078 | |
| 11387 | 1079 | /* if they've got old-ssl mode going, we probably want to ignore SRV lookups */ |
|
38256
035f00c4fd87
Replace misused g_str_equal() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38091
diff
changeset
|
1080 | if (purple_strequal("old_ssl", purple_account_get_string(account, "connection_security", JABBER_DEFAULT_REQUIRE_TLS))) { |
|
37417
b29ee022017f
Require SSL/TLS support. ok'd by elb@
Michael McConville <mmcco@mykolab.com>
parents:
37384
diff
changeset
|
1081 | js->gsc = purple_ssl_connect(account, js->certificate_CN, |
|
b29ee022017f
Require SSL/TLS support. ok'd by elb@
Michael McConville <mmcco@mykolab.com>
parents:
37384
diff
changeset
|
1082 | purple_account_get_int(account, "port", 5223), |
|
b29ee022017f
Require SSL/TLS support. ok'd by elb@
Michael McConville <mmcco@mykolab.com>
parents:
37384
diff
changeset
|
1083 | jabber_login_callback_ssl, jabber_ssl_connect_failure, gc); |
|
b29ee022017f
Require SSL/TLS support. ok'd by elb@
Michael McConville <mmcco@mykolab.com>
parents:
37384
diff
changeset
|
1084 | if (!js->gsc) { |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31997
diff
changeset
|
1085 | purple_connection_error(gc, |
| 21279 | 1086 | PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, |
|
37417
b29ee022017f
Require SSL/TLS support. ok'd by elb@
Michael McConville <mmcco@mykolab.com>
parents:
37384
diff
changeset
|
1087 | _("Unable to establish SSL connection")); |
| 7630 | 1088 | } |
|
25804
f18ad58795a2
Don't fallback (under any conditions) from old-style SSL to other connections
Paul Aurich <darkrain42@pidgin.im>
parents:
25803
diff
changeset
|
1089 | |
|
f18ad58795a2
Don't fallback (under any conditions) from old-style SSL to other connections
Paul Aurich <darkrain42@pidgin.im>
parents:
25803
diff
changeset
|
1090 | return; |
| 3311 | 1091 | } |
| 3770 | 1092 | |
| 11387 | 1093 | /* no old-ssl, so if they've specified a connect server, we'll use that, otherwise we'll |
| 1094 | * invoke the magic of SRV lookups, to figure out host and port */ | |
|
26072
e8fce2b2b9fe
propagate from branch 'im.pidgin.pidgin' (head b4bbfacd7f2050d87deeda12ea7bb3adc3608cb7)
Paul Aurich <darkrain42@pidgin.im>
diff
changeset
|
1095 | if(connect_server[0]) { |
|
27898
4a6450d92e11
Move the IDN support into the DNS routines.
Paul Aurich <darkrain42@pidgin.im>
parents:
27872
diff
changeset
|
1096 | jabber_login_connect(js, js->user->domain, connect_server, |
|
4a6450d92e11
Move the IDN support into the DNS routines.
Paul Aurich <darkrain42@pidgin.im>
parents:
27872
diff
changeset
|
1097 | purple_account_get_int(account, "port", 5222), TRUE); |
|
25804
f18ad58795a2
Don't fallback (under any conditions) from old-style SSL to other connections
Paul Aurich <darkrain42@pidgin.im>
parents:
25803
diff
changeset
|
1098 | } else { |
|
37518
53c9ebedf2b7
Plug g_resolver_get_default() leaks
Mike Ruprecht <cmaiku@gmail.com>
parents:
37517
diff
changeset
|
1099 | GResolver *resolver = g_resolver_get_default(); |
|
53c9ebedf2b7
Plug g_resolver_get_default() leaks
Mike Ruprecht <cmaiku@gmail.com>
parents:
37517
diff
changeset
|
1100 | g_resolver_lookup_service_async(resolver, |
|
37457
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
1101 | "xmpp-client", |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
1102 | "tcp", |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
1103 | js->user->domain, |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
1104 | js->cancellable, |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
1105 | srv_resolved_cb, |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
1106 | js); |
|
37518
53c9ebedf2b7
Plug g_resolver_get_default() leaks
Mike Ruprecht <cmaiku@gmail.com>
parents:
37517
diff
changeset
|
1107 | g_object_unref(resolver); |
| 11387 | 1108 | } |
| 1109 | } | |
| 1110 | ||
|
16302
eb633ebf84f2
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@pidgin.im>
parents:
16180
diff
changeset
|
1111 | void |
| 15884 | 1112 | jabber_login(PurpleAccount *account) |
| 2086 | 1113 | { |
| 15884 | 1114 | PurpleConnection *gc = purple_account_get_connection(account); |
| 7014 | 1115 | JabberStream *js; |
|
35823
268a9d3b3fd7
imgstore: unref xmpp
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35570
diff
changeset
|
1116 | PurpleImage *image; |
| 2086 | 1117 | |
|
36055
33978dc8ef6f
Remove redundant OPT_PROTO_IM_IMAGE (use \!PURPLE_CONNECTION_FLAG_NO_IMAGES instead)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36031
diff
changeset
|
1118 | purple_connection_set_flags(gc, PURPLE_CONNECTION_FLAG_HTML | |
|
33978dc8ef6f
Remove redundant OPT_PROTO_IM_IMAGE (use \!PURPLE_CONNECTION_FLAG_NO_IMAGES instead)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36031
diff
changeset
|
1119 | PURPLE_CONNECTION_FLAG_ALLOW_CUSTOM_SMILEY | |
|
33978dc8ef6f
Remove redundant OPT_PROTO_IM_IMAGE (use \!PURPLE_CONNECTION_FLAG_NO_IMAGES instead)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36031
diff
changeset
|
1120 | PURPLE_CONNECTION_FLAG_NO_IMAGES); |
|
27850
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1121 | js = jabber_stream_new(account); |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1122 | if (js == NULL) |
| 7310 | 1123 | return; |
|
27850
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1124 | |
|
38354
28aa86aaba93
Remove default XMPP file transfer proxy and replace existing defaults in user prefs. See ticket #16535. (ok'd by elb, etan, datallah)
Michael McConville <mmcconville@mykolab.com>
parents:
38269
diff
changeset
|
1125 | /* replace old default proxies with the new default: NULL |
|
28aa86aaba93
Remove default XMPP file transfer proxy and replace existing defaults in user prefs. See ticket #16535. (ok'd by elb, etan, datallah)
Michael McConville <mmcconville@mykolab.com>
parents:
38269
diff
changeset
|
1126 | * TODO: these can eventually be removed */ |
|
28aa86aaba93
Remove default XMPP file transfer proxy and replace existing defaults in user prefs. See ticket #16535. (ok'd by elb, etan, datallah)
Michael McConville <mmcconville@mykolab.com>
parents:
38269
diff
changeset
|
1127 | if (purple_strequal("proxy.jabber.org", purple_account_get_string(account, "ft_proxies", "")) |
|
28aa86aaba93
Remove default XMPP file transfer proxy and replace existing defaults in user prefs. See ticket #16535. (ok'd by elb, etan, datallah)
Michael McConville <mmcconville@mykolab.com>
parents:
38269
diff
changeset
|
1128 | || purple_strequal("proxy.eu.jabber.org", purple_account_get_string(account, "ft_proxies", ""))) |
|
28aa86aaba93
Remove default XMPP file transfer proxy and replace existing defaults in user prefs. See ticket #16535. (ok'd by elb, etan, datallah)
Michael McConville <mmcconville@mykolab.com>
parents:
38269
diff
changeset
|
1129 | purple_account_set_string(account, "ft_proxies", NULL); |
|
29370
9ff8f3bdd0f5
jabber: Update the default FT proxy (if it's still set as the previous, broken, default).
Paul Aurich <darkrain42@pidgin.im>
parents:
29345
diff
changeset
|
1130 | |
|
27850
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1131 | /* |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1132 | * Calculate the avatar hash for our current image so we know (when we |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1133 | * fetch our vCard and PEP avatar) if we should send our avatar to the |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1134 | * server. |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1135 | */ |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1136 | image = purple_buddy_icons_find_account_icon(account); |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1137 | if (image != NULL) { |
|
38327
c842a56b9967
jabber: Port to use GChecksum instead of PurpleHash
Mike Ruprecht <cmaiku@gmail.com>
parents:
37939
diff
changeset
|
1138 | js->initial_avatar_hash = g_compute_checksum_for_data( |
|
c842a56b9967
jabber: Port to use GChecksum instead of PurpleHash
Mike Ruprecht <cmaiku@gmail.com>
parents:
37939
diff
changeset
|
1139 | G_CHECKSUM_SHA1, |
|
35823
268a9d3b3fd7
imgstore: unref xmpp
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35570
diff
changeset
|
1140 | purple_image_get_data(image), |
|
38334
cb3f85d86752
Merge/update port to GChecksum changes, resolving conflicts
Mike Ruprecht <cmaiku@gmail.com>
diff
changeset
|
1141 | purple_image_get_data_size(image) |
|
38298
f0a8f63f9312
rename purple_image_get_size to purple_image_get_data_size and deal with the fallout
Gary Kramlich <grim@reaperworld.com>
parents:
37939
diff
changeset
|
1142 | ); |
|
35823
268a9d3b3fd7
imgstore: unref xmpp
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35570
diff
changeset
|
1143 | g_object_unref(image); |
| 7310 | 1144 | } |
|
26286
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26269
diff
changeset
|
1145 | |
|
27850
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1146 | jabber_stream_connect(js); |
| 2086 | 1147 | } |
| 1148 | ||
| 11387 | 1149 | |
| 7072 | 1150 | static gboolean |
| 1151 | conn_close_cb(gpointer data) | |
| 1152 | { | |
| 1153 | JabberStream *js = data; | |
| 15884 | 1154 | PurpleAccount *account = purple_connection_get_account(js->gc); |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10504
diff
changeset
|
1155 | |
|
17810
c8d4297080cb
Fixed a leak: The XML parser was never cleaned up on disconnect.
Andreas Monitzer <am@adiumx.com>
parents:
17806
diff
changeset
|
1156 | jabber_parser_free(js); |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10504
diff
changeset
|
1157 | |
| 15884 | 1158 | purple_account_disconnect(account); |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10504
diff
changeset
|
1159 | |
|
35044
8060985edd4a
Moved conn_close_timeout to JabberStream
Ankit Vani <a@nevitus.org>
parents:
35005
diff
changeset
|
1160 | js->conn_close_timeout = 0; |
|
8060985edd4a
Moved conn_close_timeout to JabberStream
Ankit Vani <a@nevitus.org>
parents:
35005
diff
changeset
|
1161 | |
| 7072 | 1162 | return FALSE; |
| 1163 | } | |
| 1164 | ||
| 1165 | static void | |
| 1166 | jabber_connection_schedule_close(JabberStream *js) | |
| 1167 | { | |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
38358
diff
changeset
|
1168 | js->conn_close_timeout = g_timeout_add(0, conn_close_cb, js); |
| 7072 | 1169 | } |
| 1170 | ||
| 1171 | static void | |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26686
diff
changeset
|
1172 | jabber_registration_result_cb(JabberStream *js, const char *from, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26686
diff
changeset
|
1173 | JabberIqType type, const char *id, |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1174 | PurpleXmlNode *packet, gpointer data) |
| 7072 | 1175 | { |
|
17814
c47c22006b0d
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 <am@adiumx.com>
parents:
17813
diff
changeset
|
1176 | PurpleAccount *account = purple_connection_get_account(js->gc); |
| 7072 | 1177 | char *buf; |
|
17806
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1178 | char *to = data; |
| 7072 | 1179 | |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26686
diff
changeset
|
1180 | if (type == JABBER_IQ_RESULT) { |
|
17814
c47c22006b0d
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 <am@adiumx.com>
parents:
17813
diff
changeset
|
1181 | if(js->registration) { |
|
27525
579b9d64b364
A semi-random collection of English spelling and grammatical changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27397
diff
changeset
|
1182 | buf = g_strdup_printf(_("Registration of %s@%s successful"), |
| 27587 | 1183 | js->user->node, js->user->domain); |
|
32721
3a64afbc2da2
Introduce purple_account_register_completed() to handle the invoking of any
Andrew Victor <andrew.victor@mxit.com>
parents:
32698
diff
changeset
|
1184 | purple_account_register_completed(account, TRUE); |
|
25604
c963986ac373
Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <darkrain42@pidgin.im>
parents:
25600
diff
changeset
|
1185 | } else { |
|
c963986ac373
Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <darkrain42@pidgin.im>
parents:
25600
diff
changeset
|
1186 | g_return_if_fail(to != NULL); |
|
17806
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1187 | buf = g_strdup_printf(_("Registration to %s successful"), |
|
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1188 | to); |
|
25604
c963986ac373
Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <darkrain42@pidgin.im>
parents:
25600
diff
changeset
|
1189 | } |
| 15884 | 1190 | purple_notify_info(NULL, _("Registration Successful"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
1191 | _("Registration Successful"), buf, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
1192 | purple_request_cpar_from_connection(js->gc)); |
| 7072 | 1193 | g_free(buf); |
| 1194 | } else { | |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
1195 | char *msg = jabber_parse_error(js, packet, NULL); |
| 7072 | 1196 | |
| 8401 | 1197 | if(!msg) |
| 1198 | msg = g_strdup(_("Unknown Error")); | |
| 7072 | 1199 | |
| 15884 | 1200 | purple_notify_error(NULL, _("Registration Failed"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
1201 | _("Registration Failed"), msg, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
1202 | purple_request_cpar_from_connection(js->gc)); |
| 8401 | 1203 | g_free(msg); |
|
32721
3a64afbc2da2
Introduce purple_account_register_completed() to handle the invoking of any
Andrew Victor <andrew.victor@mxit.com>
parents:
32698
diff
changeset
|
1204 | purple_account_register_completed(account, FALSE); |
| 7072 | 1205 | } |
|
17806
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1206 | g_free(to); |
|
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1207 | if(js->registration) |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26686
diff
changeset
|
1208 | jabber_connection_schedule_close(js); |
| 7072 | 1209 | } |
| 1210 | ||
| 1211 | static void | |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26686
diff
changeset
|
1212 | jabber_unregistration_result_cb(JabberStream *js, const char *from, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26686
diff
changeset
|
1213 | JabberIqType type, const char *id, |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1214 | PurpleXmlNode *packet, gpointer data) |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1215 | { |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1216 | char *buf; |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1217 | char *to = data; |
|
25604
c963986ac373
Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <darkrain42@pidgin.im>
parents:
25600
diff
changeset
|
1218 | |
|
c963986ac373
Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <darkrain42@pidgin.im>
parents:
25600
diff
changeset
|
1219 | /* This function is never called for unregistering our XMPP account from |
|
c963986ac373
Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <darkrain42@pidgin.im>
parents:
25600
diff
changeset
|
1220 | * the server, so there should always be a 'to' address. */ |
|
c963986ac373
Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <darkrain42@pidgin.im>
parents:
25600
diff
changeset
|
1221 | g_return_if_fail(to != NULL); |
|
c963986ac373
Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <darkrain42@pidgin.im>
parents:
25600
diff
changeset
|
1222 | |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26686
diff
changeset
|
1223 | if (type == JABBER_IQ_RESULT) { |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1224 | buf = g_strdup_printf(_("Registration from %s successfully removed"), |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1225 | to); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1226 | purple_notify_info(NULL, _("Unregistration Successful"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
1227 | _("Unregistration Successful"), buf, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
1228 | purple_request_cpar_from_connection(js->gc)); |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1229 | g_free(buf); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1230 | } else { |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
1231 | char *msg = jabber_parse_error(js, packet, NULL); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
1232 | |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1233 | if(!msg) |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1234 | msg = g_strdup(_("Unknown Error")); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
1235 | |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1236 | purple_notify_error(NULL, _("Unregistration Failed"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
1237 | _("Unregistration Failed"), msg, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
1238 | purple_request_cpar_from_connection(js->gc)); |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1239 | g_free(msg); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1240 | } |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1241 | g_free(to); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1242 | } |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1243 | |
|
17806
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1244 | typedef struct _JabberRegisterCBData { |
|
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1245 | JabberStream *js; |
|
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1246 | char *who; |
|
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1247 | } JabberRegisterCBData; |
|
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1248 | |
| 7072 | 1249 | static void |
|
17806
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1250 | jabber_register_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fields) |
| 7072 | 1251 | { |
| 1252 | GList *groups, *flds; | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1253 | PurpleXmlNode *query, *y; |
| 7072 | 1254 | JabberIq *iq; |
| 7264 | 1255 | char *username; |
| 7072 | 1256 | |
|
17806
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1257 | iq = jabber_iq_new_query(cbdata->js, JABBER_IQ_SET, "jabber:iq:register"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1258 | query = purple_xmlnode_get_child(iq->node, "query"); |
|
25604
c963986ac373
Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <darkrain42@pidgin.im>
parents:
25600
diff
changeset
|
1259 | if (cbdata->who) |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1260 | purple_xmlnode_set_attrib(iq->node, "to", cbdata->who); |
| 7072 | 1261 | |
| 15884 | 1262 | for(groups = purple_request_fields_get_groups(fields); groups; |
| 7072 | 1263 | groups = groups->next) { |
| 15884 | 1264 | for(flds = purple_request_field_group_get_fields(groups->data); |
| 7072 | 1265 | flds; flds = flds->next) { |
| 15884 | 1266 | PurpleRequestField *field = flds->data; |
| 1267 | const char *id = purple_request_field_get_id(field); | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1268 | if(purple_strequal(id,"unregister")) { |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1269 | gboolean value = purple_request_field_bool_get_value(field); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1270 | if(value) { |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1271 | /* unregister from service. this doesn't include any of the fields, so remove them from the stanza by recreating it |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1272 | (there's no "remove child" function for PurpleXmlNode) */ |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1273 | jabber_iq_free(iq); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1274 | iq = jabber_iq_new_query(cbdata->js, JABBER_IQ_SET, "jabber:iq:register"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1275 | query = purple_xmlnode_get_child(iq->node, "query"); |
|
25604
c963986ac373
Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <darkrain42@pidgin.im>
parents:
25600
diff
changeset
|
1276 | if (cbdata->who) |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1277 | purple_xmlnode_set_attrib(iq->node,"to",cbdata->who); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1278 | purple_xmlnode_new_child(query, "remove"); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
1279 | |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1280 | jabber_iq_set_callback(iq, jabber_unregistration_result_cb, cbdata->who); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
1281 | |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1282 | jabber_iq_send(iq); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1283 | g_free(cbdata); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1284 | return; |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1285 | } |
| 7072 | 1286 | } else { |
|
28656
d003bf9b787e
A leak fix in the candidate list, and some code simplification.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28623
diff
changeset
|
1287 | const char *ids[] = {"username", "password", "name", "email", "nick", "first", |
|
d003bf9b787e
A leak fix in the candidate list, and some code simplification.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28623
diff
changeset
|
1288 | "last", "address", "city", "state", "zip", "phone", "url", "date", |
|
d003bf9b787e
A leak fix in the candidate list, and some code simplification.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28623
diff
changeset
|
1289 | NULL}; |
|
28610
c914f0e55687
Prevent a NULL sprintf(%s) when no resource is assigned to an account during inband registration. Fixes #10420.
Daniel Atallah <datallah@pidgin.im>
parents:
28583
diff
changeset
|
1290 | const char *value = purple_request_field_string_get_value(field); |
|
28656
d003bf9b787e
A leak fix in the candidate list, and some code simplification.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28623
diff
changeset
|
1291 | int i; |
|
d003bf9b787e
A leak fix in the candidate list, and some code simplification.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28623
diff
changeset
|
1292 | for (i = 0; ids[i]; i++) { |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1293 | if (purple_strequal(id, ids[i])) |
|
28656
d003bf9b787e
A leak fix in the candidate list, and some code simplification.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28623
diff
changeset
|
1294 | break; |
|
d003bf9b787e
A leak fix in the candidate list, and some code simplification.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28623
diff
changeset
|
1295 | } |
|
d003bf9b787e
A leak fix in the candidate list, and some code simplification.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28623
diff
changeset
|
1296 | |
|
d003bf9b787e
A leak fix in the candidate list, and some code simplification.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28623
diff
changeset
|
1297 | if (!ids[i]) |
|
28610
c914f0e55687
Prevent a NULL sprintf(%s) when no resource is assigned to an account during inband registration. Fixes #10420.
Daniel Atallah <datallah@pidgin.im>
parents:
28583
diff
changeset
|
1298 | continue; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1299 | y = purple_xmlnode_new_child(query, ids[i]); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1300 | purple_xmlnode_insert_data(y, value, -1); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1301 | if(cbdata->js->registration && purple_strequal(id, "username")) { |
|
25604
c963986ac373
Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <darkrain42@pidgin.im>
parents:
25600
diff
changeset
|
1302 | g_free(cbdata->js->user->node); |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1303 | cbdata->js->user->node = g_strdup(value); |
|
28610
c914f0e55687
Prevent a NULL sprintf(%s) when no resource is assigned to an account during inband registration. Fixes #10420.
Daniel Atallah <datallah@pidgin.im>
parents:
28583
diff
changeset
|
1304 | } |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1305 | if(cbdata->js->registration && purple_strequal(id, "password")) |
|
34029
059c1270db1f
Remove the silly destroy argument from purple_account_set_password and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34028
diff
changeset
|
1306 | purple_account_set_password(purple_connection_get_account(cbdata->js->gc), value, NULL, NULL); |
|
28610
c914f0e55687
Prevent a NULL sprintf(%s) when no resource is assigned to an account during inband registration. Fixes #10420.
Daniel Atallah <datallah@pidgin.im>
parents:
28583
diff
changeset
|
1307 | } |
| 7072 | 1308 | } |
| 1309 | } | |
| 1310 | ||
|
17806
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1311 | if(cbdata->js->registration) { |
|
28610
c914f0e55687
Prevent a NULL sprintf(%s) when no resource is assigned to an account during inband registration. Fixes #10420.
Daniel Atallah <datallah@pidgin.im>
parents:
28583
diff
changeset
|
1312 | username = g_strdup_printf("%s@%s%s%s", cbdata->js->user->node, cbdata->js->user->domain, |
|
29035
7e9ba5e8177b
*** Plucked rev 941f01ed2234f8e476b7260fbd6ea873583387f7 (f05c54b03e6bbfdbff38c01697fbd353a969e05e):
Daniel Atallah <datallah@pidgin.im>
parents:
28984
diff
changeset
|
1313 | cbdata->js->user->resource ? "/" : "", |
|
7e9ba5e8177b
*** Plucked rev 941f01ed2234f8e476b7260fbd6ea873583387f7 (f05c54b03e6bbfdbff38c01697fbd353a969e05e):
Daniel Atallah <datallah@pidgin.im>
parents:
28984
diff
changeset
|
1314 | cbdata->js->user->resource ? cbdata->js->user->resource : ""); |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32624
diff
changeset
|
1315 | purple_account_set_username(purple_connection_get_account(cbdata->js->gc), username); |
|
21668
3698b848759b
The Jabber registration process depends upon having a non-NULL cbdata->who,
Evan Schoenberg <evands@pidgin.im>
parents:
21667
diff
changeset
|
1316 | g_free(username); |
|
17806
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1317 | } |
| 7264 | 1318 | |
|
17806
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1319 | jabber_iq_set_callback(iq, jabber_registration_result_cb, cbdata->who); |
| 7072 | 1320 | |
| 1321 | jabber_iq_send(iq); | |
|
17806
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1322 | g_free(cbdata); |
| 7072 | 1323 | } |
| 1324 | ||
| 1325 | static void | |
|
17806
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1326 | jabber_register_cancel_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fields) |
| 7072 | 1327 | { |
|
17814
c47c22006b0d
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 <am@adiumx.com>
parents:
17813
diff
changeset
|
1328 | PurpleAccount *account = purple_connection_get_account(cbdata->js->gc); |
|
19894
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
19389
diff
changeset
|
1329 | if(account && cbdata->js->registration) { |
|
32721
3a64afbc2da2
Introduce purple_account_register_completed() to handle the invoking of any
Andrew Victor <andrew.victor@mxit.com>
parents:
32698
diff
changeset
|
1330 | purple_account_register_completed(account, FALSE); |
|
17806
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1331 | jabber_connection_schedule_close(cbdata->js); |
|
20320
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20316
diff
changeset
|
1332 | } |
|
17806
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1333 | g_free(cbdata->who); |
|
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1334 | g_free(cbdata); |
| 7072 | 1335 | } |
| 1336 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1337 | static void jabber_register_x_data_cb(JabberStream *js, PurpleXmlNode *result, gpointer data) |
| 7923 | 1338 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1339 | PurpleXmlNode *query; |
| 7923 | 1340 | JabberIq *iq; |
|
17806
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1341 | char *to = data; |
| 7923 | 1342 | |
| 1343 | iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register"); | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1344 | query = purple_xmlnode_get_child(iq->node, "query"); |
|
25604
c963986ac373
Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <darkrain42@pidgin.im>
parents:
25600
diff
changeset
|
1345 | if (to) |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1346 | purple_xmlnode_set_attrib(iq->node,"to",to); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1347 | |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1348 | purple_xmlnode_insert_child(query, result); |
| 7923 | 1349 | |
|
17806
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1350 | jabber_iq_set_callback(iq, jabber_registration_result_cb, to); |
| 7923 | 1351 | jabber_iq_send(iq); |
| 1352 | } | |
| 1353 | ||
|
26924
fb6574724452
This is a little less...repetitious
Paul Aurich <darkrain42@pidgin.im>
parents:
26922
diff
changeset
|
1354 | static const struct { |
|
fb6574724452
This is a little less...repetitious
Paul Aurich <darkrain42@pidgin.im>
parents:
26922
diff
changeset
|
1355 | const char *name; |
|
fb6574724452
This is a little less...repetitious
Paul Aurich <darkrain42@pidgin.im>
parents:
26922
diff
changeset
|
1356 | const char *label; |
|
fb6574724452
This is a little less...repetitious
Paul Aurich <darkrain42@pidgin.im>
parents:
26922
diff
changeset
|
1357 | } registration_fields[] = { |
|
fb6574724452
This is a little less...repetitious
Paul Aurich <darkrain42@pidgin.im>
parents:
26922
diff
changeset
|
1358 | { "email", N_("Email") }, |
|
fb6574724452
This is a little less...repetitious
Paul Aurich <darkrain42@pidgin.im>
parents:
26922
diff
changeset
|
1359 | { "nick", N_("Nickname") }, |
|
fb6574724452
This is a little less...repetitious
Paul Aurich <darkrain42@pidgin.im>
parents:
26922
diff
changeset
|
1360 | { "first", N_("First name") }, |
|
fb6574724452
This is a little less...repetitious
Paul Aurich <darkrain42@pidgin.im>
parents:
26922
diff
changeset
|
1361 | { "last", N_("Last name") }, |
|
fb6574724452
This is a little less...repetitious
Paul Aurich <darkrain42@pidgin.im>
parents:
26922
diff
changeset
|
1362 | { "address", N_("Address") }, |
|
fb6574724452
This is a little less...repetitious
Paul Aurich <darkrain42@pidgin.im>
parents:
26922
diff
changeset
|
1363 | { "city", N_("City") }, |
|
fb6574724452
This is a little less...repetitious
Paul Aurich <darkrain42@pidgin.im>
parents:
26922
diff
changeset
|
1364 | { "state", N_("State") }, |
|
fb6574724452
This is a little less...repetitious
Paul Aurich <darkrain42@pidgin.im>
parents:
26922
diff
changeset
|
1365 | { "zip", N_("Postal code") }, |
|
fb6574724452
This is a little less...repetitious
Paul Aurich <darkrain42@pidgin.im>
parents:
26922
diff
changeset
|
1366 | { "phone", N_("Phone") }, |
|
fb6574724452
This is a little less...repetitious
Paul Aurich <darkrain42@pidgin.im>
parents:
26922
diff
changeset
|
1367 | { "url", N_("URL") }, |
|
fb6574724452
This is a little less...repetitious
Paul Aurich <darkrain42@pidgin.im>
parents:
26922
diff
changeset
|
1368 | { "date", N_("Date") }, |
|
fb6574724452
This is a little less...repetitious
Paul Aurich <darkrain42@pidgin.im>
parents:
26922
diff
changeset
|
1369 | { NULL, NULL } |
|
fb6574724452
This is a little less...repetitious
Paul Aurich <darkrain42@pidgin.im>
parents:
26922
diff
changeset
|
1370 | }; |
|
fb6574724452
This is a little less...repetitious
Paul Aurich <darkrain42@pidgin.im>
parents:
26922
diff
changeset
|
1371 | |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25814
diff
changeset
|
1372 | void jabber_register_parse(JabberStream *js, const char *from, JabberIqType type, |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1373 | const char *id, PurpleXmlNode *query) |
| 7072 | 1374 | { |
|
17814
c47c22006b0d
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 <am@adiumx.com>
parents:
17813
diff
changeset
|
1375 | PurpleAccount *account = purple_connection_get_account(js->gc); |
|
21492
5f6d249bb601
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evands@pidgin.im>
parents:
21453
diff
changeset
|
1376 | PurpleRequestFields *fields; |
|
5f6d249bb601
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evands@pidgin.im>
parents:
21453
diff
changeset
|
1377 | PurpleRequestFieldGroup *group; |
|
5f6d249bb601
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evands@pidgin.im>
parents:
21453
diff
changeset
|
1378 | PurpleRequestField *field; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1379 | PurpleXmlNode *x, *y, *node; |
|
21492
5f6d249bb601
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evands@pidgin.im>
parents:
21453
diff
changeset
|
1380 | char *instructions; |
|
17806
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1381 | JabberRegisterCBData *cbdata; |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1382 | gboolean registered = FALSE; |
|
26924
fb6574724452
This is a little less...repetitious
Paul Aurich <darkrain42@pidgin.im>
parents:
26922
diff
changeset
|
1383 | int i; |
| 7072 | 1384 | |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25814
diff
changeset
|
1385 | if (type != JABBER_IQ_RESULT) |
| 14356 | 1386 | return; |
| 1387 | ||
|
21492
5f6d249bb601
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evands@pidgin.im>
parents:
21453
diff
changeset
|
1388 | if(js->registration) { |
| 7072 | 1389 | /* get rid of the login thingy */ |
|
34746
dc9c911dbd35
Started GObjectification of PurpleConnection.
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
1390 | purple_connection_set_state(js->gc, PURPLE_CONNECTION_CONNECTED); |
|
21492
5f6d249bb601
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evands@pidgin.im>
parents:
21453
diff
changeset
|
1391 | } |
| 7072 | 1392 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1393 | if(purple_xmlnode_get_child(query, "registered")) { |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1394 | registered = TRUE; |
|
21492
5f6d249bb601
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evands@pidgin.im>
parents:
21453
diff
changeset
|
1395 | |
|
17814
c47c22006b0d
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 <am@adiumx.com>
parents:
17813
diff
changeset
|
1396 | if(js->registration) { |
| 15884 | 1397 | purple_notify_error(NULL, _("Already Registered"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
1398 | _("Already Registered"), NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
1399 | purple_request_cpar_from_connection(js->gc)); |
|
32721
3a64afbc2da2
Introduce purple_account_register_completed() to handle the invoking of any
Andrew Victor <andrew.victor@mxit.com>
parents:
32698
diff
changeset
|
1400 | purple_account_register_completed(account, FALSE); |
| 7072 | 1401 | jabber_connection_schedule_close(js); |
| 1402 | return; | |
| 1403 | } | |
|
17806
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1404 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
1405 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1406 | if((x = purple_xmlnode_get_child_with_namespace(query, "x", "jabber:x:data"))) { |
|
17806
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1407 | jabber_x_data_request(js, x, jabber_register_x_data_cb, g_strdup(from)); |
|
21492
5f6d249bb601
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evands@pidgin.im>
parents:
21453
diff
changeset
|
1408 | return; |
|
5f6d249bb601
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evands@pidgin.im>
parents:
21453
diff
changeset
|
1409 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1410 | } else if((x = purple_xmlnode_get_child_with_namespace(query, "x", NS_OOB_X_DATA))) { |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1411 | PurpleXmlNode *url; |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1412 | |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1413 | if((url = purple_xmlnode_get_child(x, "url"))) { |
|
21492
5f6d249bb601
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evands@pidgin.im>
parents:
21453
diff
changeset
|
1414 | char *href; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1415 | if((href = purple_xmlnode_get_data(url))) { |
|
21492
5f6d249bb601
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evands@pidgin.im>
parents:
21453
diff
changeset
|
1416 | purple_notify_uri(NULL, href); |
|
5f6d249bb601
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evands@pidgin.im>
parents:
21453
diff
changeset
|
1417 | g_free(href); |
|
5f6d249bb601
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evands@pidgin.im>
parents:
21453
diff
changeset
|
1418 | |
|
5f6d249bb601
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evands@pidgin.im>
parents:
21453
diff
changeset
|
1419 | if(js->registration) { |
|
32721
3a64afbc2da2
Introduce purple_account_register_completed() to handle the invoking of any
Andrew Victor <andrew.victor@mxit.com>
parents:
32698
diff
changeset
|
1420 | /* succeeded, but we have no login info */ |
|
3a64afbc2da2
Introduce purple_account_register_completed() to handle the invoking of any
Andrew Victor <andrew.victor@mxit.com>
parents:
32698
diff
changeset
|
1421 | purple_account_register_completed(account, TRUE); |
|
34866
abb9d842c1f0
Removed purple_connection_disable_reconnection(). Used purple_connection_error() in jabber's queried registration success.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1422 | purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, |
|
abb9d842c1f0
Removed purple_connection_disable_reconnection(). Used purple_connection_error() in jabber's queried registration success.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1423 | _("Registration completed successfully. Please reconnect to continue.")); |
|
21492
5f6d249bb601
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evands@pidgin.im>
parents:
21453
diff
changeset
|
1424 | jabber_connection_schedule_close(js); |
| 8398 | 1425 | } |
|
21492
5f6d249bb601
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evands@pidgin.im>
parents:
21453
diff
changeset
|
1426 | return; |
| 7923 | 1427 | } |
| 1428 | } | |
|
21492
5f6d249bb601
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evands@pidgin.im>
parents:
21453
diff
changeset
|
1429 | } |
| 7923 | 1430 | |
|
21492
5f6d249bb601
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evands@pidgin.im>
parents:
21453
diff
changeset
|
1431 | /* as a last resort, use the old jabber:iq:register syntax */ |
| 7923 | 1432 | |
|
21492
5f6d249bb601
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evands@pidgin.im>
parents:
21453
diff
changeset
|
1433 | fields = purple_request_fields_new(); |
|
5f6d249bb601
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evands@pidgin.im>
parents:
21453
diff
changeset
|
1434 | group = purple_request_field_group_new(NULL); |
|
5f6d249bb601
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evands@pidgin.im>
parents:
21453
diff
changeset
|
1435 | purple_request_fields_add_group(fields, group); |
| 7072 | 1436 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1437 | if((node = purple_xmlnode_get_child(query, "username"))) { |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1438 | char *data = purple_xmlnode_get_data(node); |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26086
diff
changeset
|
1439 | if(js->registration) |
|
26927
4676609b1855
Use defaults provided by the server where applicable and when available
Paul Aurich <darkrain42@pidgin.im>
parents:
26924
diff
changeset
|
1440 | field = purple_request_field_string_new("username", _("Username"), data ? data : js->user->node, FALSE); |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26086
diff
changeset
|
1441 | else |
|
26927
4676609b1855
Use defaults provided by the server where applicable and when available
Paul Aurich <darkrain42@pidgin.im>
parents:
26924
diff
changeset
|
1442 | field = purple_request_field_string_new("username", _("Username"), data, FALSE); |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26086
diff
changeset
|
1443 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26086
diff
changeset
|
1444 | purple_request_field_group_add_field(group, field); |
|
26927
4676609b1855
Use defaults provided by the server where applicable and when available
Paul Aurich <darkrain42@pidgin.im>
parents:
26924
diff
changeset
|
1445 | g_free(data); |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26086
diff
changeset
|
1446 | } |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1447 | if((node = purple_xmlnode_get_child(query, "password"))) { |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26086
diff
changeset
|
1448 | if(js->registration) |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26086
diff
changeset
|
1449 | field = purple_request_field_string_new("password", _("Password"), |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26086
diff
changeset
|
1450 | purple_connection_get_password(js->gc), FALSE); |
|
26927
4676609b1855
Use defaults provided by the server where applicable and when available
Paul Aurich <darkrain42@pidgin.im>
parents:
26924
diff
changeset
|
1451 | else { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1452 | char *data = purple_xmlnode_get_data(node); |
|
26927
4676609b1855
Use defaults provided by the server where applicable and when available
Paul Aurich <darkrain42@pidgin.im>
parents:
26924
diff
changeset
|
1453 | field = purple_request_field_string_new("password", _("Password"), data, FALSE); |
|
4676609b1855
Use defaults provided by the server where applicable and when available
Paul Aurich <darkrain42@pidgin.im>
parents:
26924
diff
changeset
|
1454 | g_free(data); |
|
4676609b1855
Use defaults provided by the server where applicable and when available
Paul Aurich <darkrain42@pidgin.im>
parents:
26924
diff
changeset
|
1455 | } |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26086
diff
changeset
|
1456 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26086
diff
changeset
|
1457 | purple_request_field_string_set_masked(field, TRUE); |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26086
diff
changeset
|
1458 | purple_request_field_group_add_field(group, field); |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26086
diff
changeset
|
1459 | } |
|
26924
fb6574724452
This is a little less...repetitious
Paul Aurich <darkrain42@pidgin.im>
parents:
26922
diff
changeset
|
1460 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1461 | if((node = purple_xmlnode_get_child(query, "name"))) { |
|
17806
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1462 | if(js->registration) |
| 15884 | 1463 | field = purple_request_field_string_new("name", _("Name"), |
|
34589
428e92c79631
Renamed purple_account_[get,set]_alias to purple_account[get,set]_private_alias.
Ankit Vani <a@nevitus.org>
parents:
34578
diff
changeset
|
1464 | purple_account_get_private_alias(purple_connection_get_account(js->gc)), FALSE); |
|
26927
4676609b1855
Use defaults provided by the server where applicable and when available
Paul Aurich <darkrain42@pidgin.im>
parents:
26924
diff
changeset
|
1465 | else { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1466 | char *data = purple_xmlnode_get_data(node); |
|
26927
4676609b1855
Use defaults provided by the server where applicable and when available
Paul Aurich <darkrain42@pidgin.im>
parents:
26924
diff
changeset
|
1467 | field = purple_request_field_string_new("name", _("Name"), data, FALSE); |
|
4676609b1855
Use defaults provided by the server where applicable and when available
Paul Aurich <darkrain42@pidgin.im>
parents:
26924
diff
changeset
|
1468 | g_free(data); |
|
4676609b1855
Use defaults provided by the server where applicable and when available
Paul Aurich <darkrain42@pidgin.im>
parents:
26924
diff
changeset
|
1469 | } |
|
21492
5f6d249bb601
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evands@pidgin.im>
parents:
21453
diff
changeset
|
1470 | purple_request_field_group_add_field(group, field); |
|
5f6d249bb601
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evands@pidgin.im>
parents:
21453
diff
changeset
|
1471 | } |
|
26924
fb6574724452
This is a little less...repetitious
Paul Aurich <darkrain42@pidgin.im>
parents:
26922
diff
changeset
|
1472 | |
|
fb6574724452
This is a little less...repetitious
Paul Aurich <darkrain42@pidgin.im>
parents:
26922
diff
changeset
|
1473 | for (i = 0; registration_fields[i].name != NULL; ++i) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1474 | if ((node = purple_xmlnode_get_child(query, registration_fields[i].name))) { |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1475 | char *data = purple_xmlnode_get_data(node); |
|
26924
fb6574724452
This is a little less...repetitious
Paul Aurich <darkrain42@pidgin.im>
parents:
26922
diff
changeset
|
1476 | field = purple_request_field_string_new(registration_fields[i].name, |
|
fb6574724452
This is a little less...repetitious
Paul Aurich <darkrain42@pidgin.im>
parents:
26922
diff
changeset
|
1477 | _(registration_fields[i].label), |
|
26927
4676609b1855
Use defaults provided by the server where applicable and when available
Paul Aurich <darkrain42@pidgin.im>
parents:
26924
diff
changeset
|
1478 | data, FALSE); |
|
26924
fb6574724452
This is a little less...repetitious
Paul Aurich <darkrain42@pidgin.im>
parents:
26922
diff
changeset
|
1479 | purple_request_field_group_add_field(group, field); |
|
26927
4676609b1855
Use defaults provided by the server where applicable and when available
Paul Aurich <darkrain42@pidgin.im>
parents:
26924
diff
changeset
|
1480 | g_free(data); |
|
26924
fb6574724452
This is a little less...repetitious
Paul Aurich <darkrain42@pidgin.im>
parents:
26922
diff
changeset
|
1481 | } |
|
21492
5f6d249bb601
Fixed whitespace and indentation in jabber_register_parse(). I'm seeing crashes while attempting to register, and it was difficult to follow the previous code with inconsistent and misleading indentation.
Evan Schoenberg <evands@pidgin.im>
parents:
21453
diff
changeset
|
1482 | } |
|
26924
fb6574724452
This is a little less...repetitious
Paul Aurich <darkrain42@pidgin.im>
parents:
26922
diff
changeset
|
1483 | |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1484 | if(registered) { |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1485 | field = purple_request_field_bool_new("unregister", _("Unregister"), FALSE); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1486 | purple_request_field_group_add_field(group, field); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1487 | } |
| 7072 | 1488 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1489 | if((y = purple_xmlnode_get_child(query, "instructions"))) |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1490 | instructions = purple_xmlnode_get_data(y); |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1491 | else if(registered) |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1492 | instructions = g_strdup(_("Please fill out the information below " |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1493 | "to change your account registration.")); |
|
20320
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20316
diff
changeset
|
1494 | else |
|
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20316
diff
changeset
|
1495 | instructions = g_strdup(_("Please fill out the information below " |
|
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20316
diff
changeset
|
1496 | "to register your new account.")); |
| 7072 | 1497 | |
|
17806
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1498 | cbdata = g_new0(JabberRegisterCBData, 1); |
|
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1499 | cbdata->js = js; |
|
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1500 | cbdata->who = g_strdup(from); |
| 7072 | 1501 | |
|
17806
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1502 | if(js->registration) |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
1503 | purple_request_fields(js->gc, _("Register New XMPP Account"), |
|
16961
b6955f946f8f
s/Jabber/XMPP in user-visible places.
Richard Laager <rlaager@pidgin.im>
parents:
16847
diff
changeset
|
1504 | _("Register New XMPP Account"), instructions, fields, |
| 7072 | 1505 | _("Register"), G_CALLBACK(jabber_register_cb), |
|
16490
68c22924d66b
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 <evands@pidgin.im>
parents:
16302
diff
changeset
|
1506 | _("Cancel"), G_CALLBACK(jabber_register_cancel_cb), |
|
34332
876483829700
Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34304
diff
changeset
|
1507 | purple_request_cpar_from_connection(js->gc), |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
1508 | cbdata); |
|
17806
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1509 | else { |
|
25604
c963986ac373
Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <darkrain42@pidgin.im>
parents:
25600
diff
changeset
|
1510 | char *title; |
|
c963986ac373
Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <darkrain42@pidgin.im>
parents:
25600
diff
changeset
|
1511 | g_return_if_fail(from != NULL); |
|
c963986ac373
Don't send a 'to' attribute on an outgoing stanza if we didn't receive one.
Paul Aurich <darkrain42@pidgin.im>
parents:
25600
diff
changeset
|
1512 | title = registered ? g_strdup_printf(_("Change Account Registration at %s"), from) |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1513 | :g_strdup_printf(_("Register New Account at %s"), from); |
|
34332
876483829700
Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34304
diff
changeset
|
1514 | purple_request_fields(js->gc, title, title, instructions, |
|
876483829700
Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34304
diff
changeset
|
1515 | fields, (registered ? _("Change Registration") : |
|
876483829700
Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34304
diff
changeset
|
1516 | _("Register")), G_CALLBACK(jabber_register_cb), |
|
876483829700
Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34304
diff
changeset
|
1517 | _("Cancel"), G_CALLBACK(jabber_register_cancel_cb), |
|
876483829700
Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34304
diff
changeset
|
1518 | purple_request_cpar_from_connection(js->gc), cbdata); |
|
17806
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1519 | g_free(title); |
|
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1520 | } |
|
14140
fcb570e0b2db
[gaim-migrate @ 16699]
Daniel Atallah <datallah@pidgin.im>
parents:
14115
diff
changeset
|
1521 | |
|
20320
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20316
diff
changeset
|
1522 | g_free(instructions); |
|
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20316
diff
changeset
|
1523 | } |
| 7072 | 1524 | |
| 8016 | 1525 | void jabber_register_start(JabberStream *js) |
| 7072 | 1526 | { |
| 1527 | JabberIq *iq; | |
| 1528 | ||
| 1529 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:register"); | |
| 1530 | jabber_iq_send(iq); | |
| 1531 | } | |
| 1532 | ||
|
17806
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1533 | void jabber_register_gateway(JabberStream *js, const char *gateway) { |
|
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1534 | JabberIq *iq; |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
1535 | |
|
17806
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1536 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:register"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1537 | purple_xmlnode_set_attrib(iq->node, "to", gateway); |
|
17806
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1538 | jabber_iq_send(iq); |
|
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1539 | } |
|
ed4647f0915d
Added the ability to register gateways, re-using most of the account registration code for this.
Andreas Monitzer <am@adiumx.com>
parents:
17803
diff
changeset
|
1540 | |
|
16302
eb633ebf84f2
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@pidgin.im>
parents:
16180
diff
changeset
|
1541 | void jabber_register_account(PurpleAccount *account) |
| 7072 | 1542 | { |
| 1543 | JabberStream *js; | |
|
27850
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1544 | |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1545 | js = jabber_stream_new(account); |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1546 | if (js == NULL) |
| 7310 | 1547 | return; |
|
27850
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1548 | |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1549 | js->registration = TRUE; |
|
3087baaf7831
Refactor jabber_login and jabber_register_account
Paul Aurich <darkrain42@pidgin.im>
parents:
27779
diff
changeset
|
1550 | jabber_stream_connect(js); |
| 7072 | 1551 | } |
| 1552 | ||
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26686
diff
changeset
|
1553 | static void |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26686
diff
changeset
|
1554 | jabber_unregister_account_iq_cb(JabberStream *js, const char *from, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26686
diff
changeset
|
1555 | JabberIqType type, const char *id, |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1556 | PurpleXmlNode *packet, gpointer data) |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26686
diff
changeset
|
1557 | { |
|
18994
310e9d853e2b
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 <am@adiumx.com>
parents:
18993
diff
changeset
|
1558 | PurpleAccount *account = purple_connection_get_account(js->gc); |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26686
diff
changeset
|
1559 | |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26686
diff
changeset
|
1560 | if (type == JABBER_IQ_ERROR) { |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
1561 | char *msg = jabber_parse_error(js, packet, NULL); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
1562 | |
|
18912
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18755
diff
changeset
|
1563 | purple_notify_error(js->gc, _("Error unregistering account"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
1564 | _("Error unregistering account"), msg, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
1565 | purple_request_cpar_from_connection(js->gc)); |
|
18912
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18755
diff
changeset
|
1566 | g_free(msg); |
|
18994
310e9d853e2b
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 <am@adiumx.com>
parents:
18993
diff
changeset
|
1567 | if(js->unregistration_cb) |
|
18995
6ba7743720cb
Mixed up TRUE and FALSE.
Andreas Monitzer <am@adiumx.com>
parents:
18994
diff
changeset
|
1568 | js->unregistration_cb(account, FALSE, js->unregistration_user_data); |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26686
diff
changeset
|
1569 | } else { |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
1570 | purple_notify_info(js->gc, _("Account successfully " |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
1571 | "unregistered"), _("Account successfully unregistered"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
1572 | NULL, purple_request_cpar_from_connection(js->gc)); |
|
18994
310e9d853e2b
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 <am@adiumx.com>
parents:
18993
diff
changeset
|
1573 | if(js->unregistration_cb) |
|
18995
6ba7743720cb
Mixed up TRUE and FALSE.
Andreas Monitzer <am@adiumx.com>
parents:
18994
diff
changeset
|
1574 | js->unregistration_cb(account, TRUE, js->unregistration_user_data); |
|
18912
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18755
diff
changeset
|
1575 | } |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18755
diff
changeset
|
1576 | } |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18755
diff
changeset
|
1577 | |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18755
diff
changeset
|
1578 | static void jabber_unregister_account_cb(JabberStream *js) { |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18755
diff
changeset
|
1579 | JabberIq *iq; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1580 | PurpleXmlNode *query; |
|
19994
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1581 | |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1582 | g_return_if_fail(js->unregistration); |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1583 | |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1584 | iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register"); |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1585 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1586 | query = purple_xmlnode_get_child_with_namespace(iq->node, "query", "jabber:iq:register"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1587 | |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1588 | purple_xmlnode_new_child(query, "remove"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1589 | purple_xmlnode_set_attrib(iq->node, "to", js->user->domain); |
|
19994
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1590 | |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1591 | jabber_iq_set_callback(iq, jabber_unregister_account_iq_cb, NULL); |
|
18912
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18755
diff
changeset
|
1592 | jabber_iq_send(iq); |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18755
diff
changeset
|
1593 | } |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18755
diff
changeset
|
1594 | |
|
18994
310e9d853e2b
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 <am@adiumx.com>
parents:
18993
diff
changeset
|
1595 | void jabber_unregister_account(PurpleAccount *account, PurpleAccountUnregistrationCb cb, void *user_data) { |
|
18912
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18755
diff
changeset
|
1596 | PurpleConnection *gc = purple_account_get_connection(account); |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18755
diff
changeset
|
1597 | JabberStream *js; |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
1598 | |
|
34746
dc9c911dbd35
Started GObjectification of PurpleConnection.
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
1599 | if (purple_connection_get_state(gc) != PURPLE_CONNECTION_CONNECTED) { |
|
dc9c911dbd35
Started GObjectification of PurpleConnection.
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
1600 | if (purple_connection_get_state(gc) != PURPLE_CONNECTION_CONNECTING) |
|
18912
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18755
diff
changeset
|
1601 | jabber_login(account); |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
1602 | js = purple_connection_get_protocol_data(gc); |
|
18912
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18755
diff
changeset
|
1603 | js->unregistration = TRUE; |
|
18994
310e9d853e2b
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 <am@adiumx.com>
parents:
18993
diff
changeset
|
1604 | js->unregistration_cb = cb; |
|
310e9d853e2b
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 <am@adiumx.com>
parents:
18993
diff
changeset
|
1605 | js->unregistration_user_data = user_data; |
|
18912
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18755
diff
changeset
|
1606 | return; |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18755
diff
changeset
|
1607 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
1608 | |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
1609 | js = purple_connection_get_protocol_data(gc); |
|
19994
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1610 | |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1611 | if (js->unregistration) { |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1612 | purple_debug_error("jabber", "Unregistration in process; ignoring duplicate request.\n"); |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1613 | return; |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1614 | } |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1615 | |
|
18912
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18755
diff
changeset
|
1616 | js->unregistration = TRUE; |
|
18994
310e9d853e2b
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 <am@adiumx.com>
parents:
18993
diff
changeset
|
1617 | js->unregistration_cb = cb; |
|
310e9d853e2b
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 <am@adiumx.com>
parents:
18993
diff
changeset
|
1618 | js->unregistration_user_data = user_data; |
|
19994
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1619 | |
|
18912
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18755
diff
changeset
|
1620 | jabber_unregister_account_cb(js); |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18755
diff
changeset
|
1621 | } |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18755
diff
changeset
|
1622 | |
|
25727
1440163769e6
*** Plucked rev 4831edb9 (darkrain42@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents:
25726
diff
changeset
|
1623 | /* TODO: As Will pointed out in IRC, after being notified by the core to |
|
1440163769e6
*** Plucked rev 4831edb9 (darkrain42@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents:
25726
diff
changeset
|
1624 | * shutdown, we should async. wait for the server to send us the stream |
|
1440163769e6
*** Plucked rev 4831edb9 (darkrain42@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents:
25726
diff
changeset
|
1625 | * termination before destorying everything. That seems like it would require |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
1626 | * changing the semantics of protocol's close(), so it's a good idea for 3.0.0. |
|
25727
1440163769e6
*** Plucked rev 4831edb9 (darkrain42@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents:
25726
diff
changeset
|
1627 | */ |
|
16302
eb633ebf84f2
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@pidgin.im>
parents:
16180
diff
changeset
|
1628 | void jabber_close(PurpleConnection *gc) |
| 2086 | 1629 | { |
|
29264
ea88690768fe
jabber: Remove a funky workaround for an (old) OpenSSL crash.
Paul Aurich <darkrain42@pidgin.im>
parents:
29263
diff
changeset
|
1630 | JabberStream *js = purple_connection_get_protocol_data(gc); |
| 2956 | 1631 | |
|
23717
5a7e463b226d
Further decoupled Jingle code from jabber.c:
Michael Ruprecht <maiku@pidgin.im>
parents:
23716
diff
changeset
|
1632 | /* Close all of the open Jingle sessions on this stream */ |
|
26143
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
26117
diff
changeset
|
1633 | jingle_terminate_sessions(js); |
|
23697
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
23696
diff
changeset
|
1634 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34238
diff
changeset
|
1635 | if (js->bosh) { |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34238
diff
changeset
|
1636 | jabber_bosh_connection_destroy(js->bosh); |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34238
diff
changeset
|
1637 | js->bosh = NULL; |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34238
diff
changeset
|
1638 | } else if ((js->gsc && js->gsc->fd > 0) || js->fd > 0) |
| 14003 | 1639 | jabber_send_raw(js, "</stream:stream>", -1); |
| 3311 | 1640 | |
| 7014 | 1641 | if(js->gsc) { |
|
29264
ea88690768fe
jabber: Remove a funky workaround for an (old) OpenSSL crash.
Paul Aurich <darkrain42@pidgin.im>
parents:
29263
diff
changeset
|
1642 | purple_ssl_close(js->gsc); |
| 8360 | 1643 | } else if (js->fd > 0) { |
|
32684
edefbf316da1
Jabber: Move the "inpa" input watcher into protocol_data.
Andrew Victor <andrew.victor@mxit.com>
parents:
32679
diff
changeset
|
1644 | if(js->inpa) { |
|
edefbf316da1
Jabber: Move the "inpa" input watcher into protocol_data.
Andrew Victor <andrew.victor@mxit.com>
parents:
32679
diff
changeset
|
1645 | purple_input_remove(js->inpa); |
|
edefbf316da1
Jabber: Move the "inpa" input watcher into protocol_data.
Andrew Victor <andrew.victor@mxit.com>
parents:
32679
diff
changeset
|
1646 | js->inpa = 0; |
|
edefbf316da1
Jabber: Move the "inpa" input watcher into protocol_data.
Andrew Victor <andrew.victor@mxit.com>
parents:
32679
diff
changeset
|
1647 | } |
| 7014 | 1648 | close(js->fd); |
| 1649 | } | |
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
1650 | |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
1651 | jabber_buddy_remove_all_pending_buddy_info_requests(js); |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
1652 | |
|
17810
c8d4297080cb
Fixed a leak: The XML parser was never cleaned up on disconnect.
Andreas Monitzer <am@adiumx.com>
parents:
17806
diff
changeset
|
1653 | jabber_parser_free(js); |
|
c8d4297080cb
Fixed a leak: The XML parser was never cleaned up on disconnect.
Andreas Monitzer <am@adiumx.com>
parents:
17806
diff
changeset
|
1654 | |
| 8312 | 1655 | if(js->iq_callbacks) |
| 1656 | g_hash_table_destroy(js->iq_callbacks); | |
| 7072 | 1657 | if(js->buddies) |
| 1658 | g_hash_table_destroy(js->buddies); | |
| 1659 | if(js->chats) | |
| 1660 | g_hash_table_destroy(js->chats); | |
|
21688
a16385b34219
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 <datallah@pidgin.im>
parents:
21668
diff
changeset
|
1661 | |
| 8043 | 1662 | while(js->chat_servers) { |
| 1663 | g_free(js->chat_servers->data); | |
| 1664 | js->chat_servers = g_list_delete_link(js->chat_servers, js->chat_servers); | |
| 1665 | } | |
|
21688
a16385b34219
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 <datallah@pidgin.im>
parents:
21668
diff
changeset
|
1666 | |
| 11675 | 1667 | while(js->user_directories) { |
| 1668 | g_free(js->user_directories->data); | |
| 1669 | js->user_directories = g_list_delete_link(js->user_directories, js->user_directories); | |
| 1670 | } | |
|
21688
a16385b34219
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 <datallah@pidgin.im>
parents:
21668
diff
changeset
|
1671 | |
|
a16385b34219
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 <datallah@pidgin.im>
parents:
21668
diff
changeset
|
1672 | while(js->bs_proxies) { |
|
a16385b34219
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 <datallah@pidgin.im>
parents:
21668
diff
changeset
|
1673 | JabberBytestreamsStreamhost *sh = js->bs_proxies->data; |
|
a16385b34219
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 <datallah@pidgin.im>
parents:
21668
diff
changeset
|
1674 | g_free(sh->jid); |
|
a16385b34219
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 <datallah@pidgin.im>
parents:
21668
diff
changeset
|
1675 | g_free(sh->host); |
|
a16385b34219
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 <datallah@pidgin.im>
parents:
21668
diff
changeset
|
1676 | g_free(sh->zeroconf); |
|
a16385b34219
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 <datallah@pidgin.im>
parents:
21668
diff
changeset
|
1677 | g_free(sh); |
|
a16385b34219
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 <datallah@pidgin.im>
parents:
21668
diff
changeset
|
1678 | js->bs_proxies = g_list_delete_link(js->bs_proxies, js->bs_proxies); |
|
a16385b34219
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 <datallah@pidgin.im>
parents:
21668
diff
changeset
|
1679 | } |
|
a16385b34219
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 <datallah@pidgin.im>
parents:
21668
diff
changeset
|
1680 | |
|
34269
26b4c9a54166
HTTP: Use PurpleHttpConnectionSet instead of GSLists of PurpleHttpConnection structs
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34268
diff
changeset
|
1681 | purple_http_connection_set_destroy(js->http_conns); |
|
24012
913d6f18cb95
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <datallah@pidgin.im>
parents:
23911
diff
changeset
|
1682 | |
|
21688
a16385b34219
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 <datallah@pidgin.im>
parents:
21668
diff
changeset
|
1683 | g_free(js->stream_id); |
| 7587 | 1684 | if(js->user) |
| 1685 | jabber_id_free(js->user); | |
|
25811
57012229a242
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <darkrain42@pidgin.im>
parents:
25808
diff
changeset
|
1686 | g_free(js->initial_avatar_hash); |
|
21688
a16385b34219
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 <datallah@pidgin.im>
parents:
21668
diff
changeset
|
1687 | g_free(js->avatar_hash); |
|
24716
047f5075ca58
Entity Capabilities must be per-JabberStream
Paul Aurich <darkrain42@pidgin.im>
parents:
24715
diff
changeset
|
1688 | g_free(js->caps_hash); |
|
21688
a16385b34219
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 <datallah@pidgin.im>
parents:
21668
diff
changeset
|
1689 | |
|
30032
02bd634e0591
jabber: Stifle an assertion warning.
Paul Aurich <darkrain42@pidgin.im>
parents:
30013
diff
changeset
|
1690 | if (js->write_buffer) |
|
34529
68cf25486001
GObjectify PurpleCircBuffer as PurpleCircularBuffer (from gobjectification branch)
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
1691 | g_object_unref(G_OBJECT(js->write_buffer)); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
1692 | if(js->writeh) |
| 15884 | 1693 | purple_input_remove(js->writeh); |
|
28866
e3d867ce000b
jabber: Complete (though untested) SCRAM implementation.
Paul Aurich <darkrain42@pidgin.im>
parents:
28855
diff
changeset
|
1694 | if (js->auth_mech && js->auth_mech->dispose) |
|
e3d867ce000b
jabber: Complete (though untested) SCRAM implementation.
Paul Aurich <darkrain42@pidgin.im>
parents:
28855
diff
changeset
|
1695 | js->auth_mech->dispose(js); |
| 12508 | 1696 | #ifdef HAVE_CYRUS_SASL |
| 1697 | if(js->sasl) | |
| 1698 | sasl_dispose(&js->sasl); | |
| 1699 | if(js->sasl_mechs) | |
| 1700 | g_string_free(js->sasl_mechs, TRUE); | |
|
21688
a16385b34219
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 <datallah@pidgin.im>
parents:
21668
diff
changeset
|
1701 | g_free(js->sasl_cb); |
|
30723
96e248b07586
jabber: Fix a pernicious race condition in our cyrus auth code
Paul Aurich <darkrain42@pidgin.im>
parents:
30688
diff
changeset
|
1702 | /* Note: _not_ g_free. See auth_cyrus.c:jabber_sasl_cb_secret */ |
|
96e248b07586
jabber: Fix a pernicious race condition in our cyrus auth code
Paul Aurich <darkrain42@pidgin.im>
parents:
30688
diff
changeset
|
1703 | free(js->sasl_secret); |
|
37646
8f99c1dff72e
Fix jabber password dialog infinite loop with SASL
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37518
diff
changeset
|
1704 | g_free(js->sasl_password); |
|
18449
2d2df64f4303
applied changes from f9186fabb483b56a9d7e8fb7241b2520e9930413
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18235
diff
changeset
|
1705 | #endif |
|
21688
a16385b34219
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 <datallah@pidgin.im>
parents:
21668
diff
changeset
|
1706 | g_free(js->serverFQDN); |
|
17817
8e0f271aab78
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 <am@adiumx.com>
parents:
17815
diff
changeset
|
1707 | while(js->commands) { |
|
8e0f271aab78
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 <am@adiumx.com>
parents:
17815
diff
changeset
|
1708 | JabberAdHocCommands *cmd = js->commands->data; |
|
8e0f271aab78
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 <am@adiumx.com>
parents:
17815
diff
changeset
|
1709 | g_free(cmd->jid); |
|
8e0f271aab78
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 <am@adiumx.com>
parents:
17815
diff
changeset
|
1710 | g_free(cmd->node); |
| 17827 | 1711 | g_free(cmd->name); |
|
17817
8e0f271aab78
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 <am@adiumx.com>
parents:
17815
diff
changeset
|
1712 | g_free(cmd); |
|
8e0f271aab78
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 <am@adiumx.com>
parents:
17815
diff
changeset
|
1713 | js->commands = g_list_delete_link(js->commands, js->commands); |
|
8e0f271aab78
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 <am@adiumx.com>
parents:
17815
diff
changeset
|
1714 | } |
| 15198 | 1715 | g_free(js->server_name); |
|
22155
7c2034388bdb
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 <am@adiumx.com>
parents:
22133
diff
changeset
|
1716 | g_free(js->certificate_CN); |
| 15225 | 1717 | g_free(js->gmail_last_time); |
| 1718 | g_free(js->gmail_last_tid); | |
|
21688
a16385b34219
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 <datallah@pidgin.im>
parents:
21668
diff
changeset
|
1719 | g_free(js->old_msg); |
|
a16385b34219
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 <datallah@pidgin.im>
parents:
21668
diff
changeset
|
1720 | g_free(js->old_avatarhash); |
|
a16385b34219
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 <datallah@pidgin.im>
parents:
21668
diff
changeset
|
1721 | g_free(js->old_artist); |
|
a16385b34219
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 <datallah@pidgin.im>
parents:
21668
diff
changeset
|
1722 | g_free(js->old_title); |
|
a16385b34219
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 <datallah@pidgin.im>
parents:
21668
diff
changeset
|
1723 | g_free(js->old_source); |
|
a16385b34219
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 <datallah@pidgin.im>
parents:
21668
diff
changeset
|
1724 | g_free(js->old_uri); |
|
a16385b34219
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 <datallah@pidgin.im>
parents:
21668
diff
changeset
|
1725 | g_free(js->old_track); |
|
a16385b34219
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 <datallah@pidgin.im>
parents:
21668
diff
changeset
|
1726 | |
|
28046
8b6fcc2c95b3
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <darkrain42@pidgin.im>
parents:
27924
diff
changeset
|
1727 | if (js->vcard_timer != 0) |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
38358
diff
changeset
|
1728 | g_source_remove(js->vcard_timer); |
|
28046
8b6fcc2c95b3
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <darkrain42@pidgin.im>
parents:
27924
diff
changeset
|
1729 | |
|
27304
b2dc447b8c0b
The XMPP keepalive timeout handle needs to be a guint.
Paul Aurich <darkrain42@pidgin.im>
parents:
27293
diff
changeset
|
1730 | if (js->keepalive_timeout != 0) |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
38358
diff
changeset
|
1731 | g_source_remove(js->keepalive_timeout); |
|
30056
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
1732 | if (js->inactivity_timer != 0) |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
38358
diff
changeset
|
1733 | g_source_remove(js->inactivity_timer); |
|
35044
8060985edd4a
Moved conn_close_timeout to JabberStream
Ankit Vani <a@nevitus.org>
parents:
35005
diff
changeset
|
1734 | if (js->conn_close_timeout != 0) |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
38358
diff
changeset
|
1735 | g_source_remove(js->conn_close_timeout); |
|
23910
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
1736 | |
|
37457
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
1737 | g_cancellable_cancel(js->cancellable); |
|
0b957b80c46a
This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents:
37384
diff
changeset
|
1738 | g_object_unref(G_OBJECT(js->cancellable)); |
|
23910
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
1739 | |
|
26286
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26269
diff
changeset
|
1740 | g_free(js->stun_ip); |
|
27155
53502d71efdd
Remove trailing whitespace that has snuck in.
Paul Aurich <darkrain42@pidgin.im>
parents:
27143
diff
changeset
|
1741 | |
|
28445
c3dbe0b64f44
Some unfinished code to take advantage of Google's relays
Marcus Lundblad <malu@pidgin.im>
parents:
28379
diff
changeset
|
1742 | /* remove Google relay-related stuff */ |
|
c3dbe0b64f44
Some unfinished code to take advantage of Google's relays
Marcus Lundblad <malu@pidgin.im>
parents:
28379
diff
changeset
|
1743 | g_free(js->google_relay_token); |
|
c3dbe0b64f44
Some unfinished code to take advantage of Google's relays
Marcus Lundblad <malu@pidgin.im>
parents:
28379
diff
changeset
|
1744 | g_free(js->google_relay_host); |
|
c3dbe0b64f44
Some unfinished code to take advantage of Google's relays
Marcus Lundblad <malu@pidgin.im>
parents:
28379
diff
changeset
|
1745 | |
|
23911
f54fe603e84a
Fix a stupid mistake in the previous commit.
Daniel Atallah <datallah@pidgin.im>
parents:
23910
diff
changeset
|
1746 | g_free(js); |
|
f54fe603e84a
Fix a stupid mistake in the previous commit.
Daniel Atallah <datallah@pidgin.im>
parents:
23910
diff
changeset
|
1747 | |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
1748 | purple_connection_set_protocol_data(gc, NULL); |
| 5093 | 1749 | } |
| 1750 | ||
| 7014 | 1751 | void jabber_stream_set_state(JabberStream *js, JabberStreamState state) |
|
3105
8c23b0ec1036
[gaim-migrate @ 3119]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3074
diff
changeset
|
1752 | { |
|
28623
4f7f9d7bb23d
jabber: Re-arrange the code that detects legacy servers so that we don't stomp over "Host Unknown" errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
28610
diff
changeset
|
1753 | #define JABBER_CONNECT_STEPS ((js->gsc || js->state == JABBER_STREAM_INITIALIZING_ENCRYPTION) ? 9 : 5) |
|
4f7f9d7bb23d
jabber: Re-arrange the code that detects legacy servers so that we don't stomp over "Host Unknown" errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
28610
diff
changeset
|
1754 | |
| 7014 | 1755 | js->state = state; |
| 1756 | switch(state) { | |
| 1757 | case JABBER_STREAM_OFFLINE: | |
| 1758 | break; | |
| 1759 | case JABBER_STREAM_CONNECTING: | |
| 15884 | 1760 | purple_connection_update_progress(js->gc, _("Connecting"), 1, |
| 7014 | 1761 | JABBER_CONNECT_STEPS); |
| 1762 | break; | |
| 1763 | case JABBER_STREAM_INITIALIZING: | |
| 15884 | 1764 | purple_connection_update_progress(js->gc, _("Initializing Stream"), |
| 7014 | 1765 | js->gsc ? 5 : 2, JABBER_CONNECT_STEPS); |
| 1766 | jabber_stream_init(js); | |
| 1767 | break; | |
|
17813
c5cc8ebf62c0
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 <am@adiumx.com>
parents:
17810
diff
changeset
|
1768 | case JABBER_STREAM_INITIALIZING_ENCRYPTION: |
|
c5cc8ebf62c0
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 <am@adiumx.com>
parents:
17810
diff
changeset
|
1769 | purple_connection_update_progress(js->gc, _("Initializing SSL/TLS"), |
|
c5cc8ebf62c0
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 <am@adiumx.com>
parents:
17810
diff
changeset
|
1770 | 6, JABBER_CONNECT_STEPS); |
|
c5cc8ebf62c0
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 <am@adiumx.com>
parents:
17810
diff
changeset
|
1771 | break; |
| 7014 | 1772 | case JABBER_STREAM_AUTHENTICATING: |
| 15884 | 1773 | purple_connection_update_progress(js->gc, _("Authenticating"), |
|
17813
c5cc8ebf62c0
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 <am@adiumx.com>
parents:
17810
diff
changeset
|
1774 | js->gsc ? 7 : 3, JABBER_CONNECT_STEPS); |
| 7014 | 1775 | break; |
|
28379
df144a809a92
jabber: Fix using BOSH and legacy auth together. Closes #9990.
Paul Aurich <darkrain42@pidgin.im>
parents:
28322
diff
changeset
|
1776 | case JABBER_STREAM_POST_AUTH: |
| 15884 | 1777 | purple_connection_update_progress(js->gc, _("Re-initializing Stream"), |
|
17813
c5cc8ebf62c0
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 <am@adiumx.com>
parents:
17810
diff
changeset
|
1778 | (js->gsc ? 8 : 4), JABBER_CONNECT_STEPS); |
|
16847
cd87fc9c6856
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:
16799
diff
changeset
|
1779 | |
| 7014 | 1780 | break; |
| 1781 | case JABBER_STREAM_CONNECTED: | |
|
27278
b34a1cea4872
Use js->state to track whether the roster has been retrieved.
Paul Aurich <darkrain42@pidgin.im>
parents:
27231
diff
changeset
|
1782 | /* Send initial presence */ |
|
b34a1cea4872
Use js->state to track whether the roster has been retrieved.
Paul Aurich <darkrain42@pidgin.im>
parents:
27231
diff
changeset
|
1783 | jabber_presence_send(js, TRUE); |
|
30056
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
1784 | /* Start up the inactivity timer */ |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
1785 | jabber_stream_restart_inactivity_timer(js); |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
1786 | |
|
34746
dc9c911dbd35
Started GObjectification of PurpleConnection.
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
1787 | purple_connection_set_state(js->gc, PURPLE_CONNECTION_CONNECTED); |
| 7014 | 1788 | break; |
|
3105
8c23b0ec1036
[gaim-migrate @ 3119]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3074
diff
changeset
|
1789 | } |
|
28623
4f7f9d7bb23d
jabber: Re-arrange the code that detects legacy servers so that we don't stomp over "Host Unknown" errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
28610
diff
changeset
|
1790 | |
|
4f7f9d7bb23d
jabber: Re-arrange the code that detects legacy servers so that we don't stomp over "Host Unknown" errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
28610
diff
changeset
|
1791 | #undef JABBER_CONNECT_STEPS |
|
3105
8c23b0ec1036
[gaim-migrate @ 3119]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3074
diff
changeset
|
1792 | } |
|
8c23b0ec1036
[gaim-migrate @ 3119]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3074
diff
changeset
|
1793 | |
| 7014 | 1794 | char *jabber_get_next_id(JabberStream *js) |
| 2086 | 1795 | { |
| 15884 | 1796 | return g_strdup_printf("purple%x", js->next_id++); |
| 2086 | 1797 | } |
| 1798 | ||
|
14453
1cc75906700c
[gaim-migrate @ 17098]
Mark Doliner <markdoliner@pidgin.im>
parents:
14375
diff
changeset
|
1799 | |
|
16302
eb633ebf84f2
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@pidgin.im>
parents:
16180
diff
changeset
|
1800 | void jabber_idle_set(PurpleConnection *gc, int idle) |
|
3340
7e59a209931d
[gaim-migrate @ 3359]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3337
diff
changeset
|
1801 | { |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
1802 | JabberStream *js = purple_connection_get_protocol_data(gc); |
|
3340
7e59a209931d
[gaim-migrate @ 3359]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3337
diff
changeset
|
1803 | |
| 7014 | 1804 | js->idle = idle ? time(NULL) - idle : idle; |
|
26946
d33862e3c96f
propagate from branch 'im.pidgin.pidgin' (head a495982a23a92e75616731c8f41a2b007670d0da)
Paul Aurich <darkrain42@pidgin.im>
diff
changeset
|
1805 | |
|
24676
27ea4d447838
A first stab at supporting the upcoming new use-case in XMPP XEP-0012
Marcus Lundblad <malu@pidgin.im>
parents:
24430
diff
changeset
|
1806 | /* send out an updated prescence */ |
|
27ea4d447838
A first stab at supporting the upcoming new use-case in XMPP XEP-0012
Marcus Lundblad <malu@pidgin.im>
parents:
24430
diff
changeset
|
1807 | purple_debug_info("jabber", "sending updated presence for idle\n"); |
| 26959 | 1808 | jabber_presence_send(js, FALSE); |
|
3314
12fa45677717
[gaim-migrate @ 3332]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3311
diff
changeset
|
1809 | } |
|
12fa45677717
[gaim-migrate @ 3332]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3311
diff
changeset
|
1810 | |
|
27175
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1811 | void jabber_blocklist_parse_push(JabberStream *js, const char *from, |
|
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1812 | JabberIqType type, const char *id, |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1813 | PurpleXmlNode *child) |
|
27175
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1814 | { |
|
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1815 | JabberIq *result; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1816 | PurpleXmlNode *item; |
|
27175
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1817 | PurpleAccount *account; |
|
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1818 | gboolean is_block; |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34529
diff
changeset
|
1819 | GSList *deny; |
|
27175
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1820 | |
|
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1821 | if (!jabber_is_own_account(js, from)) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1822 | PurpleXmlNode *error, *x; |
|
27175
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1823 | result = jabber_iq_new(js, JABBER_IQ_ERROR); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1824 | purple_xmlnode_set_attrib(result->node, "id", id); |
|
27182
641a77b2ee97
No, I had that right the first time; if it's not our account, then there *is* a from and we need to route the IQ to the proper place.
Paul Aurich <darkrain42@pidgin.im>
parents:
27181
diff
changeset
|
1825 | if (from) |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1826 | purple_xmlnode_set_attrib(result->node, "to", from); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1827 | |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1828 | error = purple_xmlnode_new_child(result->node, "error"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1829 | purple_xmlnode_set_attrib(error, "type", "cancel"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1830 | x = purple_xmlnode_new_child(error, "not-allowed"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1831 | purple_xmlnode_set_namespace(x, NS_XMPP_STANZAS); |
|
27175
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1832 | |
|
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1833 | jabber_iq_send(result); |
|
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1834 | return; |
|
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1835 | } |
|
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1836 | |
|
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1837 | account = purple_connection_get_account(js->gc); |
|
38256
035f00c4fd87
Replace misused g_str_equal() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38091
diff
changeset
|
1838 | is_block = purple_strequal(child->name, "block"); |
|
27175
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1839 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1840 | item = purple_xmlnode_get_child(child, "item"); |
|
27175
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1841 | if (!is_block && item == NULL) { |
|
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1842 | /* Unblock everyone */ |
|
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1843 | purple_debug_info("jabber", "Received unblock push. Unblocking everyone.\n"); |
|
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1844 | |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34529
diff
changeset
|
1845 | while ((deny = purple_account_privacy_get_denied(account)) != NULL) { |
|
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34529
diff
changeset
|
1846 | purple_account_privacy_deny_remove(account, deny->data, TRUE); |
|
27175
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1847 | } |
|
27181
1a3c15400f3e
Avoid an assertion failure and add an error case.
Paul Aurich <darkrain42@pidgin.im>
parents:
27176
diff
changeset
|
1848 | } else if (item == NULL) { |
|
1a3c15400f3e
Avoid an assertion failure and add an error case.
Paul Aurich <darkrain42@pidgin.im>
parents:
27176
diff
changeset
|
1849 | /* An empty <block/> is bogus */ |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1850 | PurpleXmlNode *error, *x; |
|
27181
1a3c15400f3e
Avoid an assertion failure and add an error case.
Paul Aurich <darkrain42@pidgin.im>
parents:
27176
diff
changeset
|
1851 | result = jabber_iq_new(js, JABBER_IQ_ERROR); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1852 | purple_xmlnode_set_attrib(result->node, "id", id); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1853 | |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1854 | error = purple_xmlnode_new_child(result->node, "error"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1855 | purple_xmlnode_set_attrib(error, "type", "modify"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1856 | x = purple_xmlnode_new_child(error, "bad-request"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1857 | purple_xmlnode_set_namespace(x, NS_XMPP_STANZAS); |
|
27181
1a3c15400f3e
Avoid an assertion failure and add an error case.
Paul Aurich <darkrain42@pidgin.im>
parents:
27176
diff
changeset
|
1858 | |
|
1a3c15400f3e
Avoid an assertion failure and add an error case.
Paul Aurich <darkrain42@pidgin.im>
parents:
27176
diff
changeset
|
1859 | jabber_iq_send(result); |
|
1a3c15400f3e
Avoid an assertion failure and add an error case.
Paul Aurich <darkrain42@pidgin.im>
parents:
27176
diff
changeset
|
1860 | return; |
|
27175
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1861 | } else { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1862 | for ( ; item; item = purple_xmlnode_get_next_twin(item)) { |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1863 | const char *jid = purple_xmlnode_get_attrib(item, "jid"); |
|
27175
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1864 | if (jid == NULL || *jid == '\0') |
|
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1865 | continue; |
|
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1866 | |
|
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1867 | if (is_block) |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34529
diff
changeset
|
1868 | purple_account_privacy_deny_add(account, jid, TRUE); |
|
27175
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1869 | else |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34529
diff
changeset
|
1870 | purple_account_privacy_deny_remove(account, jid, TRUE); |
|
27175
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1871 | } |
|
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1872 | } |
|
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1873 | |
|
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1874 | result = jabber_iq_new(js, JABBER_IQ_RESULT); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1875 | purple_xmlnode_set_attrib(result->node, "id", id); |
|
27175
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1876 | jabber_iq_send(result); |
|
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1877 | } |
|
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1878 | |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26686
diff
changeset
|
1879 | static void jabber_blocklist_parse(JabberStream *js, const char *from, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26686
diff
changeset
|
1880 | JabberIqType type, const char *id, |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1881 | PurpleXmlNode *packet, gpointer data) |
|
25290
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1882 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1883 | PurpleXmlNode *blocklist, *item; |
|
25290
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1884 | PurpleAccount *account; |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34529
diff
changeset
|
1885 | GSList *deny; |
|
25290
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1886 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1887 | blocklist = purple_xmlnode_get_child_with_namespace(packet, |
|
28984
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28982
diff
changeset
|
1888 | "blocklist", NS_SIMPLE_BLOCKING); |
|
25290
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1889 | account = purple_connection_get_account(js->gc); |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1890 | |
|
27176
0af9ce7c0694
The server list is definitive for who is blocked.
Paul Aurich <darkrain42@pidgin.im>
parents:
27175
diff
changeset
|
1891 | if (type == JABBER_IQ_ERROR || blocklist == NULL) |
|
25290
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1892 | return; |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1893 | |
|
27175
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1894 | /* This is the only privacy method supported by XEP-0191 */ |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34529
diff
changeset
|
1895 | purple_account_set_privacy_type(account, PURPLE_ACCOUNT_PRIVACY_DENY_USERS); |
|
27175
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1896 | |
|
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1897 | /* |
|
27176
0af9ce7c0694
The server list is definitive for who is blocked.
Paul Aurich <darkrain42@pidgin.im>
parents:
27175
diff
changeset
|
1898 | * TODO: When account->deny is something more than a hash table, this can |
|
0af9ce7c0694
The server list is definitive for who is blocked.
Paul Aurich <darkrain42@pidgin.im>
parents:
27175
diff
changeset
|
1899 | * be re-written to find the set intersection and difference. |
|
27175
e027ae421bf3
Support pushed notifications about XEP-0191 Blocks/Unblocks. Closes #8045.
Paul Aurich <darkrain42@pidgin.im>
parents:
27156
diff
changeset
|
1900 | */ |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34529
diff
changeset
|
1901 | while ((deny = purple_account_privacy_get_denied(account))) |
|
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34529
diff
changeset
|
1902 | purple_account_privacy_deny_remove(account, deny->data, TRUE); |
|
27176
0af9ce7c0694
The server list is definitive for who is blocked.
Paul Aurich <darkrain42@pidgin.im>
parents:
27175
diff
changeset
|
1903 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1904 | item = purple_xmlnode_get_child(blocklist, "item"); |
|
25290
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1905 | while (item != NULL) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1906 | const char *jid = purple_xmlnode_get_attrib(item, "jid"); |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34529
diff
changeset
|
1907 | purple_account_privacy_deny_add(account, jid, TRUE); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1908 | item = purple_xmlnode_get_next_twin(item); |
|
25290
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1909 | } |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1910 | } |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1911 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1912 | void jabber_request_block_list(JabberStream *js) |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1913 | { |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1914 | JabberIq *iq; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1915 | PurpleXmlNode *blocklist; |
|
25290
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1916 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1917 | iq = jabber_iq_new(js, JABBER_IQ_GET); |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1918 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1919 | blocklist = purple_xmlnode_new_child(iq->node, "blocklist"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1920 | purple_xmlnode_set_namespace(blocklist, NS_SIMPLE_BLOCKING); |
|
25290
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1921 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1922 | jabber_iq_set_callback(iq, jabber_blocklist_parse, NULL); |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1923 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1924 | jabber_iq_send(iq); |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1925 | } |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1926 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1927 | void jabber_add_deny(PurpleConnection *gc, const char *who) |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1928 | { |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1929 | JabberStream *js; |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1930 | JabberIq *iq; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1931 | PurpleXmlNode *block, *item; |
|
25290
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1932 | |
|
29094
1d72af8f11dd
jabber: Clean up this code a little.
Paul Aurich <darkrain42@pidgin.im>
parents:
29085
diff
changeset
|
1933 | g_return_if_fail(who != NULL && *who != '\0'); |
|
1d72af8f11dd
jabber: Clean up this code a little.
Paul Aurich <darkrain42@pidgin.im>
parents:
29085
diff
changeset
|
1934 | |
|
1d72af8f11dd
jabber: Clean up this code a little.
Paul Aurich <darkrain42@pidgin.im>
parents:
29085
diff
changeset
|
1935 | js = purple_connection_get_protocol_data(gc); |
|
25290
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1936 | if (js == NULL) |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1937 | return; |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1938 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1939 | if (js->server_caps & JABBER_CAP_GOOGLE_ROSTER) |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1940 | { |
|
29094
1d72af8f11dd
jabber: Clean up this code a little.
Paul Aurich <darkrain42@pidgin.im>
parents:
29085
diff
changeset
|
1941 | jabber_google_roster_add_deny(js, who); |
|
25290
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1942 | return; |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1943 | } |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1944 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1945 | if (!(js->server_caps & JABBER_CAP_BLOCKING)) |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1946 | { |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1947 | purple_notify_error(NULL, _("Server doesn't support blocking"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
1948 | _("Server doesn't support blocking"), NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
1949 | purple_request_cpar_from_connection(gc)); |
|
25290
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1950 | return; |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1951 | } |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1952 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1953 | iq = jabber_iq_new(js, JABBER_IQ_SET); |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1954 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1955 | block = purple_xmlnode_new_child(iq->node, "block"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1956 | purple_xmlnode_set_namespace(block, NS_SIMPLE_BLOCKING); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1957 | |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1958 | item = purple_xmlnode_new_child(block, "item"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1959 | purple_xmlnode_set_attrib(item, "jid", who); |
|
25290
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1960 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1961 | jabber_iq_send(iq); |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1962 | } |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1963 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1964 | void jabber_rem_deny(PurpleConnection *gc, const char *who) |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1965 | { |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1966 | JabberStream *js; |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1967 | JabberIq *iq; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1968 | PurpleXmlNode *unblock, *item; |
|
25290
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1969 | |
|
29094
1d72af8f11dd
jabber: Clean up this code a little.
Paul Aurich <darkrain42@pidgin.im>
parents:
29085
diff
changeset
|
1970 | g_return_if_fail(who != NULL && *who != '\0'); |
|
1d72af8f11dd
jabber: Clean up this code a little.
Paul Aurich <darkrain42@pidgin.im>
parents:
29085
diff
changeset
|
1971 | |
|
1d72af8f11dd
jabber: Clean up this code a little.
Paul Aurich <darkrain42@pidgin.im>
parents:
29085
diff
changeset
|
1972 | js = purple_connection_get_protocol_data(gc); |
|
25290
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1973 | if (js == NULL) |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1974 | return; |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1975 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1976 | if (js->server_caps & JABBER_CAP_GOOGLE_ROSTER) |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1977 | { |
|
29094
1d72af8f11dd
jabber: Clean up this code a little.
Paul Aurich <darkrain42@pidgin.im>
parents:
29085
diff
changeset
|
1978 | jabber_google_roster_rem_deny(js, who); |
|
25290
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1979 | return; |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1980 | } |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1981 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1982 | if (!(js->server_caps & JABBER_CAP_BLOCKING)) |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1983 | return; |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1984 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1985 | iq = jabber_iq_new(js, JABBER_IQ_SET); |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1986 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1987 | unblock = purple_xmlnode_new_child(iq->node, "unblock"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1988 | purple_xmlnode_set_namespace(unblock, NS_SIMPLE_BLOCKING); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1989 | |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1990 | item = purple_xmlnode_new_child(unblock, "item"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1991 | purple_xmlnode_set_attrib(item, "jid", who); |
|
25290
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1992 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1993 | jabber_iq_send(iq); |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1994 | } |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1995 | |
|
23586
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23428
diff
changeset
|
1996 | void jabber_add_feature(const char *namespace, JabberFeatureEnabled cb) { |
|
17783
2687df1ca202
PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <am@adiumx.com>
parents:
17782
diff
changeset
|
1997 | JabberFeature *feat; |
|
19994
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1998 | |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1999 | g_return_if_fail(namespace != NULL); |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
2000 | |
|
17783
2687df1ca202
PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <am@adiumx.com>
parents:
17782
diff
changeset
|
2001 | feat = g_new0(JabberFeature,1); |
|
17779
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
2002 | feat->namespace = g_strdup(namespace); |
|
17783
2687df1ca202
PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <am@adiumx.com>
parents:
17782
diff
changeset
|
2003 | feat->is_enabled = cb; |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
2004 | |
|
17779
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
2005 | /* try to remove just in case it already exists in the list */ |
|
23586
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23428
diff
changeset
|
2006 | jabber_remove_feature(namespace); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
2007 | |
|
17779
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
2008 | jabber_features = g_list_append(jabber_features, feat); |
|
17770
e67998927a3c
Added the ability to define extensions to caps
Andreas Monitzer <am@adiumx.com>
parents:
17769
diff
changeset
|
2009 | } |
|
e67998927a3c
Added the ability to define extensions to caps
Andreas Monitzer <am@adiumx.com>
parents:
17769
diff
changeset
|
2010 | |
|
23586
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23428
diff
changeset
|
2011 | void jabber_remove_feature(const char *namespace) { |
|
17779
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
2012 | GList *feature; |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
2013 | for(feature = jabber_features; feature; feature = feature->next) { |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
2014 | JabberFeature *feat = (JabberFeature*)feature->data; |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
2015 | if(purple_strequal(feat->namespace, namespace)) { |
|
17779
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
2016 | g_free(feat->namespace); |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
2017 | g_free(feature->data); |
| 21623 | 2018 | jabber_features = g_list_delete_link(jabber_features, feature); |
|
17779
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
2019 | break; |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
2020 | } |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
2021 | } |
|
17770
e67998927a3c
Added the ability to define extensions to caps
Andreas Monitzer <am@adiumx.com>
parents:
17769
diff
changeset
|
2022 | } |
|
e67998927a3c
Added the ability to define extensions to caps
Andreas Monitzer <am@adiumx.com>
parents:
17769
diff
changeset
|
2023 | |
|
24737
b8a96a07e7ac
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <darkrain42@pidgin.im>
parents:
24735
diff
changeset
|
2024 | static void jabber_features_destroy(void) |
|
b8a96a07e7ac
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <darkrain42@pidgin.im>
parents:
24735
diff
changeset
|
2025 | { |
|
b8a96a07e7ac
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <darkrain42@pidgin.im>
parents:
24735
diff
changeset
|
2026 | while (jabber_features) { |
|
b8a96a07e7ac
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <darkrain42@pidgin.im>
parents:
24735
diff
changeset
|
2027 | JabberFeature *feature = jabber_features->data; |
|
b8a96a07e7ac
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <darkrain42@pidgin.im>
parents:
24735
diff
changeset
|
2028 | g_free(feature->namespace); |
|
b8a96a07e7ac
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <darkrain42@pidgin.im>
parents:
24735
diff
changeset
|
2029 | g_free(feature); |
|
28760
a7129c0e7108
jabber: Oops. --leaks.
Paul Aurich <darkrain42@pidgin.im>
parents:
28734
diff
changeset
|
2030 | jabber_features = g_list_delete_link(jabber_features, jabber_features); |
|
24737
b8a96a07e7ac
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <darkrain42@pidgin.im>
parents:
24735
diff
changeset
|
2031 | } |
|
b8a96a07e7ac
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <darkrain42@pidgin.im>
parents:
24735
diff
changeset
|
2032 | } |
|
b8a96a07e7ac
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <darkrain42@pidgin.im>
parents:
24735
diff
changeset
|
2033 | |
|
30512
f0f51b3a3f30
jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents:
30474
diff
changeset
|
2034 | gint |
|
f0f51b3a3f30
jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents:
30474
diff
changeset
|
2035 | jabber_identity_compare(gconstpointer a, gconstpointer b) |
|
f0f51b3a3f30
jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents:
30474
diff
changeset
|
2036 | { |
|
f0f51b3a3f30
jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents:
30474
diff
changeset
|
2037 | const JabberIdentity *ac; |
|
f0f51b3a3f30
jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents:
30474
diff
changeset
|
2038 | const JabberIdentity *bc; |
|
f0f51b3a3f30
jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents:
30474
diff
changeset
|
2039 | gint cat_cmp; |
|
f0f51b3a3f30
jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents:
30474
diff
changeset
|
2040 | gint typ_cmp; |
|
f0f51b3a3f30
jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents:
30474
diff
changeset
|
2041 | |
|
f0f51b3a3f30
jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents:
30474
diff
changeset
|
2042 | ac = a; |
|
f0f51b3a3f30
jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents:
30474
diff
changeset
|
2043 | bc = b; |
|
f0f51b3a3f30
jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents:
30474
diff
changeset
|
2044 | |
|
38269
83eefc3f8a65
Replace strcmp() with null safe g_strcmp0()
qarkai <qarkai@gmail.com>
parents:
38261
diff
changeset
|
2045 | cat_cmp = g_strcmp0(ac->category, bc->category); |
|
38261
653645acccc8
Use g_strcmp0() for code simplification
qarkai <qarkai@gmail.com>
parents:
38260
diff
changeset
|
2046 | if (cat_cmp != 0) { |
|
30512
f0f51b3a3f30
jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents:
30474
diff
changeset
|
2047 | return cat_cmp; |
|
f0f51b3a3f30
jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents:
30474
diff
changeset
|
2048 | } |
|
38261
653645acccc8
Use g_strcmp0() for code simplification
qarkai <qarkai@gmail.com>
parents:
38260
diff
changeset
|
2049 | |
|
38269
83eefc3f8a65
Replace strcmp() with null safe g_strcmp0()
qarkai <qarkai@gmail.com>
parents:
38261
diff
changeset
|
2050 | typ_cmp = g_strcmp0(ac->type, bc->type); |
|
38261
653645acccc8
Use g_strcmp0() for code simplification
qarkai <qarkai@gmail.com>
parents:
38260
diff
changeset
|
2051 | if (typ_cmp != 0) { |
|
653645acccc8
Use g_strcmp0() for code simplification
qarkai <qarkai@gmail.com>
parents:
38260
diff
changeset
|
2052 | return typ_cmp; |
|
653645acccc8
Use g_strcmp0() for code simplification
qarkai <qarkai@gmail.com>
parents:
38260
diff
changeset
|
2053 | } |
|
653645acccc8
Use g_strcmp0() for code simplification
qarkai <qarkai@gmail.com>
parents:
38260
diff
changeset
|
2054 | |
|
653645acccc8
Use g_strcmp0() for code simplification
qarkai <qarkai@gmail.com>
parents:
38260
diff
changeset
|
2055 | return g_strcmp0(ac->lang, bc->lang); |
|
30512
f0f51b3a3f30
jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents:
30474
diff
changeset
|
2056 | } |
|
f0f51b3a3f30
jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents:
30474
diff
changeset
|
2057 | |
|
f0f51b3a3f30
jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents:
30474
diff
changeset
|
2058 | void jabber_add_identity(const gchar *category, const gchar *type, |
|
f0f51b3a3f30
jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents:
30474
diff
changeset
|
2059 | const gchar *lang, const gchar *name) |
|
f0f51b3a3f30
jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents:
30474
diff
changeset
|
2060 | { |
|
23586
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23428
diff
changeset
|
2061 | GList *identity; |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23428
diff
changeset
|
2062 | JabberIdentity *ident; |
|
30512
f0f51b3a3f30
jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents:
30474
diff
changeset
|
2063 | |
|
23586
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23428
diff
changeset
|
2064 | /* both required according to XEP-0030 */ |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23428
diff
changeset
|
2065 | g_return_if_fail(category != NULL); |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23428
diff
changeset
|
2066 | g_return_if_fail(type != NULL); |
|
27155
53502d71efdd
Remove trailing whitespace that has snuck in.
Paul Aurich <darkrain42@pidgin.im>
parents:
27143
diff
changeset
|
2067 | |
|
30512
f0f51b3a3f30
jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents:
30474
diff
changeset
|
2068 | /* Check if this identity is already there... */ |
|
f0f51b3a3f30
jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents:
30474
diff
changeset
|
2069 | for (identity = jabber_identities; identity; identity = identity->next) { |
|
f0f51b3a3f30
jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents:
30474
diff
changeset
|
2070 | JabberIdentity *id = identity->data; |
|
38256
035f00c4fd87
Replace misused g_str_equal() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38091
diff
changeset
|
2071 | if (purple_strequal(id->category, category) && |
|
035f00c4fd87
Replace misused g_str_equal() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38091
diff
changeset
|
2072 | purple_strequal(id->type, type) && |
|
30512
f0f51b3a3f30
jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents:
30474
diff
changeset
|
2073 | purple_strequal(id->lang, lang)) |
|
24734
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24721
diff
changeset
|
2074 | return; |
|
23586
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23428
diff
changeset
|
2075 | } |
|
24734
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24721
diff
changeset
|
2076 | |
|
23586
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23428
diff
changeset
|
2077 | ident = g_new0(JabberIdentity, 1); |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23428
diff
changeset
|
2078 | ident->category = g_strdup(category); |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23428
diff
changeset
|
2079 | ident->type = g_strdup(type); |
|
24734
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24721
diff
changeset
|
2080 | ident->lang = g_strdup(lang); |
|
23586
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23428
diff
changeset
|
2081 | ident->name = g_strdup(name); |
|
30512
f0f51b3a3f30
jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents:
30474
diff
changeset
|
2082 | jabber_identities = g_list_insert_sorted(jabber_identities, ident, |
|
f0f51b3a3f30
jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents:
30474
diff
changeset
|
2083 | jabber_identity_compare); |
|
23586
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23428
diff
changeset
|
2084 | } |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23428
diff
changeset
|
2085 | |
|
24737
b8a96a07e7ac
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <darkrain42@pidgin.im>
parents:
24735
diff
changeset
|
2086 | static void jabber_identities_destroy(void) |
|
b8a96a07e7ac
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <darkrain42@pidgin.im>
parents:
24735
diff
changeset
|
2087 | { |
|
b8a96a07e7ac
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <darkrain42@pidgin.im>
parents:
24735
diff
changeset
|
2088 | while (jabber_identities) { |
|
b8a96a07e7ac
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <darkrain42@pidgin.im>
parents:
24735
diff
changeset
|
2089 | JabberIdentity *id = jabber_identities->data; |
|
b8a96a07e7ac
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <darkrain42@pidgin.im>
parents:
24735
diff
changeset
|
2090 | g_free(id->category); |
|
b8a96a07e7ac
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <darkrain42@pidgin.im>
parents:
24735
diff
changeset
|
2091 | g_free(id->type); |
|
b8a96a07e7ac
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <darkrain42@pidgin.im>
parents:
24735
diff
changeset
|
2092 | g_free(id->lang); |
|
b8a96a07e7ac
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <darkrain42@pidgin.im>
parents:
24735
diff
changeset
|
2093 | g_free(id->name); |
|
b8a96a07e7ac
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <darkrain42@pidgin.im>
parents:
24735
diff
changeset
|
2094 | g_free(id); |
|
28760
a7129c0e7108
jabber: Oops. --leaks.
Paul Aurich <darkrain42@pidgin.im>
parents:
28734
diff
changeset
|
2095 | jabber_identities = g_list_delete_link(jabber_identities, jabber_identities); |
|
24737
b8a96a07e7ac
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <darkrain42@pidgin.im>
parents:
24735
diff
changeset
|
2096 | } |
|
b8a96a07e7ac
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <darkrain42@pidgin.im>
parents:
24735
diff
changeset
|
2097 | } |
|
b8a96a07e7ac
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <darkrain42@pidgin.im>
parents:
24735
diff
changeset
|
2098 | |
|
26533
5c74696c34d1
BOSH: For authentication purposes, HTTPS is equivalent to a secured JabberStream.
Paul Aurich <darkrain42@pidgin.im>
parents:
26531
diff
changeset
|
2099 | gboolean jabber_stream_is_ssl(JabberStream *js) |
|
5c74696c34d1
BOSH: For authentication purposes, HTTPS is equivalent to a secured JabberStream.
Paul Aurich <darkrain42@pidgin.im>
parents:
26531
diff
changeset
|
2100 | { |
|
5c74696c34d1
BOSH: For authentication purposes, HTTPS is equivalent to a secured JabberStream.
Paul Aurich <darkrain42@pidgin.im>
parents:
26531
diff
changeset
|
2101 | return (js->bosh && jabber_bosh_connection_is_ssl(js->bosh)) || |
|
5c74696c34d1
BOSH: For authentication purposes, HTTPS is equivalent to a secured JabberStream.
Paul Aurich <darkrain42@pidgin.im>
parents:
26531
diff
changeset
|
2102 | (!js->bosh && js->gsc); |
|
5c74696c34d1
BOSH: For authentication purposes, HTTPS is equivalent to a secured JabberStream.
Paul Aurich <darkrain42@pidgin.im>
parents:
26531
diff
changeset
|
2103 | } |
|
5c74696c34d1
BOSH: For authentication purposes, HTTPS is equivalent to a secured JabberStream.
Paul Aurich <darkrain42@pidgin.im>
parents:
26531
diff
changeset
|
2104 | |
|
30056
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2105 | static gboolean |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2106 | inactivity_cb(gpointer data) |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2107 | { |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2108 | JabberStream *js = data; |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2109 | |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2110 | /* We want whatever is sent to set this. It's okay because |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2111 | * the eventloop unsets it via the return FALSE. |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2112 | */ |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2113 | js->inactivity_timer = 0; |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2114 | |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2115 | if (js->bosh) |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2116 | jabber_bosh_connection_send_keepalive(js->bosh); |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2117 | else |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2118 | jabber_send_raw(js, "\t", 1); |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2119 | |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2120 | return FALSE; |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2121 | } |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2122 | |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2123 | void jabber_stream_restart_inactivity_timer(JabberStream *js) |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2124 | { |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2125 | if (js->inactivity_timer != 0) { |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
38358
diff
changeset
|
2126 | g_source_remove(js->inactivity_timer); |
|
30056
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2127 | js->inactivity_timer = 0; |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2128 | } |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2129 | |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2130 | g_return_if_fail(js->max_inactivity > 0); |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2131 | |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2132 | js->inactivity_timer = |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
38358
diff
changeset
|
2133 | g_timeout_add_seconds(js->max_inactivity, |
|
30056
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2134 | inactivity_cb, js); |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2135 | } |
|
24dcb476e62b
jabber: Send whitespace keepalives every two minutes of (outgoing) silence.
Paul Aurich <darkrain42@pidgin.im>
parents:
30036
diff
changeset
|
2136 | |
|
16302
eb633ebf84f2
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@pidgin.im>
parents:
16180
diff
changeset
|
2137 | const char *jabber_list_icon(PurpleAccount *a, PurpleBuddy *b) |
| 2086 | 2138 | { |
| 4687 | 2139 | return "jabber"; |
| 2140 | } | |
| 4916 | 2141 | |
|
16302
eb633ebf84f2
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@pidgin.im>
parents:
16180
diff
changeset
|
2142 | const char* jabber_list_emblem(PurpleBuddy *b) |
| 4916 | 2143 | { |
| 7014 | 2144 | JabberStream *js; |
|
13486
4ea1a712aaa3
[gaim-migrate @ 15861]
Daniel Atallah <datallah@pidgin.im>
parents:
13385
diff
changeset
|
2145 | JabberBuddy *jb = NULL; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
2146 | PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(b)); |
| 7014 | 2147 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
2148 | if(!gc) |
|
15558
6fb7a0ad8a0b
clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents:
15524
diff
changeset
|
2149 | return NULL; |
|
6fb7a0ad8a0b
clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents:
15524
diff
changeset
|
2150 | |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2151 | js = purple_connection_get_protocol_data(gc); |
|
13486
4ea1a712aaa3
[gaim-migrate @ 15861]
Daniel Atallah <datallah@pidgin.im>
parents:
13385
diff
changeset
|
2152 | if(js) |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
2153 | jb = jabber_buddy_find(js, purple_buddy_get_name(b), FALSE); |
| 5135 | 2154 | |
| 15884 | 2155 | if(!PURPLE_BUDDY_IS_ONLINE(b)) { |
| 7014 | 2156 | if(jb && (jb->subscription & JABBER_SUB_PENDING || |
| 2157 | !(jb->subscription & JABBER_SUB_TO))) | |
| 15524 | 2158 | return "not-authorized"; |
| 2086 | 2159 | } |
|
27292
1e8a952548f9
Whitespace + a change cluttering up the diff with im.pidgin.pidgin
Paul Aurich <darkrain42@pidgin.im>
parents:
27291
diff
changeset
|
2160 | |
|
25577
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25573
diff
changeset
|
2161 | if (jb) { |
|
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25573
diff
changeset
|
2162 | JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, NULL); |
|
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25573
diff
changeset
|
2163 | if (jbr) { |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
31128
diff
changeset
|
2164 | const gchar *client_type = |
|
25577
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25573
diff
changeset
|
2165 | jabber_resource_get_identity_category_type(jbr, "client"); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
31128
diff
changeset
|
2166 | |
|
25577
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25573
diff
changeset
|
2167 | if (client_type) { |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
2168 | if (purple_strequal(client_type, "phone")) { |
|
25577
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25573
diff
changeset
|
2169 | return "mobile"; |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
2170 | } else if (purple_strequal(client_type, "web")) { |
|
25577
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25573
diff
changeset
|
2171 | return "external"; |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
2172 | } else if (purple_strequal(client_type, "handheld")) { |
|
25577
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25573
diff
changeset
|
2173 | return "hiptop"; |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
2174 | } else if (purple_strequal(client_type, "bot")) { |
|
25577
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25573
diff
changeset
|
2175 | return "bot"; |
|
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25573
diff
changeset
|
2176 | } |
|
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25573
diff
changeset
|
2177 | /* the default value "pc" falls through and has no emblem */ |
|
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25573
diff
changeset
|
2178 | } |
|
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25573
diff
changeset
|
2179 | } |
|
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25573
diff
changeset
|
2180 | } |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
31128
diff
changeset
|
2181 | |
| 15524 | 2182 | return NULL; |
| 4916 | 2183 | } |
| 2086 | 2184 | |
|
16302
eb633ebf84f2
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@pidgin.im>
parents:
16180
diff
changeset
|
2185 | char *jabber_status_text(PurpleBuddy *b) |
|
2205
68c42ce8eba6
[gaim-migrate @ 2215]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2170
diff
changeset
|
2186 | { |
| 7014 | 2187 | char *ret = NULL; |
|
18310
dbc5240f6bf5
Fix a crash when you have an IM window open on a jabber account and the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18235
diff
changeset
|
2188 | JabberBuddy *jb = NULL; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
2189 | PurpleAccount *account = purple_buddy_get_account(b); |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
2190 | PurpleConnection *gc = purple_account_get_connection(account); |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
2191 | |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2192 | if (gc && purple_connection_get_protocol_data(gc)) |
|
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2193 | jb = jabber_buddy_find(purple_connection_get_protocol_data(gc), purple_buddy_get_name(b), FALSE); |
| 5234 | 2194 | |
| 15884 | 2195 | if(jb && !PURPLE_BUDDY_IS_ONLINE(b) && (jb->subscription & JABBER_SUB_PENDING || !(jb->subscription & JABBER_SUB_TO))) { |
| 7014 | 2196 | ret = g_strdup(_("Not Authorized")); |
| 15884 | 2197 | } else if(jb && !PURPLE_BUDDY_IS_ONLINE(b) && jb->error_msg) { |
| 7014 | 2198 | ret = g_strdup(jb->error_msg); |
| 2956 | 2199 | } else { |
|
26868
5c99daf94155
Retrieve status message to display in Buddy List from PurplePresence.
Paul Aurich <darkrain42@pidgin.im>
parents:
26860
diff
changeset
|
2200 | PurplePresence *presence = purple_buddy_get_presence(b); |
|
27775
b8569a76e02e
Don't pre-escape jbr->status. Almost every place required it in unescaped
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27697
diff
changeset
|
2201 | PurpleStatus *status = purple_presence_get_active_status(presence); |
|
27779
ad70fa8a4ae2
merge of 'fd813a8f4960b8769f6f6915d9f62df8b3992280'
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
2202 | const char *message; |
|
ad70fa8a4ae2
merge of 'fd813a8f4960b8769f6f6915d9f62df8b3992280'
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
2203 | |
|
ad70fa8a4ae2
merge of 'fd813a8f4960b8769f6f6915d9f62df8b3992280'
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
2204 | if((message = purple_status_get_attr_string(status, "message"))) { |
|
ad70fa8a4ae2
merge of 'fd813a8f4960b8769f6f6915d9f62df8b3992280'
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
2205 | ret = g_markup_escape_text(message, -1); |
|
ad70fa8a4ae2
merge of 'fd813a8f4960b8769f6f6915d9f62df8b3992280'
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
2206 | } else if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) { |
|
ad70fa8a4ae2
merge of 'fd813a8f4960b8769f6f6915d9f62df8b3992280'
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
2207 | PurpleStatus *status = purple_presence_get_status(presence, "tune"); |
|
ad70fa8a4ae2
merge of 'fd813a8f4960b8769f6f6915d9f62df8b3992280'
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
2208 | const char *title = purple_status_get_attr_string(status, PURPLE_TUNE_TITLE); |
|
ad70fa8a4ae2
merge of 'fd813a8f4960b8769f6f6915d9f62df8b3992280'
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
2209 | const char *artist = purple_status_get_attr_string(status, PURPLE_TUNE_ARTIST); |
|
ad70fa8a4ae2
merge of 'fd813a8f4960b8769f6f6915d9f62df8b3992280'
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
2210 | const char *album = purple_status_get_attr_string(status, PURPLE_TUNE_ALBUM); |
|
ad70fa8a4ae2
merge of 'fd813a8f4960b8769f6f6915d9f62df8b3992280'
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
2211 | ret = purple_util_format_song_info(title, artist, album, NULL); |
| 7014 | 2212 | } |
| 2086 | 2213 | } |
| 2214 | ||
| 7014 | 2215 | return ret; |
| 2956 | 2216 | } |
| 2217 | ||
|
25840
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2218 | static void |
|
27155
53502d71efdd
Remove trailing whitespace that has snuck in.
Paul Aurich <darkrain42@pidgin.im>
parents:
27143
diff
changeset
|
2219 | jabber_tooltip_add_resource_text(JabberBuddyResource *jbr, |
|
25840
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2220 | PurpleNotifyUserInfo *user_info, gboolean multiple_resources) |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2221 | { |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2222 | char *text = NULL; |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2223 | char *res = NULL; |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2224 | char *label, *value; |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2225 | const char *state; |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2226 | |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2227 | if(jbr->status) { |
|
27775
b8569a76e02e
Don't pre-escape jbr->status. Almost every place required it in unescaped
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27697
diff
changeset
|
2228 | text = g_markup_escape_text(jbr->status, -1); |
|
25840
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2229 | } |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2230 | |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2231 | if(jbr->name) |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2232 | res = g_strdup_printf(" (%s)", jbr->name); |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2233 | |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2234 | state = jabber_buddy_state_get_name(jbr->state); |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2235 | if (text != NULL && !purple_utf8_strcasecmp(state, text)) { |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2236 | g_free(text); |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2237 | text = NULL; |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2238 | } |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2239 | |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2240 | label = g_strdup_printf("%s%s", _("Status"), (res ? res : "")); |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2241 | value = g_strdup_printf("%s%s%s", state, (text ? ": " : ""), (text ? text : "")); |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2242 | |
|
32191
a4668d9dc8d1
Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents:
32162
diff
changeset
|
2243 | purple_notify_user_info_add_pair_html(user_info, label, value); |
|
25840
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2244 | g_free(label); |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2245 | g_free(value); |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2246 | g_free(text); |
|
27155
53502d71efdd
Remove trailing whitespace that has snuck in.
Paul Aurich <darkrain42@pidgin.im>
parents:
27143
diff
changeset
|
2247 | |
|
25840
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2248 | /* if the resource is idle, show that */ |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2249 | /* only show it if there is more than one resource available for |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2250 | the buddy, since the "general" idleness will be shown anyway, |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2251 | this way we can see see the idleness of lower-priority resources */ |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2252 | if (jbr->idle && multiple_resources) { |
|
27155
53502d71efdd
Remove trailing whitespace that has snuck in.
Paul Aurich <darkrain42@pidgin.im>
parents:
27143
diff
changeset
|
2253 | gchar *idle_str = |
|
25840
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2254 | purple_str_seconds_to_string(time(NULL) - jbr->idle); |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2255 | label = g_strdup_printf("%s%s", _("Idle"), (res ? res : "")); |
|
32162
cf848cd25330
Use purple_notify_user_info_add_pair_plaintext in some places where we
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
2256 | purple_notify_user_info_add_pair_plaintext(user_info, label, idle_str); |
|
25840
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2257 | g_free(idle_str); |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2258 | g_free(label); |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2259 | } |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2260 | g_free(res); |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2261 | } |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2262 | |
|
16302
eb633ebf84f2
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@pidgin.im>
parents:
16180
diff
changeset
|
2263 | void jabber_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) |
| 4744 | 2264 | { |
| 11609 | 2265 | JabberBuddy *jb; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
2266 | PurpleAccount *account; |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
2267 | PurpleConnection *gc; |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2268 | JabberStream *js; |
| 11609 | 2269 | |
|
12970
c2f3b4dcf711
[gaim-migrate @ 15323]
Richard Laager <rlaager@pidgin.im>
parents:
12948
diff
changeset
|
2270 | g_return_if_fail(b != NULL); |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
2271 | |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
2272 | account = purple_buddy_get_account(b); |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
2273 | g_return_if_fail(account != NULL); |
| 11609 | 2274 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
2275 | gc = purple_account_get_connection(account); |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
2276 | g_return_if_fail(gc != NULL); |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2277 | |
|
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2278 | js = purple_connection_get_protocol_data(gc); |
|
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2279 | g_return_if_fail(js != NULL); |
|
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2280 | |
|
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2281 | jb = jabber_buddy_find(js, purple_buddy_get_name(b), FALSE); |
| 7014 | 2282 | |
| 8194 | 2283 | if(jb) { |
| 11609 | 2284 | JabberBuddyResource *jbr = NULL; |
|
21195
fd63ef5027d7
Music support for Google Talk
Sean Egan <seanegan@pidgin.im>
parents:
21193
diff
changeset
|
2285 | PurplePresence *presence = purple_buddy_get_presence(b); |
| 8194 | 2286 | const char *sub; |
| 11609 | 2287 | GList *l; |
|
19920
7b0d20da73d0
Don't put "Mood: \(null\) \(null\)" on XMPP buddies
Sean Egan <seanegan@pidgin.im>
parents:
19897
diff
changeset
|
2288 | const char *mood; |
|
27155
53502d71efdd
Remove trailing whitespace that has snuck in.
Paul Aurich <darkrain42@pidgin.im>
parents:
27143
diff
changeset
|
2289 | gboolean multiple_resources = |
|
25836
ed37c7a05f8a
Only show idle time for idle resources in tooltip text when there is more than
Marcus Lundblad <malu@pidgin.im>
parents:
25532
diff
changeset
|
2290 | jb->resources && g_list_next(jb->resources); |
|
25840
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2291 | JabberBuddyResource *top_jbr = jabber_buddy_find_resource(jb, NULL); |
|
25842
8da3a69dfa55
Remove some unused variables
Marcus Lundblad <malu@pidgin.im>
parents:
25841
diff
changeset
|
2292 | |
|
25840
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2293 | /* resource-specific info for the top resource */ |
|
25843
67bc9c8a4b8d
Avoid crashing when showing the tooltip of an offline buddy, oops :)
Marcus Lundblad <malu@pidgin.im>
parents:
25842
diff
changeset
|
2294 | if (top_jbr) { |
|
27155
53502d71efdd
Remove trailing whitespace that has snuck in.
Paul Aurich <darkrain42@pidgin.im>
parents:
27143
diff
changeset
|
2295 | jabber_tooltip_add_resource_text(top_jbr, user_info, |
|
25843
67bc9c8a4b8d
Avoid crashing when showing the tooltip of an offline buddy, oops :)
Marcus Lundblad <malu@pidgin.im>
parents:
25842
diff
changeset
|
2296 | multiple_resources); |
|
67bc9c8a4b8d
Avoid crashing when showing the tooltip of an offline buddy, oops :)
Marcus Lundblad <malu@pidgin.im>
parents:
25842
diff
changeset
|
2297 | } |
|
25842
8da3a69dfa55
Remove some unused variables
Marcus Lundblad <malu@pidgin.im>
parents:
25841
diff
changeset
|
2298 | |
| 11609 | 2299 | for(l=jb->resources; l; l = l->next) { |
| 2300 | jbr = l->data; | |
|
25840
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2301 | /* the remaining resources */ |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2302 | if (jbr != top_jbr) { |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2303 | jabber_tooltip_add_resource_text(jbr, user_info, |
|
f703af7527a6
Always show the top resource first in the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25838
diff
changeset
|
2304 | multiple_resources); |
|
12944
da8f60d43d88
[gaim-migrate @ 15297]
Richard Laager <rlaager@pidgin.im>
parents:
12943
diff
changeset
|
2305 | } |
| 11609 | 2306 | } |
| 2307 | ||
|
12948
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
2308 | if (full) { |
|
17780
749862fd4a87
Fixed a few small mistakes I discovered while testing user mood in Adium.
Andreas Monitzer <am@adiumx.com>
parents:
17779
diff
changeset
|
2309 | PurpleStatus *status; |
|
23413
b0b23ab674f0
The status type says that mood and moodtext are strings, so we don't
Mark Doliner <markdoliner@pidgin.im>
parents:
23325
diff
changeset
|
2310 | |
|
24912
9ae8349f0353
Move the mood UI for ICQ into Pidgin. It still uses the new request API
Richard Laager <rlaager@pidgin.im>
parents:
24907
diff
changeset
|
2311 | status = purple_presence_get_status(presence, "mood"); |
|
9ae8349f0353
Move the mood UI for ICQ into Pidgin. It still uses the new request API
Richard Laager <rlaager@pidgin.im>
parents:
24907
diff
changeset
|
2312 | mood = purple_status_get_attr_string(status, PURPLE_MOOD_NAME); |
|
24905
dbe73df3dfa0
Check that mood is not the empty string, just to be safe.
Richard Laager <rlaager@pidgin.im>
parents:
24903
diff
changeset
|
2313 | if(mood && *mood) { |
|
23413
b0b23ab674f0
The status type says that mood and moodtext are strings, so we don't
Mark Doliner <markdoliner@pidgin.im>
parents:
23325
diff
changeset
|
2314 | const char *moodtext; |
|
29412
c27d9bb60878
Show the translated mood message (again), if it matches one of the moods we
Marcus Lundblad <malu@pidgin.im>
parents:
29407
diff
changeset
|
2315 | /* find the mood */ |
|
c27d9bb60878
Show the translated mood message (again), if it matches one of the moods we
Marcus Lundblad <malu@pidgin.im>
parents:
29407
diff
changeset
|
2316 | PurpleMood *moods = jabber_get_moods(account); |
|
c27d9bb60878
Show the translated mood message (again), if it matches one of the moods we
Marcus Lundblad <malu@pidgin.im>
parents:
29407
diff
changeset
|
2317 | const char *description = NULL; |
|
c27d9bb60878
Show the translated mood message (again), if it matches one of the moods we
Marcus Lundblad <malu@pidgin.im>
parents:
29407
diff
changeset
|
2318 | |
|
c27d9bb60878
Show the translated mood message (again), if it matches one of the moods we
Marcus Lundblad <malu@pidgin.im>
parents:
29407
diff
changeset
|
2319 | for (; moods->mood ; moods++) { |
|
c27d9bb60878
Show the translated mood message (again), if it matches one of the moods we
Marcus Lundblad <malu@pidgin.im>
parents:
29407
diff
changeset
|
2320 | if (purple_strequal(moods->mood, mood)) { |
|
c27d9bb60878
Show the translated mood message (again), if it matches one of the moods we
Marcus Lundblad <malu@pidgin.im>
parents:
29407
diff
changeset
|
2321 | description = moods->description; |
|
c27d9bb60878
Show the translated mood message (again), if it matches one of the moods we
Marcus Lundblad <malu@pidgin.im>
parents:
29407
diff
changeset
|
2322 | break; |
|
c27d9bb60878
Show the translated mood message (again), if it matches one of the moods we
Marcus Lundblad <malu@pidgin.im>
parents:
29407
diff
changeset
|
2323 | } |
|
c27d9bb60878
Show the translated mood message (again), if it matches one of the moods we
Marcus Lundblad <malu@pidgin.im>
parents:
29407
diff
changeset
|
2324 | } |
|
c27d9bb60878
Show the translated mood message (again), if it matches one of the moods we
Marcus Lundblad <malu@pidgin.im>
parents:
29407
diff
changeset
|
2325 | |
|
24912
9ae8349f0353
Move the mood UI for ICQ into Pidgin. It still uses the new request API
Richard Laager <rlaager@pidgin.im>
parents:
24907
diff
changeset
|
2326 | moodtext = purple_status_get_attr_string(status, PURPLE_MOOD_COMMENT); |
|
24903
638ef56eb3c5
Do not show "Mood: mood ()" when there is no text.
Richard Laager <rlaager@pidgin.im>
parents:
24430
diff
changeset
|
2327 | if(moodtext && *moodtext) { |
|
29412
c27d9bb60878
Show the translated mood message (again), if it matches one of the moods we
Marcus Lundblad <malu@pidgin.im>
parents:
29407
diff
changeset
|
2328 | char *moodplustext = |
|
c27d9bb60878
Show the translated mood message (again), if it matches one of the moods we
Marcus Lundblad <malu@pidgin.im>
parents:
29407
diff
changeset
|
2329 | g_strdup_printf("%s (%s)", description ? _(description) : mood, moodtext); |
|
23413
b0b23ab674f0
The status type says that mood and moodtext are strings, so we don't
Mark Doliner <markdoliner@pidgin.im>
parents:
23325
diff
changeset
|
2330 | |
|
32191
a4668d9dc8d1
Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents:
32162
diff
changeset
|
2331 | purple_notify_user_info_add_pair_html(user_info, _("Mood"), moodplustext); |
|
17780
749862fd4a87
Fixed a few small mistakes I discovered while testing user mood in Adium.
Andreas Monitzer <am@adiumx.com>
parents:
17779
diff
changeset
|
2332 | g_free(moodplustext); |
|
749862fd4a87
Fixed a few small mistakes I discovered while testing user mood in Adium.
Andreas Monitzer <am@adiumx.com>
parents:
17779
diff
changeset
|
2333 | } else |
|
32191
a4668d9dc8d1
Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents:
32162
diff
changeset
|
2334 | purple_notify_user_info_add_pair_html(user_info, _("Mood"), |
|
29412
c27d9bb60878
Show the translated mood message (again), if it matches one of the moods we
Marcus Lundblad <malu@pidgin.im>
parents:
29407
diff
changeset
|
2335 | description ? _(description) : mood); |
|
21195
fd63ef5027d7
Music support for Google Talk
Sean Egan <seanegan@pidgin.im>
parents:
21193
diff
changeset
|
2336 | } |
|
22133
6eb22afb9701
Utility functions to set and format song information. Closes #4398.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22111
diff
changeset
|
2337 | if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) { |
|
21195
fd63ef5027d7
Music support for Google Talk
Sean Egan <seanegan@pidgin.im>
parents:
21193
diff
changeset
|
2338 | PurpleStatus *tune = purple_presence_get_status(presence, "tune"); |
|
fd63ef5027d7
Music support for Google Talk
Sean Egan <seanegan@pidgin.im>
parents:
21193
diff
changeset
|
2339 | const char *title = purple_status_get_attr_string(tune, PURPLE_TUNE_TITLE); |
|
22133
6eb22afb9701
Utility functions to set and format song information. Closes #4398.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22111
diff
changeset
|
2340 | const char *artist = purple_status_get_attr_string(tune, PURPLE_TUNE_ARTIST); |
|
6eb22afb9701
Utility functions to set and format song information. Closes #4398.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22111
diff
changeset
|
2341 | const char *album = purple_status_get_attr_string(tune, PURPLE_TUNE_ALBUM); |
|
6eb22afb9701
Utility functions to set and format song information. Closes #4398.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22111
diff
changeset
|
2342 | char *playing = purple_util_format_song_info(title, artist, album, NULL); |
|
6eb22afb9701
Utility functions to set and format song information. Closes #4398.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22111
diff
changeset
|
2343 | if (playing) { |
|
32191
a4668d9dc8d1
Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents:
32162
diff
changeset
|
2344 | purple_notify_user_info_add_pair_html(user_info, _("Now Listening"), playing); |
|
22133
6eb22afb9701
Utility functions to set and format song information. Closes #4398.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22111
diff
changeset
|
2345 | g_free(playing); |
|
6eb22afb9701
Utility functions to set and format song information. Closes #4398.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22111
diff
changeset
|
2346 | } |
|
21195
fd63ef5027d7
Music support for Google Talk
Sean Egan <seanegan@pidgin.im>
parents:
21193
diff
changeset
|
2347 | } |
|
25838
db906dc27472
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25836
diff
changeset
|
2348 | |
|
db906dc27472
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25836
diff
changeset
|
2349 | if(jb->subscription & JABBER_SUB_FROM) { |
|
db906dc27472
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25836
diff
changeset
|
2350 | if(jb->subscription & JABBER_SUB_TO) |
|
db906dc27472
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25836
diff
changeset
|
2351 | sub = _("Both"); |
|
db906dc27472
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25836
diff
changeset
|
2352 | else if(jb->subscription & JABBER_SUB_PENDING) |
|
db906dc27472
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25836
diff
changeset
|
2353 | sub = _("From (To pending)"); |
|
db906dc27472
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25836
diff
changeset
|
2354 | else |
|
db906dc27472
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25836
diff
changeset
|
2355 | sub = _("From"); |
|
db906dc27472
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25836
diff
changeset
|
2356 | } else { |
|
db906dc27472
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25836
diff
changeset
|
2357 | if(jb->subscription & JABBER_SUB_TO) |
|
db906dc27472
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25836
diff
changeset
|
2358 | sub = _("To"); |
|
db906dc27472
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25836
diff
changeset
|
2359 | else if(jb->subscription & JABBER_SUB_PENDING) |
|
db906dc27472
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25836
diff
changeset
|
2360 | sub = _("None (To pending)"); |
|
db906dc27472
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25836
diff
changeset
|
2361 | else |
|
db906dc27472
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25836
diff
changeset
|
2362 | sub = _("None"); |
| 8194 | 2363 | } |
| 2364 | ||
|
32191
a4668d9dc8d1
Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents:
32162
diff
changeset
|
2365 | purple_notify_user_info_add_pair_html(user_info, _("Subscription"), sub); |
|
25838
db906dc27472
Show statuses per resource before other info the jabber prpl adds to the tooltip
Marcus Lundblad <malu@pidgin.im>
parents:
25836
diff
changeset
|
2366 | |
| 11609 | 2367 | } |
| 2368 | ||
| 15884 | 2369 | if(!PURPLE_BUDDY_IS_ONLINE(b) && jb->error_msg) { |
|
32191
a4668d9dc8d1
Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents:
32162
diff
changeset
|
2370 | purple_notify_user_info_add_pair_html(user_info, _("Error"), jb->error_msg); |
| 8194 | 2371 | } |
| 4745 | 2372 | } |
| 4732 | 2373 | } |
| 2374 | ||
|
16302
eb633ebf84f2
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@pidgin.im>
parents:
16180
diff
changeset
|
2375 | GList *jabber_status_types(PurpleAccount *account) |
| 7014 | 2376 | { |
| 15884 | 2377 | PurpleStatusType *type; |
| 9954 | 2378 | GList *types = NULL; |
|
34810
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
2379 | GValue *priority_value; |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
2380 | GValue *buzz_enabled; |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
2381 | |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2382 | priority_value = purple_value_new(G_TYPE_INT); |
|
34810
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
2383 | g_value_set_int(priority_value, 1); |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2384 | buzz_enabled = purple_value_new(G_TYPE_BOOLEAN); |
|
34810
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
2385 | g_value_set_boolean(buzz_enabled, TRUE); |
| 15884 | 2386 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
2387 | jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_ONLINE), |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
2388 | NULL, TRUE, TRUE, FALSE, |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
2389 | "priority", _("Priority"), priority_value, |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2390 | "message", _("Message"), purple_value_new(G_TYPE_STRING), |
|
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2391 | "mood", _("Mood"), purple_value_new(G_TYPE_STRING), |
|
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2392 | "moodtext", _("Mood Text"), purple_value_new(G_TYPE_STRING), |
|
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2393 | "nick", _("Nickname"), purple_value_new(G_TYPE_STRING), |
|
24396
7f2eddefcbf3
Updated support for XEP-0224.
Marcus Lundblad <malu@pidgin.im>
parents:
24254
diff
changeset
|
2394 | "buzz", _("Allow Buzz"), buzz_enabled, |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
2395 | NULL); |
|
24907
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
24905
diff
changeset
|
2396 | types = g_list_prepend(types, type); |
| 9980 | 2397 | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
31128
diff
changeset
|
2398 | |
|
29407
e4140d21900d
Implemented the get_moods prpl function for XMPP. Enables the generic mood
Marcus Lundblad <malu@pidgin.im>
parents:
29304
diff
changeset
|
2399 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_MOOD, |
|
e4140d21900d
Implemented the get_moods prpl function for XMPP. Enables the generic mood
Marcus Lundblad <malu@pidgin.im>
parents:
29304
diff
changeset
|
2400 | "mood", NULL, TRUE, TRUE, TRUE, |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2401 | PURPLE_MOOD_NAME, _("Mood Name"), purple_value_new(G_TYPE_STRING), |
|
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2402 | PURPLE_MOOD_COMMENT, _("Mood Comment"), purple_value_new(G_TYPE_STRING), |
|
29407
e4140d21900d
Implemented the get_moods prpl function for XMPP. Enables the generic mood
Marcus Lundblad <malu@pidgin.im>
parents:
29304
diff
changeset
|
2403 | NULL); |
|
e4140d21900d
Implemented the get_moods prpl function for XMPP. Enables the generic mood
Marcus Lundblad <malu@pidgin.im>
parents:
29304
diff
changeset
|
2404 | types = g_list_prepend(types, type); |
|
e4140d21900d
Implemented the get_moods prpl function for XMPP. Enables the generic mood
Marcus Lundblad <malu@pidgin.im>
parents:
29304
diff
changeset
|
2405 | |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2406 | priority_value = purple_value_new(G_TYPE_INT); |
|
34810
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
2407 | g_value_set_int(priority_value, 1); |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2408 | buzz_enabled = purple_value_new(G_TYPE_BOOLEAN); |
|
34810
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
2409 | g_value_set_boolean(buzz_enabled, TRUE); |
| 15884 | 2410 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
2411 | jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_CHAT), |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
2412 | _("Chatty"), TRUE, TRUE, FALSE, |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
2413 | "priority", _("Priority"), priority_value, |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2414 | "message", _("Message"), purple_value_new(G_TYPE_STRING), |
|
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2415 | "mood", _("Mood"), purple_value_new(G_TYPE_STRING), |
|
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2416 | "moodtext", _("Mood Text"), purple_value_new(G_TYPE_STRING), |
|
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2417 | "nick", _("Nickname"), purple_value_new(G_TYPE_STRING), |
|
24396
7f2eddefcbf3
Updated support for XEP-0224.
Marcus Lundblad <malu@pidgin.im>
parents:
24254
diff
changeset
|
2418 | "buzz", _("Allow Buzz"), buzz_enabled, |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
2419 | NULL); |
|
24907
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
24905
diff
changeset
|
2420 | types = g_list_prepend(types, type); |
| 2086 | 2421 | |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2422 | priority_value = purple_value_new(G_TYPE_INT); |
|
34810
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
2423 | g_value_set_int(priority_value, 0); |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2424 | buzz_enabled = purple_value_new(G_TYPE_BOOLEAN); |
|
34810
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
2425 | g_value_set_boolean(buzz_enabled, TRUE); |
| 15884 | 2426 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
2427 | jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_AWAY), |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
2428 | NULL, TRUE, TRUE, FALSE, |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
2429 | "priority", _("Priority"), priority_value, |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2430 | "message", _("Message"), purple_value_new(G_TYPE_STRING), |
|
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2431 | "mood", _("Mood"), purple_value_new(G_TYPE_STRING), |
|
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2432 | "moodtext", _("Mood Text"), purple_value_new(G_TYPE_STRING), |
|
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2433 | "nick", _("Nickname"), purple_value_new(G_TYPE_STRING), |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
2434 | "buzz", _("Allow Buzz"), buzz_enabled, |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
2435 | NULL); |
|
24907
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
24905
diff
changeset
|
2436 | types = g_list_prepend(types, type); |
| 9954 | 2437 | |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2438 | priority_value = purple_value_new(G_TYPE_INT); |
|
34810
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
2439 | g_value_set_int(priority_value, 0); |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2440 | buzz_enabled = purple_value_new(G_TYPE_BOOLEAN); |
|
34810
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
2441 | g_value_set_boolean(buzz_enabled, TRUE); |
| 15884 | 2442 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_EXTENDED_AWAY, |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
2443 | jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_XA), |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
2444 | NULL, TRUE, TRUE, FALSE, |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
2445 | "priority", _("Priority"), priority_value, |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2446 | "message", _("Message"), purple_value_new(G_TYPE_STRING), |
|
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2447 | "mood", _("Mood"), purple_value_new(G_TYPE_STRING), |
|
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2448 | "moodtext", _("Mood Text"), purple_value_new(G_TYPE_STRING), |
|
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2449 | "nick", _("Nickname"), purple_value_new(G_TYPE_STRING), |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
2450 | "buzz", _("Allow Buzz"), buzz_enabled, |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
2451 | NULL); |
|
24907
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
24905
diff
changeset
|
2452 | types = g_list_prepend(types, type); |
| 9954 | 2453 | |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2454 | priority_value = purple_value_new(G_TYPE_INT); |
|
34810
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
2455 | g_value_set_int(priority_value, 0); |
| 15884 | 2456 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_UNAVAILABLE, |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
2457 | jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_DND), |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
2458 | _("Do Not Disturb"), TRUE, TRUE, FALSE, |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
2459 | "priority", _("Priority"), priority_value, |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2460 | "message", _("Message"), purple_value_new(G_TYPE_STRING), |
|
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2461 | "mood", _("Mood"), purple_value_new(G_TYPE_STRING), |
|
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2462 | "moodtext", _("Mood Text"), purple_value_new(G_TYPE_STRING), |
|
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2463 | "nick", _("Nickname"), purple_value_new(G_TYPE_STRING), |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
2464 | NULL); |
|
24907
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
24905
diff
changeset
|
2465 | types = g_list_prepend(types, type); |
| 9954 | 2466 | |
| 2467 | /* | |
| 8166 | 2468 | if(js->protocol_version == JABBER_PROTO_0_9) |
|
24907
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
24905
diff
changeset
|
2469 | "Invisible" |
|
10009
8a4fcc043f47
[gaim-migrate @ 10926]
Mark Doliner <markdoliner@pidgin.im>
parents:
9980
diff
changeset
|
2470 | */ |
| 2086 | 2471 | |
| 15884 | 2472 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_OFFLINE, |
|
12658
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12646
diff
changeset
|
2473 | jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_UNAVAILABLE), |
|
25552
ffd94785b2ad
For some reason, all these statuses were set to saveable=FALSE. With the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25328
diff
changeset
|
2474 | NULL, TRUE, TRUE, FALSE, |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2475 | "message", _("Message"), purple_value_new(G_TYPE_STRING), |
|
12658
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12646
diff
changeset
|
2476 | NULL); |
|
24907
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
24905
diff
changeset
|
2477 | types = g_list_prepend(types, type); |
|
12658
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12646
diff
changeset
|
2478 | |
|
21193
e918a1846d03
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20332
diff
changeset
|
2479 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_TUNE, |
|
24693
9ab5d932ab6c
I don't know why we'd want the TUNE status to be saveable.
Richard Laager <rlaager@pidgin.im>
parents:
24430
diff
changeset
|
2480 | "tune", NULL, FALSE, TRUE, TRUE, |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2481 | PURPLE_TUNE_ARTIST, _("Tune Artist"), purple_value_new(G_TYPE_STRING), |
|
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2482 | PURPLE_TUNE_TITLE, _("Tune Title"), purple_value_new(G_TYPE_STRING), |
|
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2483 | PURPLE_TUNE_ALBUM, _("Tune Album"), purple_value_new(G_TYPE_STRING), |
|
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2484 | PURPLE_TUNE_GENRE, _("Tune Genre"), purple_value_new(G_TYPE_STRING), |
|
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2485 | PURPLE_TUNE_COMMENT, _("Tune Comment"), purple_value_new(G_TYPE_STRING), |
|
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2486 | PURPLE_TUNE_TRACK, _("Tune Track"), purple_value_new(G_TYPE_STRING), |
|
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2487 | PURPLE_TUNE_TIME, _("Tune Time"), purple_value_new(G_TYPE_INT), |
|
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2488 | PURPLE_TUNE_YEAR, _("Tune Year"), purple_value_new(G_TYPE_INT), |
|
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34999
diff
changeset
|
2489 | PURPLE_TUNE_URL, _("Tune URL"), purple_value_new(G_TYPE_STRING), |
|
21193
e918a1846d03
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20332
diff
changeset
|
2490 | NULL); |
|
24907
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
24905
diff
changeset
|
2491 | types = g_list_prepend(types, type); |
|
21193
e918a1846d03
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20332
diff
changeset
|
2492 | |
|
24907
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
24905
diff
changeset
|
2493 | return g_list_reverse(types); |
| 2086 | 2494 | } |
| 2495 | ||
| 7395 | 2496 | static void |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26686
diff
changeset
|
2497 | jabber_password_change_result_cb(JabberStream *js, const char *from, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26686
diff
changeset
|
2498 | JabberIqType type, const char *id, |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2499 | PurpleXmlNode *packet, gpointer data) |
| 7124 | 2500 | { |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26686
diff
changeset
|
2501 | if (type == JABBER_IQ_RESULT) { |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
2502 | purple_notify_info(js->gc, _("Password Changed"), _("Password " |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
2503 | "Changed"), _("Your password has been changed."), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
2504 | purple_request_cpar_from_connection(js->gc)); |
|
21129
91280f050201
This patch prevents changing the saved account password for XMPP accounts
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21076
diff
changeset
|
2505 | |
|
34029
059c1270db1f
Remove the silly destroy argument from purple_account_set_password and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34028
diff
changeset
|
2506 | purple_account_set_password(purple_connection_get_account(js->gc), (const char *)data, NULL, NULL); |
| 7124 | 2507 | } else { |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
2508 | char *msg = jabber_parse_error(js, packet, NULL); |
| 7124 | 2509 | |
| 15884 | 2510 | purple_notify_error(js->gc, _("Error changing password"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
2511 | _("Error changing password"), msg, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
2512 | purple_request_cpar_from_connection(js->gc)); |
| 8401 | 2513 | g_free(msg); |
| 7124 | 2514 | } |
|
21129
91280f050201
This patch prevents changing the saved account password for XMPP accounts
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21076
diff
changeset
|
2515 | |
|
91280f050201
This patch prevents changing the saved account password for XMPP accounts
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21076
diff
changeset
|
2516 | g_free(data); |
| 7124 | 2517 | } |
| 2518 | ||
| 2519 | static void jabber_password_change_cb(JabberStream *js, | |
| 15884 | 2520 | PurpleRequestFields *fields) |
| 7124 | 2521 | { |
| 2522 | const char *p1, *p2; | |
| 2523 | JabberIq *iq; | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2524 | PurpleXmlNode *query, *y; |
| 7124 | 2525 | |
| 15884 | 2526 | p1 = purple_request_fields_get_string(fields, "password1"); |
| 2527 | p2 = purple_request_fields_get_string(fields, "password2"); | |
| 7124 | 2528 | |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
2529 | if(!purple_strequal(p1, p2)) { |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
2530 | purple_notify_error(js->gc, NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
2531 | _("New passwords do not match."), NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
2532 | purple_request_cpar_from_connection(js->gc)); |
| 7124 | 2533 | return; |
| 2534 | } | |
| 2535 | ||
| 2536 | iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register"); | |
| 2537 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2538 | purple_xmlnode_set_attrib(iq->node, "to", js->user->domain); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2539 | |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2540 | query = purple_xmlnode_get_child(iq->node, "query"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2541 | |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2542 | y = purple_xmlnode_new_child(query, "username"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2543 | purple_xmlnode_insert_data(y, js->user->node, -1); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2544 | y = purple_xmlnode_new_child(query, "password"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2545 | purple_xmlnode_insert_data(y, p1, -1); |
| 7124 | 2546 | |
|
21129
91280f050201
This patch prevents changing the saved account password for XMPP accounts
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21076
diff
changeset
|
2547 | jabber_iq_set_callback(iq, jabber_password_change_result_cb, g_strdup(p1)); |
| 7124 | 2548 | |
| 2549 | jabber_iq_send(iq); | |
| 2550 | } | |
| 2551 | ||
|
36496
e7fe371c60a6
Refactored jabber to use the new API
Ankit Vani <a@nevitus.org>
parents:
36444
diff
changeset
|
2552 | static void jabber_password_change(PurpleProtocolAction *action) |
| 7124 | 2553 | { |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
2554 | |
|
36496
e7fe371c60a6
Refactored jabber to use the new API
Ankit Vani <a@nevitus.org>
parents:
36444
diff
changeset
|
2555 | PurpleConnection *gc = (PurpleConnection *) action->connection; |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2556 | JabberStream *js = purple_connection_get_protocol_data(gc); |
| 15884 | 2557 | PurpleRequestFields *fields; |
| 2558 | PurpleRequestFieldGroup *group; | |
| 2559 | PurpleRequestField *field; | |
| 7124 | 2560 | |
| 15884 | 2561 | fields = purple_request_fields_new(); |
| 2562 | group = purple_request_field_group_new(NULL); | |
| 2563 | purple_request_fields_add_group(fields, group); | |
| 7124 | 2564 | |
| 15884 | 2565 | field = purple_request_field_string_new("password1", _("Password"), |
| 7124 | 2566 | "", FALSE); |
| 15884 | 2567 | purple_request_field_string_set_masked(field, TRUE); |
|
18381
8192b072afa6
Make password fileds in Jabber's Change Password dialog required. Fixes #1907
Sean Egan <seanegan@pidgin.im>
parents:
18310
diff
changeset
|
2568 | purple_request_field_set_required(field, TRUE); |
| 15884 | 2569 | purple_request_field_group_add_field(group, field); |
| 7124 | 2570 | |
| 15884 | 2571 | field = purple_request_field_string_new("password2", _("Password (again)"), |
| 7124 | 2572 | "", FALSE); |
| 15884 | 2573 | purple_request_field_string_set_masked(field, TRUE); |
|
18381
8192b072afa6
Make password fileds in Jabber's Change Password dialog required. Fixes #1907
Sean Egan <seanegan@pidgin.im>
parents:
18310
diff
changeset
|
2574 | purple_request_field_set_required(field, TRUE); |
| 15884 | 2575 | purple_request_field_group_add_field(group, field); |
| 7124 | 2576 | |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
2577 | purple_request_fields(js->gc, _("Change XMPP Password"), |
|
16961
b6955f946f8f
s/Jabber/XMPP in user-visible places.
Richard Laager <rlaager@pidgin.im>
parents:
16847
diff
changeset
|
2578 | _("Change XMPP Password"), _("Please enter your new password"), |
| 7124 | 2579 | fields, _("OK"), G_CALLBACK(jabber_password_change_cb), |
|
16490
68c22924d66b
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 <evands@pidgin.im>
parents:
16302
diff
changeset
|
2580 | _("Cancel"), NULL, |
|
34332
876483829700
Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34304
diff
changeset
|
2581 | purple_request_cpar_from_connection(gc), js); |
| 7124 | 2582 | } |
| 2583 | ||
|
36496
e7fe371c60a6
Refactored jabber to use the new API
Ankit Vani <a@nevitus.org>
parents:
36444
diff
changeset
|
2584 | GList *jabber_get_actions(PurpleConnection *gc) |
| 2956 | 2585 | { |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2586 | JabberStream *js = purple_connection_get_protocol_data(gc); |
| 2956 | 2587 | GList *m = NULL; |
|
36496
e7fe371c60a6
Refactored jabber to use the new API
Ankit Vani <a@nevitus.org>
parents:
36444
diff
changeset
|
2588 | PurpleProtocolAction *act; |
|
e7fe371c60a6
Refactored jabber to use the new API
Ankit Vani <a@nevitus.org>
parents:
36444
diff
changeset
|
2589 | |
|
e7fe371c60a6
Refactored jabber to use the new API
Ankit Vani <a@nevitus.org>
parents:
36444
diff
changeset
|
2590 | act = purple_protocol_action_new(_("Set User Info..."), |
| 12286 | 2591 | jabber_setup_set_info); |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
2592 | m = g_list_append(m, act); |
|
4333
f4c095774bc2
[gaim-migrate @ 4597]
Mark Doliner <markdoliner@pidgin.im>
parents:
4316
diff
changeset
|
2593 | |
|
37038
8832d14d7d0c
Rename 'protocol_options' field of PurpleProtocol to more appropriate 'account_options'
Ankit Vani <a@nevitus.org>
parents:
37016
diff
changeset
|
2594 | /* if (js->account_options & CHANGE_PASSWORD) { */ |
|
36496
e7fe371c60a6
Refactored jabber to use the new API
Ankit Vani <a@nevitus.org>
parents:
36444
diff
changeset
|
2595 | act = purple_protocol_action_new(_("Change Password..."), |
| 12286 | 2596 | jabber_password_change); |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
2597 | m = g_list_append(m, act); |
| 8296 | 2598 | /* } */ |
| 2956 | 2599 | |
|
36496
e7fe371c60a6
Refactored jabber to use the new API
Ankit Vani <a@nevitus.org>
parents:
36444
diff
changeset
|
2600 | act = purple_protocol_action_new(_("Search for Users..."), |
| 12286 | 2601 | jabber_user_search_begin); |
| 11675 | 2602 | m = g_list_append(m, act); |
| 2603 | ||
|
36496
e7fe371c60a6
Refactored jabber to use the new API
Ankit Vani <a@nevitus.org>
parents:
36444
diff
changeset
|
2604 | purple_debug_info("jabber", "jabber_get_actions: have pep: %s\n", js->pep?"YES":"NO"); |
|
17783
2687df1ca202
PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <am@adiumx.com>
parents:
17782
diff
changeset
|
2605 | |
|
17782
83af68644d0a
Implemented a mood menu action (non-functional right now for some reason)
Andreas Monitzer <am@adiumx.com>
parents:
17780
diff
changeset
|
2606 | if(js->pep) |
|
83af68644d0a
Implemented a mood menu action (non-functional right now for some reason)
Andreas Monitzer <am@adiumx.com>
parents:
17780
diff
changeset
|
2607 | jabber_pep_init_actions(&m); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
2608 | |
|
17817
8e0f271aab78
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 <am@adiumx.com>
parents:
17815
diff
changeset
|
2609 | if(js->commands) |
|
8e0f271aab78
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 <am@adiumx.com>
parents:
17815
diff
changeset
|
2610 | jabber_adhoc_init_server_commands(js, &m); |
| 11675 | 2611 | |
| 2956 | 2612 | return m; |
| 2613 | } | |
| 2614 | ||
|
16302
eb633ebf84f2
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@pidgin.im>
parents:
16180
diff
changeset
|
2615 | PurpleChat *jabber_find_blist_chat(PurpleAccount *account, const char *name) |
| 7999 | 2616 | { |
| 15884 | 2617 | PurpleBlistNode *gnode, *cnode; |
| 7999 | 2618 | JabberID *jid; |
| 2619 | ||
| 2620 | if(!(jid = jabber_id_new(name))) | |
| 2621 | return NULL; | |
| 2622 | ||
|
24945
6678a8c83797
Some more struct hiding.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24571
diff
changeset
|
2623 | for(gnode = purple_blist_get_root(); gnode; |
|
6678a8c83797
Some more struct hiding.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24571
diff
changeset
|
2624 | gnode = purple_blist_node_get_sibling_next(gnode)) { |
|
6678a8c83797
Some more struct hiding.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24571
diff
changeset
|
2625 | for(cnode = purple_blist_node_get_first_child(gnode); |
|
6678a8c83797
Some more struct hiding.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24571
diff
changeset
|
2626 | cnode; |
|
6678a8c83797
Some more struct hiding.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24571
diff
changeset
|
2627 | cnode = purple_blist_node_get_sibling_next(cnode)) { |
| 15884 | 2628 | PurpleChat *chat = (PurpleChat*)cnode; |
| 7999 | 2629 | const char *room, *server; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
2630 | GHashTable *components; |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
34640
diff
changeset
|
2631 | if(!PURPLE_IS_CHAT(cnode)) |
| 7999 | 2632 | continue; |
| 2633 | ||
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
2634 | if (purple_chat_get_account(chat) != account) |
| 8011 | 2635 | continue; |
| 7999 | 2636 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
2637 | components = purple_chat_get_components(chat); |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
2638 | if(!(room = g_hash_table_lookup(components, "room"))) |
| 7999 | 2639 | continue; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
2640 | if(!(server = g_hash_table_lookup(components, "server"))) |
| 7999 | 2641 | continue; |
| 2642 | ||
|
31441
84ef3d484bd4
jabber: Use a straight equality check instead of collate
Paul Aurich <darkrain42@pidgin.im>
parents:
31294
diff
changeset
|
2643 | /* FIXME: Collate is wrong in a few cases here; this should be prepped */ |
| 8158 | 2644 | if(jid->node && jid->domain && |
| 2645 | !g_utf8_collate(room, jid->node) && !g_utf8_collate(server, jid->domain)) { | |
| 7999 | 2646 | jabber_id_free(jid); |
| 2647 | return chat; | |
| 2648 | } | |
| 2649 | } | |
| 2650 | } | |
| 2651 | jabber_id_free(jid); | |
| 2652 | return NULL; | |
| 2653 | } | |
| 2654 | ||
|
16302
eb633ebf84f2
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@pidgin.im>
parents:
16180
diff
changeset
|
2655 | void jabber_convo_closed(PurpleConnection *gc, const char *who) |
| 8400 | 2656 | { |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2657 | JabberStream *js = purple_connection_get_protocol_data(gc); |
| 8400 | 2658 | JabberID *jid; |
| 2659 | JabberBuddy *jb; | |
| 2660 | JabberBuddyResource *jbr; | |
| 2661 | ||
| 2662 | if(!(jid = jabber_id_new(who))) | |
| 2663 | return; | |
| 2664 | ||
| 2665 | if((jb = jabber_buddy_find(js, who, TRUE)) && | |
| 2666 | (jbr = jabber_buddy_find_resource(jb, jid->resource))) { | |
|
37423
d2f0259aa43f
Remove NULL-checks before free(). No functional change.
Michael McConville <mmcco@mykolab.com>
parents:
37417
diff
changeset
|
2667 | g_free(jbr->thread_id); |
|
d2f0259aa43f
Remove NULL-checks before free(). No functional change.
Michael McConville <mmcco@mykolab.com>
parents:
37417
diff
changeset
|
2668 | jbr->thread_id = NULL; |
| 8400 | 2669 | } |
| 2670 | ||
| 2671 | jabber_id_free(jid); | |
| 2672 | } | |
| 2673 | ||
| 8401 | 2674 | |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
2675 | char *jabber_parse_error(JabberStream *js, |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2676 | PurpleXmlNode *packet, |
| 21279 | 2677 | PurpleConnectionError *reason) |
| 8401 | 2678 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2679 | PurpleXmlNode *error; |
| 8401 | 2680 | const char *code = NULL, *text = NULL; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2681 | const char *xmlns = purple_xmlnode_get_namespace(packet); |
| 8401 | 2682 | char *cdata = NULL; |
| 2683 | ||
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
2684 | #define SET_REASON(x) \ |
|
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
2685 | if(reason != NULL) { *reason = x; } |
|
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
2686 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2687 | if((error = purple_xmlnode_get_child(packet, "error"))) { |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2688 | PurpleXmlNode *t = purple_xmlnode_get_child_with_namespace(error, "text", NS_XMPP_STANZAS); |
|
30816
732b1d828b03
jabber: Catch resource conflict IQ stanza errors returned by server
Paul Aurich <darkrain42@pidgin.im>
parents:
30777
diff
changeset
|
2689 | if (t) |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2690 | cdata = purple_xmlnode_get_data(t); |
|
30816
732b1d828b03
jabber: Catch resource conflict IQ stanza errors returned by server
Paul Aurich <darkrain42@pidgin.im>
parents:
30777
diff
changeset
|
2691 | #if 0 |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2692 | cdata = purple_xmlnode_get_data(error); |
|
30816
732b1d828b03
jabber: Catch resource conflict IQ stanza errors returned by server
Paul Aurich <darkrain42@pidgin.im>
parents:
30777
diff
changeset
|
2693 | #endif |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2694 | code = purple_xmlnode_get_attrib(error, "code"); |
| 8401 | 2695 | |
| 2696 | /* Stanza errors */ | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2697 | if(purple_xmlnode_get_child(error, "bad-request")) { |
| 8401 | 2698 | text = _("Bad Request"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2699 | } else if(purple_xmlnode_get_child(error, "conflict")) { |
|
30816
732b1d828b03
jabber: Catch resource conflict IQ stanza errors returned by server
Paul Aurich <darkrain42@pidgin.im>
parents:
30777
diff
changeset
|
2700 | SET_REASON(PURPLE_CONNECTION_ERROR_NAME_IN_USE); |
| 8401 | 2701 | text = _("Conflict"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2702 | } else if(purple_xmlnode_get_child(error, "feature-not-implemented")) { |
| 8401 | 2703 | text = _("Feature Not Implemented"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2704 | } else if(purple_xmlnode_get_child(error, "forbidden")) { |
| 8401 | 2705 | text = _("Forbidden"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2706 | } else if(purple_xmlnode_get_child(error, "gone")) { |
| 8401 | 2707 | text = _("Gone"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2708 | } else if(purple_xmlnode_get_child(error, "internal-server-error")) { |
| 8401 | 2709 | text = _("Internal Server Error"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2710 | } else if(purple_xmlnode_get_child(error, "item-not-found")) { |
| 8401 | 2711 | text = _("Item Not Found"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2712 | } else if(purple_xmlnode_get_child(error, "jid-malformed")) { |
|
16961
b6955f946f8f
s/Jabber/XMPP in user-visible places.
Richard Laager <rlaager@pidgin.im>
parents:
16847
diff
changeset
|
2713 | text = _("Malformed XMPP ID"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2714 | } else if(purple_xmlnode_get_child(error, "not-acceptable")) { |
| 8401 | 2715 | text = _("Not Acceptable"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2716 | } else if(purple_xmlnode_get_child(error, "not-allowed")) { |
| 8401 | 2717 | text = _("Not Allowed"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2718 | } else if(purple_xmlnode_get_child(error, "not-authorized")) { |
| 8401 | 2719 | text = _("Not Authorized"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2720 | } else if(purple_xmlnode_get_child(error, "payment-required")) { |
| 8401 | 2721 | text = _("Payment Required"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2722 | } else if(purple_xmlnode_get_child(error, "recipient-unavailable")) { |
| 8401 | 2723 | text = _("Recipient Unavailable"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2724 | } else if(purple_xmlnode_get_child(error, "redirect")) { |
| 8401 | 2725 | /* XXX */ |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2726 | } else if(purple_xmlnode_get_child(error, "registration-required")) { |
| 8401 | 2727 | text = _("Registration Required"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2728 | } else if(purple_xmlnode_get_child(error, "remote-server-not-found")) { |
| 8401 | 2729 | text = _("Remote Server Not Found"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2730 | } else if(purple_xmlnode_get_child(error, "remote-server-timeout")) { |
| 8401 | 2731 | text = _("Remote Server Timeout"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2732 | } else if(purple_xmlnode_get_child(error, "resource-constraint")) { |
| 8401 | 2733 | text = _("Server Overloaded"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2734 | } else if(purple_xmlnode_get_child(error, "service-unavailable")) { |
| 8401 | 2735 | text = _("Service Unavailable"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2736 | } else if(purple_xmlnode_get_child(error, "subscription-required")) { |
| 8401 | 2737 | text = _("Subscription Required"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2738 | } else if(purple_xmlnode_get_child(error, "unexpected-request")) { |
| 8401 | 2739 | text = _("Unexpected Request"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2740 | } else if(purple_xmlnode_get_child(error, "undefined-condition")) { |
| 8401 | 2741 | text = _("Unknown Error"); |
| 2742 | } | |
| 38260 | 2743 | } else if(purple_strequal(xmlns, NS_XMPP_SASL)) { |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
2744 | /* Most common reason can be the default */ |
|
21284
69472e4a5458
Having read the XMPP SASL specification, these errors seem more accurate.
Will Thompson <resiak@pidgin.im>
parents:
21281
diff
changeset
|
2745 | SET_REASON(PURPLE_CONNECTION_ERROR_NETWORK_ERROR); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2746 | if(purple_xmlnode_get_child(packet, "aborted")) { |
| 8401 | 2747 | text = _("Authorization Aborted"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2748 | } else if(purple_xmlnode_get_child(packet, "incorrect-encoding")) { |
| 8401 | 2749 | text = _("Incorrect encoding in authorization"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2750 | } else if(purple_xmlnode_get_child(packet, "invalid-authzid")) { |
| 8401 | 2751 | text = _("Invalid authzid"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2752 | } else if(purple_xmlnode_get_child(packet, "invalid-mechanism")) { |
| 8401 | 2753 | text = _("Invalid Authorization Mechanism"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2754 | } else if(purple_xmlnode_get_child(packet, "mechanism-too-weak")) { |
|
21284
69472e4a5458
Having read the XMPP SASL specification, these errors seem more accurate.
Will Thompson <resiak@pidgin.im>
parents:
21281
diff
changeset
|
2755 | SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE); |
| 8401 | 2756 | text = _("Authorization mechanism too weak"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2757 | } else if(purple_xmlnode_get_child(packet, "not-authorized")) { |
|
21284
69472e4a5458
Having read the XMPP SASL specification, these errors seem more accurate.
Will Thompson <resiak@pidgin.im>
parents:
21281
diff
changeset
|
2758 | SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED); |
|
19993
867bd1dfe680
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 <datallah@pidgin.im>
parents:
19920
diff
changeset
|
2759 | /* Clear the pasword if it isn't being saved */ |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32624
diff
changeset
|
2760 | if (!purple_account_get_remember_password(purple_connection_get_account(js->gc))) |
|
34029
059c1270db1f
Remove the silly destroy argument from purple_account_set_password and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34028
diff
changeset
|
2761 | purple_account_set_password(purple_connection_get_account(js->gc), NULL, NULL, NULL); |
| 8401 | 2762 | text = _("Not Authorized"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2763 | } else if(purple_xmlnode_get_child(packet, "temporary-auth-failure")) { |
| 8401 | 2764 | text = _("Temporary Authentication Failure"); |
| 2765 | } else { | |
|
21284
69472e4a5458
Having read the XMPP SASL specification, these errors seem more accurate.
Will Thompson <resiak@pidgin.im>
parents:
21281
diff
changeset
|
2766 | SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED); |
| 8401 | 2767 | text = _("Authentication Failure"); |
| 2768 | } | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
2769 | } else if(purple_strequal(packet->name, "stream:error") || |
| 38260 | 2770 | (purple_strequal(packet->name, "error") && |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
2771 | purple_strequal(xmlns, NS_XMPP_STREAMS))) { |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
2772 | /* Most common reason as default: */ |
| 21279 | 2773 | SET_REASON(PURPLE_CONNECTION_ERROR_NETWORK_ERROR); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2774 | if(purple_xmlnode_get_child(packet, "bad-format")) { |
| 8402 | 2775 | text = _("Bad Format"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2776 | } else if(purple_xmlnode_get_child(packet, "bad-namespace-prefix")) { |
| 8402 | 2777 | text = _("Bad Namespace Prefix"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2778 | } else if(purple_xmlnode_get_child(packet, "conflict")) { |
| 21279 | 2779 | SET_REASON(PURPLE_CONNECTION_ERROR_NAME_IN_USE); |
| 8402 | 2780 | text = _("Resource Conflict"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2781 | } else if(purple_xmlnode_get_child(packet, "connection-timeout")) { |
| 8402 | 2782 | text = _("Connection Timeout"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2783 | } else if(purple_xmlnode_get_child(packet, "host-gone")) { |
| 8402 | 2784 | text = _("Host Gone"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2785 | } else if(purple_xmlnode_get_child(packet, "host-unknown")) { |
| 8402 | 2786 | text = _("Host Unknown"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2787 | } else if(purple_xmlnode_get_child(packet, "improper-addressing")) { |
| 8402 | 2788 | text = _("Improper Addressing"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2789 | } else if(purple_xmlnode_get_child(packet, "internal-server-error")) { |
| 8402 | 2790 | text = _("Internal Server Error"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2791 | } else if(purple_xmlnode_get_child(packet, "invalid-id")) { |
| 8402 | 2792 | text = _("Invalid ID"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2793 | } else if(purple_xmlnode_get_child(packet, "invalid-namespace")) { |
| 8402 | 2794 | text = _("Invalid Namespace"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2795 | } else if(purple_xmlnode_get_child(packet, "invalid-xml")) { |
| 8402 | 2796 | text = _("Invalid XML"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2797 | } else if(purple_xmlnode_get_child(packet, "nonmatching-hosts")) { |
| 8402 | 2798 | text = _("Non-matching Hosts"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2799 | } else if(purple_xmlnode_get_child(packet, "not-authorized")) { |
| 8402 | 2800 | text = _("Not Authorized"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2801 | } else if(purple_xmlnode_get_child(packet, "policy-violation")) { |
| 8402 | 2802 | text = _("Policy Violation"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2803 | } else if(purple_xmlnode_get_child(packet, "remote-connection-failed")) { |
| 8402 | 2804 | text = _("Remote Connection Failed"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2805 | } else if(purple_xmlnode_get_child(packet, "resource-constraint")) { |
| 8402 | 2806 | text = _("Resource Constraint"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2807 | } else if(purple_xmlnode_get_child(packet, "restricted-xml")) { |
| 8402 | 2808 | text = _("Restricted XML"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2809 | } else if(purple_xmlnode_get_child(packet, "see-other-host")) { |
| 8402 | 2810 | text = _("See Other Host"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2811 | } else if(purple_xmlnode_get_child(packet, "system-shutdown")) { |
| 8402 | 2812 | text = _("System Shutdown"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2813 | } else if(purple_xmlnode_get_child(packet, "undefined-condition")) { |
| 8402 | 2814 | text = _("Undefined Condition"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2815 | } else if(purple_xmlnode_get_child(packet, "unsupported-encoding")) { |
| 8402 | 2816 | text = _("Unsupported Encoding"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2817 | } else if(purple_xmlnode_get_child(packet, "unsupported-stanza-type")) { |
| 8402 | 2818 | text = _("Unsupported Stanza Type"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2819 | } else if(purple_xmlnode_get_child(packet, "unsupported-version")) { |
| 8402 | 2820 | text = _("Unsupported Version"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
2821 | } else if(purple_xmlnode_get_child(packet, "xml-not-well-formed")) { |
| 8402 | 2822 | text = _("XML Not Well Formed"); |
| 2823 | } else { | |
| 2824 | text = _("Stream Error"); | |
| 2825 | } | |
| 8401 | 2826 | } |
| 2827 | ||
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
2828 | #undef SET_REASON |
|
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
2829 | |
| 8401 | 2830 | if(text || cdata) { |
| 2831 | char *ret = g_strdup_printf("%s%s%s", code ? code : "", | |
| 2832 | code ? ": " : "", text ? text : cdata); | |
| 2833 | g_free(cdata); | |
| 2834 | return ret; | |
| 2835 | } else { | |
| 2836 | return NULL; | |
| 2837 | } | |
| 2838 | } | |
| 2839 | ||
| 15884 | 2840 | static PurpleCmdRet jabber_cmd_chat_config(PurpleConversation *conv, |
| 9597 | 2841 | const char *cmd, char **args, char **error, void *data) |
| 9130 | 2842 | { |
|
34634
90fa70aa7e28
Refactored the jabber protocol to use GObject-based PurpleConversation
Ankit Vani <a@nevitus.org>
parents:
34625
diff
changeset
|
2843 | JabberChat *chat = jabber_chat_find_by_conv(PURPLE_CHAT_CONVERSATION(conv)); |
|
18986
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2844 | |
|
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2845 | if (!chat) |
|
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2846 | return PURPLE_CMD_RET_FAILED; |
|
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2847 | |
| 9130 | 2848 | jabber_chat_request_room_configure(chat); |
| 15884 | 2849 | return PURPLE_CMD_RET_OK; |
| 9130 | 2850 | } |
| 2851 | ||
| 15884 | 2852 | static PurpleCmdRet jabber_cmd_chat_register(PurpleConversation *conv, |
| 9597 | 2853 | const char *cmd, char **args, char **error, void *data) |
| 9130 | 2854 | { |
|
34634
90fa70aa7e28
Refactored the jabber protocol to use GObject-based PurpleConversation
Ankit Vani <a@nevitus.org>
parents:
34625
diff
changeset
|
2855 | JabberChat *chat = jabber_chat_find_by_conv(PURPLE_CHAT_CONVERSATION(conv)); |
|
18986
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2856 | |
|
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2857 | if (!chat) |
|
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2858 | return PURPLE_CMD_RET_FAILED; |
|
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2859 | |
| 9130 | 2860 | jabber_chat_register(chat); |
| 15884 | 2861 | return PURPLE_CMD_RET_OK; |
| 9130 | 2862 | } |
| 2863 | ||
| 15884 | 2864 | static PurpleCmdRet jabber_cmd_chat_topic(PurpleConversation *conv, |
| 9597 | 2865 | const char *cmd, char **args, char **error, void *data) |
| 9130 | 2866 | { |
|
34634
90fa70aa7e28
Refactored the jabber protocol to use GObject-based PurpleConversation
Ankit Vani <a@nevitus.org>
parents:
34625
diff
changeset
|
2867 | JabberChat *chat = jabber_chat_find_by_conv(PURPLE_CHAT_CONVERSATION(conv)); |
|
18986
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2868 | |
|
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2869 | if (!chat) |
|
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2870 | return PURPLE_CMD_RET_FAILED; |
|
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2871 | |
|
26859
8175186cf34a
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <darkrain42@pidgin.im>
parents:
26798
diff
changeset
|
2872 | if (args && args[0] && *args[0]) |
|
8175186cf34a
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <darkrain42@pidgin.im>
parents:
26798
diff
changeset
|
2873 | jabber_chat_change_topic(chat, args[0]); |
|
8175186cf34a
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <darkrain42@pidgin.im>
parents:
26798
diff
changeset
|
2874 | else { |
|
34634
90fa70aa7e28
Refactored the jabber protocol to use GObject-based PurpleConversation
Ankit Vani <a@nevitus.org>
parents:
34625
diff
changeset
|
2875 | const char *cur = purple_chat_conversation_get_topic(PURPLE_CHAT_CONVERSATION(conv)); |
|
26859
8175186cf34a
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <darkrain42@pidgin.im>
parents:
26798
diff
changeset
|
2876 | char *buf, *tmp, *tmp2; |
|
8175186cf34a
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <darkrain42@pidgin.im>
parents:
26798
diff
changeset
|
2877 | |
|
8175186cf34a
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <darkrain42@pidgin.im>
parents:
26798
diff
changeset
|
2878 | if (cur) { |
|
8175186cf34a
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <darkrain42@pidgin.im>
parents:
26798
diff
changeset
|
2879 | tmp = g_markup_escape_text(cur, -1); |
|
8175186cf34a
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <darkrain42@pidgin.im>
parents:
26798
diff
changeset
|
2880 | tmp2 = purple_markup_linkify(tmp); |
|
8175186cf34a
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <darkrain42@pidgin.im>
parents:
26798
diff
changeset
|
2881 | buf = g_strdup_printf(_("current topic is: %s"), tmp2); |
|
8175186cf34a
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <darkrain42@pidgin.im>
parents:
26798
diff
changeset
|
2882 | g_free(tmp); |
|
8175186cf34a
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <darkrain42@pidgin.im>
parents:
26798
diff
changeset
|
2883 | g_free(tmp2); |
|
8175186cf34a
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <darkrain42@pidgin.im>
parents:
26798
diff
changeset
|
2884 | } else |
|
8175186cf34a
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <darkrain42@pidgin.im>
parents:
26798
diff
changeset
|
2885 | buf = g_strdup(_("No topic is set")); |
|
36084
2172bd6dad3e
Add purple_conversation_write_system_message
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36076
diff
changeset
|
2886 | purple_conversation_write_system_message(conv, buf, PURPLE_MESSAGE_NO_LOG); |
|
26859
8175186cf34a
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <darkrain42@pidgin.im>
parents:
26798
diff
changeset
|
2887 | g_free(buf); |
|
8175186cf34a
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <darkrain42@pidgin.im>
parents:
26798
diff
changeset
|
2888 | } |
|
8175186cf34a
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <darkrain42@pidgin.im>
parents:
26798
diff
changeset
|
2889 | |
| 15884 | 2890 | return PURPLE_CMD_RET_OK; |
| 9130 | 2891 | } |
| 2892 | ||
| 15884 | 2893 | static PurpleCmdRet jabber_cmd_chat_nick(PurpleConversation *conv, |
| 9597 | 2894 | const char *cmd, char **args, char **error, void *data) |
| 9130 | 2895 | { |
|
34634
90fa70aa7e28
Refactored the jabber protocol to use GObject-based PurpleConversation
Ankit Vani <a@nevitus.org>
parents:
34625
diff
changeset
|
2896 | JabberChat *chat = jabber_chat_find_by_conv(PURPLE_CHAT_CONVERSATION(conv)); |
| 9130 | 2897 | |
|
18986
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2898 | if(!chat || !args || !args[0]) |
| 15884 | 2899 | return PURPLE_CMD_RET_FAILED; |
| 9130 | 2900 | |
|
28734
886d6c5e8f9a
jabber: Reject invalid chat nicks in /nick command. Fixes #10532.
Paul Aurich <darkrain42@pidgin.im>
parents:
28702
diff
changeset
|
2901 | if (!jabber_resourceprep_validate(args[0])) { |
|
886d6c5e8f9a
jabber: Reject invalid chat nicks in /nick command. Fixes #10532.
Paul Aurich <darkrain42@pidgin.im>
parents:
28702
diff
changeset
|
2902 | *error = g_strdup(_("Invalid nickname")); |
|
886d6c5e8f9a
jabber: Reject invalid chat nicks in /nick command. Fixes #10532.
Paul Aurich <darkrain42@pidgin.im>
parents:
28702
diff
changeset
|
2903 | return PURPLE_CMD_RET_FAILED; |
|
886d6c5e8f9a
jabber: Reject invalid chat nicks in /nick command. Fixes #10532.
Paul Aurich <darkrain42@pidgin.im>
parents:
28702
diff
changeset
|
2904 | } |
|
886d6c5e8f9a
jabber: Reject invalid chat nicks in /nick command. Fixes #10532.
Paul Aurich <darkrain42@pidgin.im>
parents:
28702
diff
changeset
|
2905 | |
|
886d6c5e8f9a
jabber: Reject invalid chat nicks in /nick command. Fixes #10532.
Paul Aurich <darkrain42@pidgin.im>
parents:
28702
diff
changeset
|
2906 | if (jabber_chat_change_nick(chat, args[0])) |
|
886d6c5e8f9a
jabber: Reject invalid chat nicks in /nick command. Fixes #10532.
Paul Aurich <darkrain42@pidgin.im>
parents:
28702
diff
changeset
|
2907 | return PURPLE_CMD_RET_OK; |
|
886d6c5e8f9a
jabber: Reject invalid chat nicks in /nick command. Fixes #10532.
Paul Aurich <darkrain42@pidgin.im>
parents:
28702
diff
changeset
|
2908 | else |
|
886d6c5e8f9a
jabber: Reject invalid chat nicks in /nick command. Fixes #10532.
Paul Aurich <darkrain42@pidgin.im>
parents:
28702
diff
changeset
|
2909 | return PURPLE_CMD_RET_FAILED; |
| 9130 | 2910 | } |
| 2911 | ||
| 15884 | 2912 | static PurpleCmdRet jabber_cmd_chat_part(PurpleConversation *conv, |
| 9597 | 2913 | const char *cmd, char **args, char **error, void *data) |
| 9130 | 2914 | { |
|
34634
90fa70aa7e28
Refactored the jabber protocol to use GObject-based PurpleConversation
Ankit Vani <a@nevitus.org>
parents:
34625
diff
changeset
|
2915 | JabberChat *chat = jabber_chat_find_by_conv(PURPLE_CHAT_CONVERSATION(conv)); |
|
18986
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2916 | |
|
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2917 | if (!chat) |
|
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2918 | return PURPLE_CMD_RET_FAILED; |
|
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2919 | |
| 9130 | 2920 | jabber_chat_part(chat, args ? args[0] : NULL); |
| 15884 | 2921 | return PURPLE_CMD_RET_OK; |
| 9130 | 2922 | } |
| 2923 | ||
| 15884 | 2924 | static PurpleCmdRet jabber_cmd_chat_ban(PurpleConversation *conv, |
| 9597 | 2925 | const char *cmd, char **args, char **error, void *data) |
| 9152 | 2926 | { |
|
34634
90fa70aa7e28
Refactored the jabber protocol to use GObject-based PurpleConversation
Ankit Vani <a@nevitus.org>
parents:
34625
diff
changeset
|
2927 | JabberChat *chat = jabber_chat_find_by_conv(PURPLE_CHAT_CONVERSATION(conv)); |
| 9152 | 2928 | |
|
18986
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2929 | if(!chat || !args || !args[0]) |
| 15884 | 2930 | return PURPLE_CMD_RET_FAILED; |
| 9152 | 2931 | |
| 2932 | if(!jabber_chat_ban_user(chat, args[0], args[1])) { | |
| 2933 | *error = g_strdup_printf(_("Unable to ban user %s"), args[0]); | |
| 15884 | 2934 | return PURPLE_CMD_RET_FAILED; |
| 9152 | 2935 | } |
| 2936 | ||
| 15884 | 2937 | return PURPLE_CMD_RET_OK; |
| 9152 | 2938 | } |
| 2939 | ||
| 15884 | 2940 | static PurpleCmdRet jabber_cmd_chat_affiliate(PurpleConversation *conv, |
| 11393 | 2941 | const char *cmd, char **args, char **error, void *data) |
| 2942 | { | |
|
34634
90fa70aa7e28
Refactored the jabber protocol to use GObject-based PurpleConversation
Ankit Vani <a@nevitus.org>
parents:
34625
diff
changeset
|
2943 | JabberChat *chat = jabber_chat_find_by_conv(PURPLE_CHAT_CONVERSATION(conv)); |
| 11393 | 2944 | |
|
27027
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
2945 | if (!chat || !args || !args[0]) |
| 15884 | 2946 | return PURPLE_CMD_RET_FAILED; |
| 11393 | 2947 | |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
2948 | if (!purple_strequal(args[0], "owner") && |
|
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
2949 | !purple_strequal(args[0], "admin") && |
|
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
2950 | !purple_strequal(args[0], "member") && |
|
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
2951 | !purple_strequal(args[0], "outcast") && |
|
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
2952 | !purple_strequal(args[0], "none")) { |
|
27027
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
2953 | *error = g_strdup_printf(_("Unknown affiliation: \"%s\""), args[0]); |
| 15884 | 2954 | return PURPLE_CMD_RET_FAILED; |
| 11393 | 2955 | } |
| 2956 | ||
|
27027
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
2957 | if (args[1]) { |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
2958 | int i; |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
2959 | char **nicks = g_strsplit(args[1], " ", -1); |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
2960 | |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
2961 | for (i = 0; nicks[i]; ++i) |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
2962 | if (!jabber_chat_affiliate_user(chat, nicks[i], args[0])) { |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
2963 | *error = g_strdup_printf(_("Unable to affiliate user %s as \"%s\""), nicks[i], args[0]); |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
2964 | g_strfreev(nicks); |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
2965 | return PURPLE_CMD_RET_FAILED; |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
2966 | } |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
2967 | |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
2968 | g_strfreev(nicks); |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
2969 | } else { |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
2970 | jabber_chat_affiliation_list(chat, args[0]); |
| 11393 | 2971 | } |
| 2972 | ||
| 15884 | 2973 | return PURPLE_CMD_RET_OK; |
| 11393 | 2974 | } |
| 2975 | ||
| 15884 | 2976 | static PurpleCmdRet jabber_cmd_chat_role(PurpleConversation *conv, |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2977 | const char *cmd, char **args, char **error, void *data) |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2978 | { |
|
34634
90fa70aa7e28
Refactored the jabber protocol to use GObject-based PurpleConversation
Ankit Vani <a@nevitus.org>
parents:
34625
diff
changeset
|
2979 | JabberChat *chat = jabber_chat_find_by_conv(PURPLE_CHAT_CONVERSATION(conv)); |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2980 | |
|
27027
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
2981 | if (!chat || !args || !args[0]) |
| 15884 | 2982 | return PURPLE_CMD_RET_FAILED; |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2983 | |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
2984 | if (!purple_strequal(args[0], "moderator") && |
|
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
2985 | !purple_strequal(args[0], "participant") && |
|
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
2986 | !purple_strequal(args[0], "visitor") && |
|
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
2987 | !purple_strequal(args[0], "none")) { |
|
27027
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
2988 | *error = g_strdup_printf(_("Unknown role: \"%s\""), args[0]); |
| 15884 | 2989 | return PURPLE_CMD_RET_FAILED; |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2990 | } |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2991 | |
|
27027
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
2992 | if (args[1]) { |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
2993 | int i; |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
2994 | char **nicks = g_strsplit(args[1], " ", -1); |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
2995 | |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
2996 | for (i = 0; nicks[i]; i++) |
|
29400
8d8ad40c9c7d
jabber: Kick by in-room nick, not JID. Reduces code, but is still in-spec (and seems to be the preferred method)
Paul Aurich <darkrain42@pidgin.im>
parents:
29398
diff
changeset
|
2997 | if (!jabber_chat_role_user(chat, nicks[i], args[0], NULL)) { |
|
27027
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
2998 | *error = g_strdup_printf(_("Unable to set role \"%s\" for user: %s"), |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
2999 | args[0], nicks[i]); |
|
29398
3c31c5db18e9
jabber: Possible leaks--;
Paul Aurich <darkrain42@pidgin.im>
parents:
29370
diff
changeset
|
3000 | g_strfreev(nicks); |
|
27027
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
3001 | return PURPLE_CMD_RET_FAILED; |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
3002 | } |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
3003 | |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
3004 | g_strfreev(nicks); |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
3005 | } else { |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
27002
diff
changeset
|
3006 | jabber_chat_role_list(chat, args[0]); |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
3007 | } |
| 15884 | 3008 | return PURPLE_CMD_RET_OK; |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
3009 | } |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
3010 | |
| 15884 | 3011 | static PurpleCmdRet jabber_cmd_chat_invite(PurpleConversation *conv, |
| 9597 | 3012 | const char *cmd, char **args, char **error, void *data) |
| 9152 | 3013 | { |
| 3014 | if(!args || !args[0]) | |
| 15884 | 3015 | return PURPLE_CMD_RET_FAILED; |
| 9152 | 3016 | |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32684
diff
changeset
|
3017 | jabber_chat_invite(purple_conversation_get_connection(conv), |
|
34634
90fa70aa7e28
Refactored the jabber protocol to use GObject-based PurpleConversation
Ankit Vani <a@nevitus.org>
parents:
34625
diff
changeset
|
3018 | purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION(conv)), args[1] ? args[1] : "", |
| 9152 | 3019 | args[0]); |
| 3020 | ||
| 15884 | 3021 | return PURPLE_CMD_RET_OK; |
| 9152 | 3022 | } |
| 3023 | ||
| 15884 | 3024 | static PurpleCmdRet jabber_cmd_chat_join(PurpleConversation *conv, |
| 9597 | 3025 | const char *cmd, char **args, char **error, void *data) |
| 9152 | 3026 | { |
|
34634
90fa70aa7e28
Refactored the jabber protocol to use GObject-based PurpleConversation
Ankit Vani <a@nevitus.org>
parents:
34625
diff
changeset
|
3027 | JabberChat *chat = jabber_chat_find_by_conv(PURPLE_CHAT_CONVERSATION(conv)); |
| 9152 | 3028 | GHashTable *components; |
|
31967
8ca00a04051e
jabber: Fix /join behavior. Closes #14205.
Paul Aurich <darkrain42@pidgin.im>
parents:
31928
diff
changeset
|
3029 | JabberID *jid = NULL; |
|
31510
38bc213239a3
jabber: Add support for joining a room based not on the current server.
Paul Aurich <darkrain42@pidgin.im>
parents:
31447
diff
changeset
|
3030 | const char *room = NULL, *server = NULL, *handle = NULL; |
|
38bc213239a3
jabber: Add support for joining a room based not on the current server.
Paul Aurich <darkrain42@pidgin.im>
parents:
31447
diff
changeset
|
3031 | |
|
38bc213239a3
jabber: Add support for joining a room based not on the current server.
Paul Aurich <darkrain42@pidgin.im>
parents:
31447
diff
changeset
|
3032 | if (!chat || !args || !args[0]) |
| 15884 | 3033 | return PURPLE_CMD_RET_FAILED; |
| 9152 | 3034 | |
| 3035 | components = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); | |
| 3036 | ||
|
31967
8ca00a04051e
jabber: Fix /join behavior. Closes #14205.
Paul Aurich <darkrain42@pidgin.im>
parents:
31928
diff
changeset
|
3037 | if (strchr(args[0], '@')) |
|
8ca00a04051e
jabber: Fix /join behavior. Closes #14205.
Paul Aurich <darkrain42@pidgin.im>
parents:
31928
diff
changeset
|
3038 | jid = jabber_id_new(args[0]); |
|
31510
38bc213239a3
jabber: Add support for joining a room based not on the current server.
Paul Aurich <darkrain42@pidgin.im>
parents:
31447
diff
changeset
|
3039 | if (jid) { |
|
38bc213239a3
jabber: Add support for joining a room based not on the current server.
Paul Aurich <darkrain42@pidgin.im>
parents:
31447
diff
changeset
|
3040 | room = jid->node; |
|
38bc213239a3
jabber: Add support for joining a room based not on the current server.
Paul Aurich <darkrain42@pidgin.im>
parents:
31447
diff
changeset
|
3041 | server = jid->domain; |
|
38bc213239a3
jabber: Add support for joining a room based not on the current server.
Paul Aurich <darkrain42@pidgin.im>
parents:
31447
diff
changeset
|
3042 | handle = jid->resource ? jid->resource : chat->handle; |
|
38bc213239a3
jabber: Add support for joining a room based not on the current server.
Paul Aurich <darkrain42@pidgin.im>
parents:
31447
diff
changeset
|
3043 | } else { |
|
38bc213239a3
jabber: Add support for joining a room based not on the current server.
Paul Aurich <darkrain42@pidgin.im>
parents:
31447
diff
changeset
|
3044 | /* If jabber_id_new failed, the user may have just passed in |
|
38bc213239a3
jabber: Add support for joining a room based not on the current server.
Paul Aurich <darkrain42@pidgin.im>
parents:
31447
diff
changeset
|
3045 | * a room name. For backward compatibility, handle that here. |
|
38bc213239a3
jabber: Add support for joining a room based not on the current server.
Paul Aurich <darkrain42@pidgin.im>
parents:
31447
diff
changeset
|
3046 | */ |
|
38bc213239a3
jabber: Add support for joining a room based not on the current server.
Paul Aurich <darkrain42@pidgin.im>
parents:
31447
diff
changeset
|
3047 | if (strchr(args[0], '@')) { |
|
38bc213239a3
jabber: Add support for joining a room based not on the current server.
Paul Aurich <darkrain42@pidgin.im>
parents:
31447
diff
changeset
|
3048 | *error = g_strdup(_("Invalid XMPP ID")); |
|
38bc213239a3
jabber: Add support for joining a room based not on the current server.
Paul Aurich <darkrain42@pidgin.im>
parents:
31447
diff
changeset
|
3049 | return PURPLE_CMD_RET_FAILED; |
|
38bc213239a3
jabber: Add support for joining a room based not on the current server.
Paul Aurich <darkrain42@pidgin.im>
parents:
31447
diff
changeset
|
3050 | } |
|
38bc213239a3
jabber: Add support for joining a room based not on the current server.
Paul Aurich <darkrain42@pidgin.im>
parents:
31447
diff
changeset
|
3051 | |
|
38bc213239a3
jabber: Add support for joining a room based not on the current server.
Paul Aurich <darkrain42@pidgin.im>
parents:
31447
diff
changeset
|
3052 | room = args[0]; |
|
38bc213239a3
jabber: Add support for joining a room based not on the current server.
Paul Aurich <darkrain42@pidgin.im>
parents:
31447
diff
changeset
|
3053 | server = chat->server; |
|
38bc213239a3
jabber: Add support for joining a room based not on the current server.
Paul Aurich <darkrain42@pidgin.im>
parents:
31447
diff
changeset
|
3054 | handle = chat->handle; |
|
38bc213239a3
jabber: Add support for joining a room based not on the current server.
Paul Aurich <darkrain42@pidgin.im>
parents:
31447
diff
changeset
|
3055 | } |
|
38bc213239a3
jabber: Add support for joining a room based not on the current server.
Paul Aurich <darkrain42@pidgin.im>
parents:
31447
diff
changeset
|
3056 | |
|
38bc213239a3
jabber: Add support for joining a room based not on the current server.
Paul Aurich <darkrain42@pidgin.im>
parents:
31447
diff
changeset
|
3057 | g_hash_table_insert(components, "room", (gpointer)room); |
|
38bc213239a3
jabber: Add support for joining a room based not on the current server.
Paul Aurich <darkrain42@pidgin.im>
parents:
31447
diff
changeset
|
3058 | g_hash_table_insert(components, "server", (gpointer)server); |
|
38bc213239a3
jabber: Add support for joining a room based not on the current server.
Paul Aurich <darkrain42@pidgin.im>
parents:
31447
diff
changeset
|
3059 | g_hash_table_insert(components, "handle", (gpointer)handle); |
|
38bc213239a3
jabber: Add support for joining a room based not on the current server.
Paul Aurich <darkrain42@pidgin.im>
parents:
31447
diff
changeset
|
3060 | |
|
38bc213239a3
jabber: Add support for joining a room based not on the current server.
Paul Aurich <darkrain42@pidgin.im>
parents:
31447
diff
changeset
|
3061 | if (args[1]) |
|
38bc213239a3
jabber: Add support for joining a room based not on the current server.
Paul Aurich <darkrain42@pidgin.im>
parents:
31447
diff
changeset
|
3062 | g_hash_table_insert(components, "password", args[1]); |
| 9152 | 3063 | |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32684
diff
changeset
|
3064 | jabber_chat_join(purple_conversation_get_connection(conv), components); |
| 9152 | 3065 | |
| 3066 | g_hash_table_destroy(components); | |
|
31510
38bc213239a3
jabber: Add support for joining a room based not on the current server.
Paul Aurich <darkrain42@pidgin.im>
parents:
31447
diff
changeset
|
3067 | jabber_id_free(jid); |
| 15884 | 3068 | return PURPLE_CMD_RET_OK; |
| 9152 | 3069 | } |
| 3070 | ||
| 15884 | 3071 | static PurpleCmdRet jabber_cmd_chat_kick(PurpleConversation *conv, |
| 9597 | 3072 | const char *cmd, char **args, char **error, void *data) |
| 9152 | 3073 | { |
|
34634
90fa70aa7e28
Refactored the jabber protocol to use GObject-based PurpleConversation
Ankit Vani <a@nevitus.org>
parents:
34625
diff
changeset
|
3074 | JabberChat *chat = jabber_chat_find_by_conv(PURPLE_CHAT_CONVERSATION(conv)); |
| 9152 | 3075 | |
|
18986
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
3076 | if(!chat || !args || !args[0]) |
| 15884 | 3077 | return PURPLE_CMD_RET_FAILED; |
| 9152 | 3078 | |
|
29400
8d8ad40c9c7d
jabber: Kick by in-room nick, not JID. Reduces code, but is still in-spec (and seems to be the preferred method)
Paul Aurich <darkrain42@pidgin.im>
parents:
29398
diff
changeset
|
3079 | if(!jabber_chat_role_user(chat, args[0], "none", args[1])) { |
| 9152 | 3080 | *error = g_strdup_printf(_("Unable to kick user %s"), args[0]); |
| 15884 | 3081 | return PURPLE_CMD_RET_FAILED; |
| 9152 | 3082 | } |
| 3083 | ||
| 15884 | 3084 | return PURPLE_CMD_RET_OK; |
| 9152 | 3085 | } |
| 3086 | ||
| 15884 | 3087 | static PurpleCmdRet jabber_cmd_chat_msg(PurpleConversation *conv, |
| 9597 | 3088 | const char *cmd, char **args, char **error, void *data) |
| 9152 | 3089 | { |
|
34634
90fa70aa7e28
Refactored the jabber protocol to use GObject-based PurpleConversation
Ankit Vani <a@nevitus.org>
parents:
34625
diff
changeset
|
3090 | JabberChat *chat = jabber_chat_find_by_conv(PURPLE_CHAT_CONVERSATION(conv)); |
| 9152 | 3091 | char *who; |
| 3092 | ||
|
18986
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
3093 | if (!chat) |
|
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
3094 | return PURPLE_CMD_RET_FAILED; |
|
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
3095 | |
| 9152 | 3096 | who = g_strdup_printf("%s@%s/%s", chat->room, chat->server, args[0]); |
| 3097 | ||
|
36076
a0e5b68ff4ef
Switch purple_serv_send_im to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36068
diff
changeset
|
3098 | jabber_message_send_im(purple_conversation_get_connection(conv), |
|
36098
4951752ad038
Split PurpleMessage into incoming, outgoing and system
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36092
diff
changeset
|
3099 | purple_message_new_outgoing(who, args[1], 0)); |
| 9152 | 3100 | |
| 3101 | g_free(who); | |
| 15884 | 3102 | return PURPLE_CMD_RET_OK; |
| 9152 | 3103 | } |
| 3104 | ||
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
3105 | static PurpleCmdRet jabber_cmd_ping(PurpleConversation *conv, |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
3106 | const char *cmd, char **args, char **error, void *data) |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
3107 | { |
|
26089
804e625addbc
Fix merge (i.e. reapply my changes here).
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
3108 | PurpleAccount *account; |
|
804e625addbc
Fix merge (i.e. reapply my changes here).
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
3109 | PurpleConnection *pc; |
|
804e625addbc
Fix merge (i.e. reapply my changes here).
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
3110 | |
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
3111 | if(!args || !args[0]) |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
3112 | return PURPLE_CMD_RET_FAILED; |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
3113 | |
|
26089
804e625addbc
Fix merge (i.e. reapply my changes here).
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
3114 | account = purple_conversation_get_account(conv); |
|
804e625addbc
Fix merge (i.e. reapply my changes here).
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
3115 | pc = purple_account_get_connection(account); |
|
804e625addbc
Fix merge (i.e. reapply my changes here).
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
3116 | |
|
804e625addbc
Fix merge (i.e. reapply my changes here).
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
3117 | if(!jabber_ping_jid(purple_connection_get_protocol_data(pc), args[0])) { |
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
3118 | *error = g_strdup_printf(_("Unable to ping user %s"), args[0]); |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
3119 | return PURPLE_CMD_RET_FAILED; |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
3120 | } |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
3121 | |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
3122 | return PURPLE_CMD_RET_OK; |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
3123 | } |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
3124 | |
|
20930
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
3125 | static gboolean _jabber_send_buzz(JabberStream *js, const char *username, char **error) { |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
3126 | |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
3127 | JabberBuddy *jb; |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
3128 | JabberBuddyResource *jbr; |
|
24428
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
3129 | PurpleConnection *gc = js->gc; |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
3130 | PurpleBuddy *buddy = |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34706
diff
changeset
|
3131 | purple_blist_find_buddy(purple_connection_get_account(gc), username); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
3132 | const gchar *alias = |
|
25975
fcd84c6c9909
Print alias (if known) in some error/info messages when failing to buzz
Marcus Lundblad <malu@pidgin.im>
parents:
25973
diff
changeset
|
3133 | buddy ? purple_buddy_get_contact_alias(buddy) : username; |
|
20930
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
3134 | |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
3135 | if(!username) |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
3136 | return FALSE; |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
3137 | |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
3138 | jb = jabber_buddy_find(js, username, FALSE); |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
3139 | if(!jb) { |
|
25975
fcd84c6c9909
Print alias (if known) in some error/info messages when failing to buzz
Marcus Lundblad <malu@pidgin.im>
parents:
25973
diff
changeset
|
3140 | *error = g_strdup_printf(_("Unable to buzz, because there is nothing " |
|
fcd84c6c9909
Print alias (if known) in some error/info messages when failing to buzz
Marcus Lundblad <malu@pidgin.im>
parents:
25973
diff
changeset
|
3141 | "known about %s."), alias); |
|
20930
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
3142 | return FALSE; |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
3143 | } |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
3144 | |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
3145 | jbr = jabber_buddy_find_resource(jb, NULL); |
|
24428
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
3146 | if (!jbr) { |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
3147 | *error = g_strdup_printf(_("Unable to buzz, because %s might be offline."), |
|
25975
fcd84c6c9909
Print alias (if known) in some error/info messages when failing to buzz
Marcus Lundblad <malu@pidgin.im>
parents:
25973
diff
changeset
|
3148 | alias); |
|
20930
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
3149 | return FALSE; |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
3150 | } |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
3151 | |
|
28979
191942cc7747
jabber: Start putting all the namespaces in one location with consistent naming.
Paul Aurich <darkrain42@pidgin.im>
parents:
28928
diff
changeset
|
3152 | if (jabber_resource_has_capability(jbr, NS_ATTENTION)) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
3153 | PurpleXmlNode *buzz, *msg = purple_xmlnode_new("message"); |
|
24428
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
3154 | gchar *to; |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
3155 | |
|
24428
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
3156 | to = g_strdup_printf("%s/%s", username, jbr->name); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
3157 | purple_xmlnode_set_attrib(msg, "to", to); |
|
24428
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
3158 | g_free(to); |
|
20930
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
3159 | |
|
24428
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
3160 | /* avoid offline storage */ |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
3161 | purple_xmlnode_set_attrib(msg, "type", "headline"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
3162 | |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
3163 | buzz = purple_xmlnode_new_child(msg, "attention"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
3164 | purple_xmlnode_set_namespace(buzz, NS_ATTENTION); |
|
20930
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
3165 | |
|
24428
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
3166 | jabber_send(js, msg); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
3167 | purple_xmlnode_free(msg); |
|
20930
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
3168 | |
|
24428
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
3169 | return TRUE; |
|
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
3170 | } else { |
|
25975
fcd84c6c9909
Print alias (if known) in some error/info messages when failing to buzz
Marcus Lundblad <malu@pidgin.im>
parents:
25973
diff
changeset
|
3171 | *error = g_strdup_printf(_("Unable to buzz, because %s does " |
|
26086
f26f6451c701
Use "does" here sounds more natural to me
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
3172 | "not support it or does not wish to receive buzzes now."), alias); |
|
24428
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
3173 | return FALSE; |
|
20930
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
3174 | } |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
3175 | } |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
3176 | |
|
17822
1a183f3fa9d7
disapproval of revision 'd52c12703a8e67c41c7f95a2cae7f16ab426ad76'
Andreas Monitzer <am@adiumx.com>
parents:
17821
diff
changeset
|
3177 | static PurpleCmdRet jabber_cmd_buzz(PurpleConversation *conv, |
|
1a183f3fa9d7
disapproval of revision 'd52c12703a8e67c41c7f95a2cae7f16ab426ad76'
Andreas Monitzer <am@adiumx.com>
parents:
17821
diff
changeset
|
3178 | const char *cmd, char **args, char **error, void *data) |
|
1a183f3fa9d7
disapproval of revision 'd52c12703a8e67c41c7f95a2cae7f16ab426ad76'
Andreas Monitzer <am@adiumx.com>
parents:
17821
diff
changeset
|
3179 | { |
|
32617
c74b4bd27e37
Use purple_conversation accessor methods.
Andrew Victor <andrew.victor@mxit.com>
parents:
32300
diff
changeset
|
3180 | PurpleAccount *account = purple_conversation_get_account(conv); |
|
32624
f957ad287bcc
Convert code to use the purple_account accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
3181 | JabberStream *js = purple_connection_get_protocol_data(purple_account_get_connection(account)); |
|
24428
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
3182 | const gchar *who; |
|
26048
9eeed41d0004
Make it work again after the merge from i.p.p.... :)
Marcus Lundblad <malu@pidgin.im>
parents:
25948
diff
changeset
|
3183 | gchar *description; |
|
9eeed41d0004
Make it work again after the merge from i.p.p.... :)
Marcus Lundblad <malu@pidgin.im>
parents:
25948
diff
changeset
|
3184 | PurpleBuddy *buddy; |
|
9eeed41d0004
Make it work again after the merge from i.p.p.... :)
Marcus Lundblad <malu@pidgin.im>
parents:
25948
diff
changeset
|
3185 | const char *alias; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
31128
diff
changeset
|
3186 | PurpleAttentionType *attn = |
|
32617
c74b4bd27e37
Use purple_conversation accessor methods.
Andrew Victor <andrew.victor@mxit.com>
parents:
32300
diff
changeset
|
3187 | purple_get_attention_type_from_code(account, 0); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
3188 | |
|
24428
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
3189 | if (!args || !args[0]) { |
|
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
3190 | /* use the buddy from conversation, if it's a one-to-one conversation */ |
|
34634
90fa70aa7e28
Refactored the jabber protocol to use GObject-based PurpleConversation
Ankit Vani <a@nevitus.org>
parents:
34625
diff
changeset
|
3191 | if (PURPLE_IS_IM_CONVERSATION(conv)) { |
|
24428
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
3192 | who = purple_conversation_get_name(conv); |
|
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
3193 | } else { |
|
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
3194 | return PURPLE_CMD_RET_FAILED; |
|
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
3195 | } |
|
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
3196 | } else { |
|
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
3197 | who = args[0]; |
|
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
3198 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
3199 | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34706
diff
changeset
|
3200 | buddy = purple_blist_find_buddy(account, who); |
|
26048
9eeed41d0004
Make it work again after the merge from i.p.p.... :)
Marcus Lundblad <malu@pidgin.im>
parents:
25948
diff
changeset
|
3201 | if (buddy != NULL) |
|
9eeed41d0004
Make it work again after the merge from i.p.p.... :)
Marcus Lundblad <malu@pidgin.im>
parents:
25948
diff
changeset
|
3202 | alias = purple_buddy_get_contact_alias(buddy); |
|
9eeed41d0004
Make it work again after the merge from i.p.p.... :)
Marcus Lundblad <malu@pidgin.im>
parents:
25948
diff
changeset
|
3203 | else |
|
9eeed41d0004
Make it work again after the merge from i.p.p.... :)
Marcus Lundblad <malu@pidgin.im>
parents:
25948
diff
changeset
|
3204 | alias = who; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
31128
diff
changeset
|
3205 | |
|
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
31128
diff
changeset
|
3206 | description = |
|
26048
9eeed41d0004
Make it work again after the merge from i.p.p.... :)
Marcus Lundblad <malu@pidgin.im>
parents:
25948
diff
changeset
|
3207 | g_strdup_printf(purple_attention_type_get_outgoing_desc(attn), alias); |
|
36089
c035b9a63457
Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36084
diff
changeset
|
3208 | purple_conversation_write_system_message(conv, description, |
|
c035b9a63457
Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36084
diff
changeset
|
3209 | PURPLE_MESSAGE_NOTIFY); |
|
26048
9eeed41d0004
Make it work again after the merge from i.p.p.... :)
Marcus Lundblad <malu@pidgin.im>
parents:
25948
diff
changeset
|
3210 | g_free(description); |
|
9eeed41d0004
Make it work again after the merge from i.p.p.... :)
Marcus Lundblad <malu@pidgin.im>
parents:
25948
diff
changeset
|
3211 | return _jabber_send_buzz(js, who, error) ? PURPLE_CMD_RET_OK : PURPLE_CMD_RET_FAILED; |
|
17822
1a183f3fa9d7
disapproval of revision 'd52c12703a8e67c41c7f95a2cae7f16ab426ad76'
Andreas Monitzer <am@adiumx.com>
parents:
17821
diff
changeset
|
3212 | } |
|
1a183f3fa9d7
disapproval of revision 'd52c12703a8e67c41c7f95a2cae7f16ab426ad76'
Andreas Monitzer <am@adiumx.com>
parents:
17821
diff
changeset
|
3213 | |
|
20401
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
3214 | GList *jabber_attention_types(PurpleAccount *account) |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
3215 | { |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
3216 | static GList *types = NULL; |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
3217 | |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
3218 | if (!types) { |
|
22225
6cd802a8c5ad
This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22155
diff
changeset
|
3219 | types = g_list_append(types, purple_attention_type_new("Buzz", _("Buzz"), |
|
6cd802a8c5ad
This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22155
diff
changeset
|
3220 | _("%s has buzzed you!"), _("Buzzing %s..."))); |
|
20401
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
3221 | } |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
3222 | |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
3223 | return types; |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
3224 | } |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
3225 | |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
3226 | gboolean jabber_send_attention(PurpleConnection *gc, const char *username, guint code) |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
3227 | { |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
3228 | JabberStream *js = purple_connection_get_protocol_data(gc); |
|
20930
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
3229 | gchar *error = NULL; |
|
20401
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
3230 | |
|
20930
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
3231 | if (!_jabber_send_buzz(js, username, &error)) { |
|
29787
645de6afcc0a
jabber: Print an error message to the current conversation when failing to
Marcus Lundblad <malu@pidgin.im>
parents:
29771
diff
changeset
|
3232 | PurpleAccount *account = purple_connection_get_account(gc); |
|
645de6afcc0a
jabber: Print an error message to the current conversation when failing to
Marcus Lundblad <malu@pidgin.im>
parents:
29771
diff
changeset
|
3233 | PurpleConversation *conv = |
|
34625
03d62b1660fc
Refactor code to remove conversation type from some instances of purple_conversations_find_with_account()
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
3234 | purple_conversations_find_with_account(username, account); |
|
20401
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
3235 | purple_debug_error("jabber", "jabber_send_attention: jabber_cmd_buzz failed with error: %s\n", error ? error : "(NULL)"); |
|
29787
645de6afcc0a
jabber: Print an error message to the current conversation when failing to
Marcus Lundblad <malu@pidgin.im>
parents:
29771
diff
changeset
|
3236 | |
|
645de6afcc0a
jabber: Print an error message to the current conversation when failing to
Marcus Lundblad <malu@pidgin.im>
parents:
29771
diff
changeset
|
3237 | if (conv) { |
|
36089
c035b9a63457
Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36084
diff
changeset
|
3238 | purple_conversation_write_system_message(conv, |
|
c035b9a63457
Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36084
diff
changeset
|
3239 | error, PURPLE_MESSAGE_ERROR); |
|
29787
645de6afcc0a
jabber: Print an error message to the current conversation when failing to
Marcus Lundblad <malu@pidgin.im>
parents:
29771
diff
changeset
|
3240 | } |
|
645de6afcc0a
jabber: Print an error message to the current conversation when failing to
Marcus Lundblad <malu@pidgin.im>
parents:
29771
diff
changeset
|
3241 | |
|
20930
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
3242 | g_free(error); |
|
20401
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
3243 | return FALSE; |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
3244 | } |
|
20930
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
3245 | |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
3246 | return TRUE; |
|
20401
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
3247 | } |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
3248 | |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
3249 | |
|
16302
eb633ebf84f2
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@pidgin.im>
parents:
16180
diff
changeset
|
3250 | gboolean jabber_offline_message(const PurpleBuddy *buddy) |
|
12645
a907ba243930
[gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12600
diff
changeset
|
3251 | { |
|
a907ba243930
[gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12600
diff
changeset
|
3252 | return TRUE; |
|
a907ba243930
[gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12600
diff
changeset
|
3253 | } |
|
a907ba243930
[gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12600
diff
changeset
|
3254 | |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3255 | #ifdef USE_VV |
|
26668
ef06285f3b64
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents:
26666
diff
changeset
|
3256 | gboolean |
|
ef06285f3b64
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents:
26666
diff
changeset
|
3257 | jabber_audio_enabled(JabberStream *js, const char *namespace) |
|
26665
16f54aa7c7d1
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <darkrain42@pidgin.im>
parents:
26663
diff
changeset
|
3258 | { |
|
16f54aa7c7d1
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <darkrain42@pidgin.im>
parents:
26663
diff
changeset
|
3259 | PurpleMediaManager *manager = purple_media_manager_get(); |
|
16f54aa7c7d1
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <darkrain42@pidgin.im>
parents:
26663
diff
changeset
|
3260 | PurpleMediaCaps caps = purple_media_manager_get_ui_caps(manager); |
|
16f54aa7c7d1
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <darkrain42@pidgin.im>
parents:
26663
diff
changeset
|
3261 | |
|
16f54aa7c7d1
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <darkrain42@pidgin.im>
parents:
26663
diff
changeset
|
3262 | return (caps & (PURPLE_MEDIA_CAPS_AUDIO | PURPLE_MEDIA_CAPS_AUDIO_SINGLE_DIRECTION)); |
|
16f54aa7c7d1
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <darkrain42@pidgin.im>
parents:
26663
diff
changeset
|
3263 | } |
|
16f54aa7c7d1
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <darkrain42@pidgin.im>
parents:
26663
diff
changeset
|
3264 | |
|
27202
5244a5510e0e
Add Gmail video support.
Michael Ruprecht <maiku@pidgin.im>
parents:
27193
diff
changeset
|
3265 | gboolean |
|
26668
ef06285f3b64
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents:
26666
diff
changeset
|
3266 | jabber_video_enabled(JabberStream *js, const char *namespace) |
|
26665
16f54aa7c7d1
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <darkrain42@pidgin.im>
parents:
26663
diff
changeset
|
3267 | { |
|
16f54aa7c7d1
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <darkrain42@pidgin.im>
parents:
26663
diff
changeset
|
3268 | PurpleMediaManager *manager = purple_media_manager_get(); |
|
16f54aa7c7d1
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <darkrain42@pidgin.im>
parents:
26663
diff
changeset
|
3269 | PurpleMediaCaps caps = purple_media_manager_get_ui_caps(manager); |
|
16f54aa7c7d1
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <darkrain42@pidgin.im>
parents:
26663
diff
changeset
|
3270 | |
|
16f54aa7c7d1
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <darkrain42@pidgin.im>
parents:
26663
diff
changeset
|
3271 | return (caps & (PURPLE_MEDIA_CAPS_VIDEO | PURPLE_MEDIA_CAPS_VIDEO_SINGLE_DIRECTION)); |
|
16f54aa7c7d1
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <darkrain42@pidgin.im>
parents:
26663
diff
changeset
|
3272 | } |
|
16f54aa7c7d1
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <darkrain42@pidgin.im>
parents:
26663
diff
changeset
|
3273 | |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3274 | typedef struct { |
|
26746
2a2d45ac9774
Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents:
26699
diff
changeset
|
3275 | PurpleAccount *account; |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3276 | gchar *who; |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3277 | PurpleMediaSessionType type; |
|
27155
53502d71efdd
Remove trailing whitespace that has snuck in.
Paul Aurich <darkrain42@pidgin.im>
parents:
27143
diff
changeset
|
3278 | |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3279 | } JabberMediaRequest; |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3280 | |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3281 | static void |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3282 | jabber_media_cancel_cb(JabberMediaRequest *request, |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3283 | PurpleRequestFields *fields) |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3284 | { |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3285 | g_free(request->who); |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3286 | g_free(request); |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3287 | } |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3288 | |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3289 | static void |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3290 | jabber_media_ok_cb(JabberMediaRequest *request, PurpleRequestFields *fields) |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3291 | { |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3292 | PurpleRequestField *field = |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3293 | purple_request_fields_get_field(fields, "resource"); |
|
34338
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34332
diff
changeset
|
3294 | const gchar *selected = purple_request_field_choice_get_value(field); |
|
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34332
diff
changeset
|
3295 | gchar *who = g_strdup_printf("%s/%s", request->who, selected); |
|
26746
2a2d45ac9774
Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents:
26699
diff
changeset
|
3296 | jabber_initiate_media(request->account, who, request->type); |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3297 | |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3298 | g_free(who); |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3299 | g_free(request->who); |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3300 | g_free(request); |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3301 | } |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3302 | #endif |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3303 | |
|
26495
52846ebe1c7d
Don't assume a PurpleMedia instance will be created immediately.
Michael Ruprecht <maiku@pidgin.im>
parents:
26455
diff
changeset
|
3304 | gboolean |
|
27155
53502d71efdd
Remove trailing whitespace that has snuck in.
Paul Aurich <darkrain42@pidgin.im>
parents:
27143
diff
changeset
|
3305 | jabber_initiate_media(PurpleAccount *account, const char *who, |
|
26108
8d0fd2f195aa
Changed PurpleMediaStreamType to PurpleMediaSessionType.
Michael Ruprecht <maiku@pidgin.im>
parents:
26106
diff
changeset
|
3306 | PurpleMediaSessionType type) |
|
22648
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22646
diff
changeset
|
3307 | { |
|
26454
94130b583e0b
Clean up usage of USE_VV in the XMPP protocol.
Michael Ruprecht <maiku@pidgin.im>
parents:
26399
diff
changeset
|
3308 | #ifdef USE_VV |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
3309 | PurpleConnection *gc = purple_account_get_connection(account); |
|
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
3310 | JabberStream *js = purple_connection_get_protocol_data(gc); |
|
26205
f20bb7e9e311
Support initiating voice calls to GTalk and Gmail.
Michael Ruprecht <maiku@pidgin.im>
parents:
26186
diff
changeset
|
3311 | JabberBuddy *jb; |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3312 | JabberBuddyResource *jbr = NULL; |
|
33790
270d16117280
Prevent (another) NULL pointer deref when initating a rtp session with an unrecognized resource
Daniel Atallah <datallah@pidgin.im>
parents:
33740
diff
changeset
|
3313 | char *resource = NULL; |
|
26205
f20bb7e9e311
Support initiating voice calls to GTalk and Gmail.
Michael Ruprecht <maiku@pidgin.im>
parents:
26186
diff
changeset
|
3314 | |
|
f20bb7e9e311
Support initiating voice calls to GTalk and Gmail.
Michael Ruprecht <maiku@pidgin.im>
parents:
26186
diff
changeset
|
3315 | if (!js) { |
|
f20bb7e9e311
Support initiating voice calls to GTalk and Gmail.
Michael Ruprecht <maiku@pidgin.im>
parents:
26186
diff
changeset
|
3316 | purple_debug_error("jabber", |
|
f20bb7e9e311
Support initiating voice calls to GTalk and Gmail.
Michael Ruprecht <maiku@pidgin.im>
parents:
26186
diff
changeset
|
3317 | "jabber_initiate_media: NULL stream\n"); |
|
26495
52846ebe1c7d
Don't assume a PurpleMedia instance will be created immediately.
Michael Ruprecht <maiku@pidgin.im>
parents:
26455
diff
changeset
|
3318 | return FALSE; |
|
26205
f20bb7e9e311
Support initiating voice calls to GTalk and Gmail.
Michael Ruprecht <maiku@pidgin.im>
parents:
26186
diff
changeset
|
3319 | } |
|
f20bb7e9e311
Support initiating voice calls to GTalk and Gmail.
Michael Ruprecht <maiku@pidgin.im>
parents:
26186
diff
changeset
|
3320 | |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3321 | jb = jabber_buddy_find(js, who, FALSE); |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3322 | |
|
33790
270d16117280
Prevent (another) NULL pointer deref when initating a rtp session with an unrecognized resource
Daniel Atallah <datallah@pidgin.im>
parents:
33740
diff
changeset
|
3323 | if(!jb || !jb->resources || |
|
270d16117280
Prevent (another) NULL pointer deref when initating a rtp session with an unrecognized resource
Daniel Atallah <datallah@pidgin.im>
parents:
33740
diff
changeset
|
3324 | (((resource = jabber_get_resource(who)) != NULL) |
|
270d16117280
Prevent (another) NULL pointer deref when initating a rtp session with an unrecognized resource
Daniel Atallah <datallah@pidgin.im>
parents:
33740
diff
changeset
|
3325 | && (jbr = jabber_buddy_find_resource(jb, resource)) == NULL)) { |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3326 | /* no resources online, we're trying to initiate with someone |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3327 | * whose presence we're not subscribed to, or |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3328 | * someone who is offline. Let's inform the user */ |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3329 | char *msg; |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3330 | |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3331 | if(!jb) { |
|
26647
89bcc7bce53e
Minor grammatical message fixes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26643
diff
changeset
|
3332 | msg = g_strdup_printf(_("Unable to initiate media with %s: invalid JID"), who); |
|
33790
270d16117280
Prevent (another) NULL pointer deref when initating a rtp session with an unrecognized resource
Daniel Atallah <datallah@pidgin.im>
parents:
33740
diff
changeset
|
3333 | } else if(jb->subscription & JABBER_SUB_TO && !jb->resources) { |
|
26647
89bcc7bce53e
Minor grammatical message fixes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26643
diff
changeset
|
3334 | msg = g_strdup_printf(_("Unable to initiate media with %s: user is not online"), who); |
|
33790
270d16117280
Prevent (another) NULL pointer deref when initating a rtp session with an unrecognized resource
Daniel Atallah <datallah@pidgin.im>
parents:
33740
diff
changeset
|
3335 | } else if(resource) { |
|
270d16117280
Prevent (another) NULL pointer deref when initating a rtp session with an unrecognized resource
Daniel Atallah <datallah@pidgin.im>
parents:
33740
diff
changeset
|
3336 | msg = g_strdup_printf(_("Unable to initiate media with %s: resource is not online"), who); |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3337 | } else { |
|
26647
89bcc7bce53e
Minor grammatical message fixes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26643
diff
changeset
|
3338 | msg = g_strdup_printf(_("Unable to initiate media with %s: not subscribed to user presence"), who); |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3339 | } |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3340 | |
|
26746
2a2d45ac9774
Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents:
26699
diff
changeset
|
3341 | purple_notify_error(account, _("Media Initiation Failed"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
3342 | _("Media Initiation Failed"), msg, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
3343 | purple_request_cpar_from_connection(gc)); |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3344 | g_free(msg); |
|
33790
270d16117280
Prevent (another) NULL pointer deref when initating a rtp session with an unrecognized resource
Daniel Atallah <datallah@pidgin.im>
parents:
33740
diff
changeset
|
3345 | g_free(resource); |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3346 | return FALSE; |
|
33790
270d16117280
Prevent (another) NULL pointer deref when initating a rtp session with an unrecognized resource
Daniel Atallah <datallah@pidgin.im>
parents:
33740
diff
changeset
|
3347 | } else if(jbr != NULL) { |
|
270d16117280
Prevent (another) NULL pointer deref when initating a rtp session with an unrecognized resource
Daniel Atallah <datallah@pidgin.im>
parents:
33740
diff
changeset
|
3348 | /* they've specified a resource, no need to ask or |
|
270d16117280
Prevent (another) NULL pointer deref when initating a rtp session with an unrecognized resource
Daniel Atallah <datallah@pidgin.im>
parents:
33740
diff
changeset
|
3349 | * default or anything, just do it */ |
|
270d16117280
Prevent (another) NULL pointer deref when initating a rtp session with an unrecognized resource
Daniel Atallah <datallah@pidgin.im>
parents:
33740
diff
changeset
|
3350 | |
|
270d16117280
Prevent (another) NULL pointer deref when initating a rtp session with an unrecognized resource
Daniel Atallah <datallah@pidgin.im>
parents:
33740
diff
changeset
|
3351 | g_free(resource); |
|
270d16117280
Prevent (another) NULL pointer deref when initating a rtp session with an unrecognized resource
Daniel Atallah <datallah@pidgin.im>
parents:
33740
diff
changeset
|
3352 | |
|
270d16117280
Prevent (another) NULL pointer deref when initating a rtp session with an unrecognized resource
Daniel Atallah <datallah@pidgin.im>
parents:
33740
diff
changeset
|
3353 | if (type & PURPLE_MEDIA_AUDIO && |
|
270d16117280
Prevent (another) NULL pointer deref when initating a rtp session with an unrecognized resource
Daniel Atallah <datallah@pidgin.im>
parents:
33740
diff
changeset
|
3354 | !jabber_resource_has_capability(jbr, |
|
270d16117280
Prevent (another) NULL pointer deref when initating a rtp session with an unrecognized resource
Daniel Atallah <datallah@pidgin.im>
parents:
33740
diff
changeset
|
3355 | JINGLE_APP_RTP_SUPPORT_AUDIO) && |
|
270d16117280
Prevent (another) NULL pointer deref when initating a rtp session with an unrecognized resource
Daniel Atallah <datallah@pidgin.im>
parents:
33740
diff
changeset
|
3356 | jabber_resource_has_capability(jbr, NS_GOOGLE_VOICE)) |
|
270d16117280
Prevent (another) NULL pointer deref when initating a rtp session with an unrecognized resource
Daniel Atallah <datallah@pidgin.im>
parents:
33740
diff
changeset
|
3357 | return jabber_google_session_initiate(js, who, type); |
|
270d16117280
Prevent (another) NULL pointer deref when initating a rtp session with an unrecognized resource
Daniel Atallah <datallah@pidgin.im>
parents:
33740
diff
changeset
|
3358 | else |
|
270d16117280
Prevent (another) NULL pointer deref when initating a rtp session with an unrecognized resource
Daniel Atallah <datallah@pidgin.im>
parents:
33740
diff
changeset
|
3359 | return jingle_rtp_initiate_media(js, who, type); |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3360 | } else if(!jb->resources->next) { |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3361 | /* only 1 resource online (probably our most common case) |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3362 | * so no need to ask who to initiate with */ |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3363 | gchar *name; |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3364 | gboolean result; |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3365 | jbr = jb->resources->data; |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3366 | name = g_strdup_printf("%s/%s", who, jbr->name); |
|
26746
2a2d45ac9774
Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents:
26699
diff
changeset
|
3367 | result = jabber_initiate_media(account, name, type); |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3368 | g_free(name); |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3369 | return result; |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3370 | } else { |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3371 | /* we've got multiple resources, |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3372 | * we need to pick one to initiate with */ |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3373 | GList *l; |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3374 | char *msg; |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3375 | PurpleRequestFields *fields; |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3376 | PurpleRequestField *field = purple_request_field_choice_new( |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3377 | "resource", _("Resource"), 0); |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3378 | PurpleRequestFieldGroup *group; |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3379 | JabberMediaRequest *request; |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3380 | |
|
34338
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34332
diff
changeset
|
3381 | purple_request_field_choice_set_data_destructor(field, g_free); |
|
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34332
diff
changeset
|
3382 | |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3383 | for(l = jb->resources; l; l = l->next) |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3384 | { |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3385 | JabberBuddyResource *ljbr = l->data; |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3386 | PurpleMediaCaps caps; |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3387 | gchar *name; |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3388 | name = g_strdup_printf("%s/%s", who, ljbr->name); |
|
26746
2a2d45ac9774
Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents:
26699
diff
changeset
|
3389 | caps = jabber_get_media_caps(account, name); |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3390 | g_free(name); |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3391 | |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3392 | if ((type & PURPLE_MEDIA_AUDIO) && |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3393 | (type & PURPLE_MEDIA_VIDEO)) { |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3394 | if (caps & PURPLE_MEDIA_CAPS_AUDIO_VIDEO) { |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3395 | jbr = ljbr; |
|
34338
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34332
diff
changeset
|
3396 | purple_request_field_choice_add(field, |
|
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34332
diff
changeset
|
3397 | jbr->name, g_strdup(jbr->name)); |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3398 | } |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3399 | } else if (type & (PURPLE_MEDIA_AUDIO) && |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3400 | (caps & PURPLE_MEDIA_CAPS_AUDIO)) { |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3401 | jbr = ljbr; |
|
34338
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34332
diff
changeset
|
3402 | purple_request_field_choice_add(field, |
|
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34332
diff
changeset
|
3403 | jbr->name, g_strdup(jbr->name)); |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3404 | }else if (type & (PURPLE_MEDIA_VIDEO) && |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3405 | (caps & PURPLE_MEDIA_CAPS_VIDEO)) { |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3406 | jbr = ljbr; |
|
34338
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34332
diff
changeset
|
3407 | purple_request_field_choice_add(field, |
|
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34332
diff
changeset
|
3408 | jbr->name, g_strdup(jbr->name)); |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3409 | } |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3410 | } |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3411 | |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3412 | if (jbr == NULL) { |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3413 | purple_debug_error("jabber", |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3414 | "No resources available\n"); |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3415 | return FALSE; |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3416 | } |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3417 | |
|
34338
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34332
diff
changeset
|
3418 | if (g_list_length(purple_request_field_choice_get_elements( |
|
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34332
diff
changeset
|
3419 | field)) <= 2) { |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3420 | gchar *name; |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3421 | gboolean result; |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3422 | purple_request_field_destroy(field); |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3423 | name = g_strdup_printf("%s/%s", who, jbr->name); |
|
26746
2a2d45ac9774
Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents:
26699
diff
changeset
|
3424 | result = jabber_initiate_media(account, name, type); |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3425 | g_free(name); |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3426 | return result; |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3427 | } |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3428 | |
|
26647
89bcc7bce53e
Minor grammatical message fixes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26643
diff
changeset
|
3429 | msg = g_strdup_printf(_("Please select the resource of %s with which you would like to start a media session."), who); |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3430 | fields = purple_request_fields_new(); |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3431 | group = purple_request_field_group_new(NULL); |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3432 | request = g_new0(JabberMediaRequest, 1); |
|
26746
2a2d45ac9774
Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents:
26699
diff
changeset
|
3433 | request->account = account; |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3434 | request->who = g_strdup(who); |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3435 | request->type = type; |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3436 | |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3437 | purple_request_field_group_add_field(group, field); |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3438 | purple_request_fields_add_group(fields, group); |
|
26746
2a2d45ac9774
Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents:
26699
diff
changeset
|
3439 | purple_request_fields(account, _("Select a Resource"), msg, |
|
2a2d45ac9774
Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents:
26699
diff
changeset
|
3440 | NULL, fields, _("Initiate Media"), |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3441 | G_CALLBACK(jabber_media_ok_cb), _("Cancel"), |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3442 | G_CALLBACK(jabber_media_cancel_cb), |
|
34332
876483829700
Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34304
diff
changeset
|
3443 | purple_request_cpar_from_account(account), |
|
876483829700
Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34304
diff
changeset
|
3444 | request); |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3445 | |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3446 | g_free(msg); |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3447 | return TRUE; |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3448 | } |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3449 | #endif |
|
26495
52846ebe1c7d
Don't assume a PurpleMedia instance will be created immediately.
Michael Ruprecht <maiku@pidgin.im>
parents:
26455
diff
changeset
|
3450 | return FALSE; |
|
22648
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22646
diff
changeset
|
3451 | } |
|
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22646
diff
changeset
|
3452 | |
|
26746
2a2d45ac9774
Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents:
26699
diff
changeset
|
3453 | PurpleMediaCaps jabber_get_media_caps(PurpleAccount *account, const char *who) |
|
22648
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22646
diff
changeset
|
3454 | { |
|
26454
94130b583e0b
Clean up usage of USE_VV in the XMPP protocol.
Michael Ruprecht <maiku@pidgin.im>
parents:
26399
diff
changeset
|
3455 | #ifdef USE_VV |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
3456 | PurpleConnection *gc = purple_account_get_connection(account); |
|
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
3457 | JabberStream *js = purple_connection_get_protocol_data(gc); |
|
23715
0844f5e9ac8e
Fix crash bug when checking if a contact can do media when logging out.
Michael Ruprecht <maiku@pidgin.im>
parents:
23714
diff
changeset
|
3458 | JabberBuddy *jb; |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3459 | JabberBuddyResource *jbr; |
|
29345
5932dfc04845
Oops, just realized that caps can be reset in certain situations, and we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29344
diff
changeset
|
3460 | PurpleMediaCaps total = PURPLE_MEDIA_CAPS_NONE; |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3461 | gchar *resource; |
|
29344
362c4882de89
Fix jabber_get_media_caps for buddies with a single resource that has no
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29264
diff
changeset
|
3462 | GList *specific = NULL, *l; |
|
23715
0844f5e9ac8e
Fix crash bug when checking if a contact can do media when logging out.
Michael Ruprecht <maiku@pidgin.im>
parents:
23714
diff
changeset
|
3463 | |
|
0844f5e9ac8e
Fix crash bug when checking if a contact can do media when logging out.
Michael Ruprecht <maiku@pidgin.im>
parents:
23714
diff
changeset
|
3464 | if (!js) { |
|
26632
e4fb60cb05a7
Demote debug error to info.
Michael Ruprecht <maiku@pidgin.im>
parents:
26495
diff
changeset
|
3465 | purple_debug_info("jabber", |
|
e4fb60cb05a7
Demote debug error to info.
Michael Ruprecht <maiku@pidgin.im>
parents:
26495
diff
changeset
|
3466 | "jabber_can_do_media: NULL stream\n"); |
|
23715
0844f5e9ac8e
Fix crash bug when checking if a contact can do media when logging out.
Michael Ruprecht <maiku@pidgin.im>
parents:
23714
diff
changeset
|
3467 | return FALSE; |
|
0844f5e9ac8e
Fix crash bug when checking if a contact can do media when logging out.
Michael Ruprecht <maiku@pidgin.im>
parents:
23714
diff
changeset
|
3468 | } |
|
0844f5e9ac8e
Fix crash bug when checking if a contact can do media when logging out.
Michael Ruprecht <maiku@pidgin.im>
parents:
23714
diff
changeset
|
3469 | |
|
29344
362c4882de89
Fix jabber_get_media_caps for buddies with a single resource that has no
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29264
diff
changeset
|
3470 | jb = jabber_buddy_find(js, who, FALSE); |
|
362c4882de89
Fix jabber_get_media_caps for buddies with a single resource that has no
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29264
diff
changeset
|
3471 | |
|
362c4882de89
Fix jabber_get_media_caps for buddies with a single resource that has no
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29264
diff
changeset
|
3472 | if (!jb || !jb->resources) { |
|
362c4882de89
Fix jabber_get_media_caps for buddies with a single resource that has no
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29264
diff
changeset
|
3473 | /* no resources online, we're trying to get caps for someone |
|
362c4882de89
Fix jabber_get_media_caps for buddies with a single resource that has no
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29264
diff
changeset
|
3474 | * whose presence we're not subscribed to, or |
|
362c4882de89
Fix jabber_get_media_caps for buddies with a single resource that has no
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29264
diff
changeset
|
3475 | * someone who is offline. */ |
|
29345
5932dfc04845
Oops, just realized that caps can be reset in certain situations, and we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29344
diff
changeset
|
3476 | return total; |
|
29344
362c4882de89
Fix jabber_get_media_caps for buddies with a single resource that has no
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29264
diff
changeset
|
3477 | |
|
362c4882de89
Fix jabber_get_media_caps for buddies with a single resource that has no
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29264
diff
changeset
|
3478 | } else if ((resource = jabber_get_resource(who)) != NULL) { |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3479 | /* they've specified a resource, no need to ask or |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3480 | * default or anything, just do it */ |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3481 | jbr = jabber_buddy_find_resource(jb, resource); |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3482 | g_free(resource); |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3483 | |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3484 | if (!jbr) { |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3485 | purple_debug_error("jabber", "jabber_get_media_caps:" |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3486 | " Can't find resource %s\n", who); |
|
29345
5932dfc04845
Oops, just realized that caps can be reset in certain situations, and we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29344
diff
changeset
|
3487 | return total; |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3488 | } |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3489 | |
|
29344
362c4882de89
Fix jabber_get_media_caps for buddies with a single resource that has no
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29264
diff
changeset
|
3490 | l = specific = g_list_prepend(specific, jbr); |
|
362c4882de89
Fix jabber_get_media_caps for buddies with a single resource that has no
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29264
diff
changeset
|
3491 | |
|
362c4882de89
Fix jabber_get_media_caps for buddies with a single resource that has no
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29264
diff
changeset
|
3492 | } else { |
|
362c4882de89
Fix jabber_get_media_caps for buddies with a single resource that has no
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29264
diff
changeset
|
3493 | /* we've got multiple resources, combine their caps */ |
|
362c4882de89
Fix jabber_get_media_caps for buddies with a single resource that has no
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29264
diff
changeset
|
3494 | l = jb->resources; |
|
362c4882de89
Fix jabber_get_media_caps for buddies with a single resource that has no
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29264
diff
changeset
|
3495 | } |
|
362c4882de89
Fix jabber_get_media_caps for buddies with a single resource that has no
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29264
diff
changeset
|
3496 | |
|
362c4882de89
Fix jabber_get_media_caps for buddies with a single resource that has no
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29264
diff
changeset
|
3497 | for (; l; l = l->next) { |
|
29345
5932dfc04845
Oops, just realized that caps can be reset in certain situations, and we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29344
diff
changeset
|
3498 | PurpleMediaCaps caps = PURPLE_MEDIA_CAPS_NONE; |
|
29344
362c4882de89
Fix jabber_get_media_caps for buddies with a single resource that has no
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29264
diff
changeset
|
3499 | jbr = l->data; |
|
362c4882de89
Fix jabber_get_media_caps for buddies with a single resource that has no
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29264
diff
changeset
|
3500 | |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3501 | if (jabber_resource_has_capability(jbr, |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3502 | JINGLE_APP_RTP_SUPPORT_AUDIO)) |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3503 | caps |= PURPLE_MEDIA_CAPS_AUDIO_SINGLE_DIRECTION | |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3504 | PURPLE_MEDIA_CAPS_AUDIO; |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3505 | if (jabber_resource_has_capability(jbr, |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3506 | JINGLE_APP_RTP_SUPPORT_VIDEO)) |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3507 | caps |= PURPLE_MEDIA_CAPS_VIDEO_SINGLE_DIRECTION | |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3508 | PURPLE_MEDIA_CAPS_VIDEO; |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3509 | if (caps & PURPLE_MEDIA_CAPS_AUDIO && caps & |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3510 | PURPLE_MEDIA_CAPS_VIDEO) |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3511 | caps |= PURPLE_MEDIA_CAPS_AUDIO_VIDEO; |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3512 | if (caps != PURPLE_MEDIA_CAPS_NONE) { |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3513 | if (!jabber_resource_has_capability(jbr, |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3514 | JINGLE_TRANSPORT_ICEUDP) && |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3515 | !jabber_resource_has_capability(jbr, |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3516 | JINGLE_TRANSPORT_RAWUDP)) { |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3517 | purple_debug_info("jingle-rtp", "Buddy doesn't " |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3518 | "support the same transport types\n"); |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3519 | caps = PURPLE_MEDIA_CAPS_NONE; |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3520 | } else |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3521 | caps |= PURPLE_MEDIA_CAPS_MODIFY_SESSION | |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3522 | PURPLE_MEDIA_CAPS_CHANGE_DIRECTION; |
|
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3523 | } |
|
28979
191942cc7747
jabber: Start putting all the namespaces in one location with consistent naming.
Paul Aurich <darkrain42@pidgin.im>
parents:
28928
diff
changeset
|
3524 | if (jabber_resource_has_capability(jbr, NS_GOOGLE_VOICE)) { |
|
26643
401d7a92ecb1
Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents:
26632
diff
changeset
|
3525 | caps |= PURPLE_MEDIA_CAPS_AUDIO; |
|
28979
191942cc7747
jabber: Start putting all the namespaces in one location with consistent naming.
Paul Aurich <darkrain42@pidgin.im>
parents:
28928
diff
changeset
|
3526 | if (jabber_resource_has_capability(jbr, NS_GOOGLE_VIDEO)) |
|
27202
5244a5510e0e
Add Gmail video support.
Michael Ruprecht <maiku@pidgin.im>
parents:
27193
diff
changeset
|
3527 | caps |= PURPLE_MEDIA_CAPS_AUDIO_VIDEO; |
|
5244a5510e0e
Add Gmail video support.
Michael Ruprecht <maiku@pidgin.im>
parents:
27193
diff
changeset
|
3528 | } |
|
29345
5932dfc04845
Oops, just realized that caps can be reset in certain situations, and we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29344
diff
changeset
|
3529 | |
|
5932dfc04845
Oops, just realized that caps can be reset in certain situations, and we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29344
diff
changeset
|
3530 | total |= caps; |
|
23714
a08cf0090382
Check remote JID's capabilities for audio and video XEP support.
Michael Ruprecht <maiku@pidgin.im>
parents:
23712
diff
changeset
|
3531 | } |
|
26170
829055c78478
Choose the transport type according to the responder's caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26167
diff
changeset
|
3532 | |
|
29344
362c4882de89
Fix jabber_get_media_caps for buddies with a single resource that has no
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29264
diff
changeset
|
3533 | if (specific) { |
|
362c4882de89
Fix jabber_get_media_caps for buddies with a single resource that has no
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29264
diff
changeset
|
3534 | g_list_free(specific); |
|
26170
829055c78478
Choose the transport type according to the responder's caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26167
diff
changeset
|
3535 | } |
|
26316
950c0d491c0d
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26292
diff
changeset
|
3536 | |
|
29345
5932dfc04845
Oops, just realized that caps can be reset in certain situations, and we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29344
diff
changeset
|
3537 | return total; |
|
26454
94130b583e0b
Clean up usage of USE_VV in the XMPP protocol.
Michael Ruprecht <maiku@pidgin.im>
parents:
26399
diff
changeset
|
3538 | #else |
|
94130b583e0b
Clean up usage of USE_VV in the XMPP protocol.
Michael Ruprecht <maiku@pidgin.im>
parents:
26399
diff
changeset
|
3539 | return PURPLE_MEDIA_CAPS_NONE; |
|
94130b583e0b
Clean up usage of USE_VV in the XMPP protocol.
Michael Ruprecht <maiku@pidgin.im>
parents:
26399
diff
changeset
|
3540 | #endif |
|
22648
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22646
diff
changeset
|
3541 | } |
|
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22646
diff
changeset
|
3542 | |
|
38838
c93c58dd6ce4
fix up jabber for the xfer cleanups
Gary Kramlich <grim@reaperworld.com>
parents:
38833
diff
changeset
|
3543 | gboolean jabber_can_receive_file(PurpleProtocolXfer *pxfer, PurpleConnection *gc, const char *who) |
|
28879
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3544 | { |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
3545 | JabberStream *js = purple_connection_get_protocol_data(gc); |
|
28879
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3546 | |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3547 | if (js) { |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3548 | JabberBuddy *jb = jabber_buddy_find(js, who, FALSE); |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3549 | GList *iter; |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3550 | gboolean has_resources_without_caps = FALSE; |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3551 | |
|
28928
7c6adca0766f
jabber: don't crash when right-clicking on buddies non on the local roster
Marcus Lundblad <malu@pidgin.im>
parents:
28879
diff
changeset
|
3552 | /* if we didn't find a JabberBuddy, we don't have presence for this |
|
7c6adca0766f
jabber: don't crash when right-clicking on buddies non on the local roster
Marcus Lundblad <malu@pidgin.im>
parents:
28879
diff
changeset
|
3553 | buddy, let's assume they can receive files, disco should tell us |
|
7c6adca0766f
jabber: don't crash when right-clicking on buddies non on the local roster
Marcus Lundblad <malu@pidgin.im>
parents:
28879
diff
changeset
|
3554 | when actually trying */ |
|
7c6adca0766f
jabber: don't crash when right-clicking on buddies non on the local roster
Marcus Lundblad <malu@pidgin.im>
parents:
28879
diff
changeset
|
3555 | if (jb == NULL) |
|
7c6adca0766f
jabber: don't crash when right-clicking on buddies non on the local roster
Marcus Lundblad <malu@pidgin.im>
parents:
28879
diff
changeset
|
3556 | return TRUE; |
|
7c6adca0766f
jabber: don't crash when right-clicking on buddies non on the local roster
Marcus Lundblad <malu@pidgin.im>
parents:
28879
diff
changeset
|
3557 | |
|
28879
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3558 | /* find out if there is any resources without caps */ |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3559 | for (iter = jb->resources; iter ; iter = g_list_next(iter)) { |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3560 | JabberBuddyResource *jbr = (JabberBuddyResource *) iter->data; |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3561 | |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3562 | if (!jabber_resource_know_capabilities(jbr)) { |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3563 | has_resources_without_caps = TRUE; |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3564 | } |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3565 | } |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3566 | |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3567 | if (has_resources_without_caps) { |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
31128
diff
changeset
|
3568 | /* there is at least one resource which we don't have caps for, |
|
28879
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3569 | let's assume they can receive files... */ |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3570 | return TRUE; |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3571 | } else { |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3572 | /* we have caps for all the resources, see if at least one has |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3573 | right caps */ |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3574 | for (iter = jb->resources; iter ; iter = g_list_next(iter)) { |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3575 | JabberBuddyResource *jbr = (JabberBuddyResource *) iter->data; |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3576 | |
|
30474
3f649d2041db
jabber: Don't show resources that we know for sure isn't supporting the file
Marcus Lundblad <malu@pidgin.im>
parents:
30458
diff
changeset
|
3577 | if (jabber_resource_has_capability(jbr, NS_SI_FILE_TRANSFER) |
|
28879
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3578 | && (jabber_resource_has_capability(jbr, |
|
28984
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28982
diff
changeset
|
3579 | NS_BYTESTREAMS) |
|
28979
191942cc7747
jabber: Start putting all the namespaces in one location with consistent naming.
Paul Aurich <darkrain42@pidgin.im>
parents:
28928
diff
changeset
|
3580 | || jabber_resource_has_capability(jbr, NS_IBB))) { |
|
28879
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3581 | return TRUE; |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3582 | } |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3583 | } |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3584 | return FALSE; |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3585 | } |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3586 | } else { |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3587 | return TRUE; |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3588 | } |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3589 | } |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28832
diff
changeset
|
3590 | |
|
29843
5caad147921f
jabber: Fix the type signature of jabber_cmd_mood
Paul Aurich <darkrain42@pidgin.im>
parents:
29827
diff
changeset
|
3591 | static PurpleCmdRet |
|
29827
324821bfa1af
jabber: Added a /mood command make up for the lost PurplePluginAction to
Marcus Lundblad <malu@pidgin.im>
parents:
29787
diff
changeset
|
3592 | jabber_cmd_mood(PurpleConversation *conv, |
|
324821bfa1af
jabber: Added a /mood command make up for the lost PurplePluginAction to
Marcus Lundblad <malu@pidgin.im>
parents:
29787
diff
changeset
|
3593 | const char *cmd, char **args, char **error, void *data) |
|
324821bfa1af
jabber: Added a /mood command make up for the lost PurplePluginAction to
Marcus Lundblad <malu@pidgin.im>
parents:
29787
diff
changeset
|
3594 | { |
|
32617
c74b4bd27e37
Use purple_conversation accessor methods.
Andrew Victor <andrew.victor@mxit.com>
parents:
32300
diff
changeset
|
3595 | PurpleAccount *account = purple_conversation_get_account(conv); |
|
32624
f957ad287bcc
Convert code to use the purple_account accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
3596 | JabberStream *js = purple_connection_get_protocol_data(purple_account_get_connection(account)); |
|
29827
324821bfa1af
jabber: Added a /mood command make up for the lost PurplePluginAction to
Marcus Lundblad <malu@pidgin.im>
parents:
29787
diff
changeset
|
3597 | |
|
324821bfa1af
jabber: Added a /mood command make up for the lost PurplePluginAction to
Marcus Lundblad <malu@pidgin.im>
parents:
29787
diff
changeset
|
3598 | if (js->pep) { |
|
32984
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
32722
diff
changeset
|
3599 | gboolean ret; |
|
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
32722
diff
changeset
|
3600 | |
|
30628
7000a6dbfdb3
I'm pretty sure this is a logical operation, not bitwise.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30587
diff
changeset
|
3601 | if (!args || !args[0]) { |
|
32984
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
32722
diff
changeset
|
3602 | /* No arguments; unset mood */ |
|
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
32722
diff
changeset
|
3603 | ret = jabber_mood_set(js, NULL, NULL); |
|
29827
324821bfa1af
jabber: Added a /mood command make up for the lost PurplePluginAction to
Marcus Lundblad <malu@pidgin.im>
parents:
29787
diff
changeset
|
3604 | } else { |
|
32984
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
32722
diff
changeset
|
3605 | /* At least one argument. Relying on the list of arguments |
|
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
32722
diff
changeset
|
3606 | * being NULL-terminated. |
|
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
32722
diff
changeset
|
3607 | */ |
|
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
32722
diff
changeset
|
3608 | ret = jabber_mood_set(js, args[0], args[1]); |
|
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
32722
diff
changeset
|
3609 | if (!ret) { |
|
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
32722
diff
changeset
|
3610 | /* Let's try again */ |
|
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
32722
diff
changeset
|
3611 | char *tmp = g_strjoin(" ", args[0], args[1], NULL); |
|
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
32722
diff
changeset
|
3612 | ret = jabber_mood_set(js, "undefined", tmp); |
|
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
32722
diff
changeset
|
3613 | g_free(tmp); |
|
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
32722
diff
changeset
|
3614 | } |
|
29827
324821bfa1af
jabber: Added a /mood command make up for the lost PurplePluginAction to
Marcus Lundblad <malu@pidgin.im>
parents:
29787
diff
changeset
|
3615 | } |
|
29843
5caad147921f
jabber: Fix the type signature of jabber_cmd_mood
Paul Aurich <darkrain42@pidgin.im>
parents:
29827
diff
changeset
|
3616 | |
|
32984
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
32722
diff
changeset
|
3617 | if (ret) { |
|
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
32722
diff
changeset
|
3618 | return PURPLE_CMD_RET_OK; |
|
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
32722
diff
changeset
|
3619 | } else { |
|
36089
c035b9a63457
Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36084
diff
changeset
|
3620 | purple_conversation_write_system_message(conv, |
|
32984
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
32722
diff
changeset
|
3621 | _("Failed to specify mood"), |
|
36089
c035b9a63457
Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36084
diff
changeset
|
3622 | PURPLE_MESSAGE_ERROR); |
|
32984
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
32722
diff
changeset
|
3623 | return PURPLE_CMD_RET_FAILED; |
|
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
32722
diff
changeset
|
3624 | } |
|
29827
324821bfa1af
jabber: Added a /mood command make up for the lost PurplePluginAction to
Marcus Lundblad <malu@pidgin.im>
parents:
29787
diff
changeset
|
3625 | } else { |
|
324821bfa1af
jabber: Added a /mood command make up for the lost PurplePluginAction to
Marcus Lundblad <malu@pidgin.im>
parents:
29787
diff
changeset
|
3626 | /* account does not support PEP, can't set a mood */ |
|
36089
c035b9a63457
Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36084
diff
changeset
|
3627 | purple_conversation_write_system_message(conv, |
|
29827
324821bfa1af
jabber: Added a /mood command make up for the lost PurplePluginAction to
Marcus Lundblad <malu@pidgin.im>
parents:
29787
diff
changeset
|
3628 | _("Account does not support PEP, can't set mood"), |
|
36089
c035b9a63457
Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36084
diff
changeset
|
3629 | PURPLE_MESSAGE_ERROR); |
|
29843
5caad147921f
jabber: Fix the type signature of jabber_cmd_mood
Paul Aurich <darkrain42@pidgin.im>
parents:
29827
diff
changeset
|
3630 | return PURPLE_CMD_RET_FAILED; |
|
29827
324821bfa1af
jabber: Added a /mood command make up for the lost PurplePluginAction to
Marcus Lundblad <malu@pidgin.im>
parents:
29787
diff
changeset
|
3631 | } |
|
324821bfa1af
jabber: Added a /mood command make up for the lost PurplePluginAction to
Marcus Lundblad <malu@pidgin.im>
parents:
29787
diff
changeset
|
3632 | } |
|
324821bfa1af
jabber: Added a /mood command make up for the lost PurplePluginAction to
Marcus Lundblad <malu@pidgin.im>
parents:
29787
diff
changeset
|
3633 | |
|
35570
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3634 | static void |
| 37112 | 3635 | jabber_register_commands(PurpleProtocol *protocol) |
| 9130 | 3636 | { |
|
29845
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
3637 | GSList *commands = NULL; |
|
27028
1a2ef7ddb463
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
27027
diff
changeset
|
3638 | PurpleCmdId id; |
| 37112 | 3639 | const gchar *proto_id = purple_protocol_get_id(protocol); |
| 3640 | ||
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
3641 | id = purple_cmd_register("config", "", PURPLE_CMD_P_PROTOCOL, |
| 37112 | 3642 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY, proto_id, |
|
35570
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3643 | jabber_cmd_chat_config, _("config: Configure a chat room."), |
|
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3644 | NULL); |
|
29845
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
3645 | commands = g_slist_prepend(commands, GUINT_TO_POINTER(id)); |
|
27028
1a2ef7ddb463
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
27027
diff
changeset
|
3646 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
3647 | id = purple_cmd_register("configure", "", PURPLE_CMD_P_PROTOCOL, |
| 37112 | 3648 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY, proto_id, |
|
35570
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3649 | jabber_cmd_chat_config, _("configure: Configure a chat room."), |
|
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3650 | NULL); |
|
29845
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
3651 | commands = g_slist_prepend(commands, GUINT_TO_POINTER(id)); |
|
27028
1a2ef7ddb463
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
27027
diff
changeset
|
3652 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
3653 | id = purple_cmd_register("nick", "s", PURPLE_CMD_P_PROTOCOL, |
| 37112 | 3654 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY, proto_id, |
|
35570
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3655 | jabber_cmd_chat_nick, _("nick <new nickname>: " |
|
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3656 | "Change your nickname."), NULL); |
|
29845
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
3657 | commands = g_slist_prepend(commands, GUINT_TO_POINTER(id)); |
|
27028
1a2ef7ddb463
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
27027
diff
changeset
|
3658 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
3659 | id = purple_cmd_register("part", "s", PURPLE_CMD_P_PROTOCOL, |
| 37112 | 3660 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY | |
| 3661 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, proto_id, jabber_cmd_chat_part, | |
|
35570
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3662 | _("part [message]: Leave the room."), NULL); |
|
29845
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
3663 | commands = g_slist_prepend(commands, GUINT_TO_POINTER(id)); |
|
27028
1a2ef7ddb463
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
27027
diff
changeset
|
3664 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
3665 | id = purple_cmd_register("register", "", PURPLE_CMD_P_PROTOCOL, |
| 37112 | 3666 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY, proto_id, |
|
35570
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3667 | jabber_cmd_chat_register, |
|
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3668 | _("register: Register with a chat room."), NULL); |
|
29845
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
3669 | commands = g_slist_prepend(commands, GUINT_TO_POINTER(id)); |
|
27028
1a2ef7ddb463
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
27027
diff
changeset
|
3670 | |
| 9130 | 3671 | /* XXX: there needs to be a core /topic cmd, methinks */ |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
3672 | id = purple_cmd_register("topic", "s", PURPLE_CMD_P_PROTOCOL, |
| 37112 | 3673 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY | |
| 3674 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, proto_id, jabber_cmd_chat_topic, | |
|
35570
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3675 | _("topic [new topic]: View or change the topic."), NULL); |
|
29845
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
3676 | commands = g_slist_prepend(commands, GUINT_TO_POINTER(id)); |
|
27028
1a2ef7ddb463
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
27027
diff
changeset
|
3677 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
3678 | id = purple_cmd_register("ban", "ws", PURPLE_CMD_P_PROTOCOL, |
| 37112 | 3679 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY | |
| 3680 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, proto_id, jabber_cmd_chat_ban, | |
|
35570
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3681 | _("ban <user> [reason]: Ban a user from the room."), |
|
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3682 | NULL); |
|
29845
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
3683 | commands = g_slist_prepend(commands, GUINT_TO_POINTER(id)); |
|
27028
1a2ef7ddb463
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
27027
diff
changeset
|
3684 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
3685 | id = purple_cmd_register("affiliate", "ws", PURPLE_CMD_P_PROTOCOL, |
| 37112 | 3686 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY | |
| 3687 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, proto_id, | |
|
35570
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3688 | jabber_cmd_chat_affiliate, _("affiliate " |
|
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3689 | "<owner|admin|member|outcast|none> [nick1] [nick2] ...: " |
|
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3690 | "Get the users with an affiliation or set users' affiliation " |
|
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3691 | "with the room."), NULL); |
|
29845
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
3692 | commands = g_slist_prepend(commands, GUINT_TO_POINTER(id)); |
|
27028
1a2ef7ddb463
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
27027
diff
changeset
|
3693 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
3694 | id = purple_cmd_register("role", "ws", PURPLE_CMD_P_PROTOCOL, |
| 37112 | 3695 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY | |
| 3696 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, proto_id, jabber_cmd_chat_role, | |
|
35570
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3697 | _("role <moderator|participant|visitor|none> [nick1] " |
|
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3698 | "[nick2] ...: Get the users with a role or set users' role " |
|
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3699 | "with the room."), NULL); |
|
29845
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
3700 | commands = g_slist_prepend(commands, GUINT_TO_POINTER(id)); |
|
27028
1a2ef7ddb463
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
27027
diff
changeset
|
3701 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
3702 | id = purple_cmd_register("invite", "ws", PURPLE_CMD_P_PROTOCOL, |
| 37112 | 3703 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY | |
| 3704 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, proto_id, jabber_cmd_chat_invite, | |
|
35570
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3705 | _("invite <user> [message]: Invite a user to the room."), |
|
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3706 | NULL); |
|
29845
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
3707 | commands = g_slist_prepend(commands, GUINT_TO_POINTER(id)); |
|
27028
1a2ef7ddb463
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
27027
diff
changeset
|
3708 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
3709 | id = purple_cmd_register("join", "ws", PURPLE_CMD_P_PROTOCOL, |
| 37112 | 3710 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY | |
| 3711 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, proto_id, jabber_cmd_chat_join, | |
|
35570
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3712 | _("join: <room[@server]> [password]: Join a chat."), |
|
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3713 | NULL); |
|
29845
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
3714 | commands = g_slist_prepend(commands, GUINT_TO_POINTER(id)); |
|
27028
1a2ef7ddb463
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
27027
diff
changeset
|
3715 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
3716 | id = purple_cmd_register("kick", "ws", PURPLE_CMD_P_PROTOCOL, |
| 37112 | 3717 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY | |
| 3718 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, proto_id, jabber_cmd_chat_kick, | |
|
35570
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3719 | _("kick <user> [reason]: Kick a user from the room."), |
|
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3720 | NULL); |
|
29845
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
3721 | commands = g_slist_prepend(commands, GUINT_TO_POINTER(id)); |
|
27028
1a2ef7ddb463
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
27027
diff
changeset
|
3722 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
3723 | id = purple_cmd_register("msg", "ws", PURPLE_CMD_P_PROTOCOL, |
| 37112 | 3724 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY, proto_id, |
|
35570
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3725 | jabber_cmd_chat_msg, _("msg <user> <message>: " |
|
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3726 | "Send a private message to another user."), NULL); |
|
29845
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
3727 | commands = g_slist_prepend(commands, GUINT_TO_POINTER(id)); |
|
27028
1a2ef7ddb463
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
27027
diff
changeset
|
3728 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
3729 | id = purple_cmd_register("ping", "w", PURPLE_CMD_P_PROTOCOL, |
|
35570
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3730 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM | |
| 37112 | 3731 | PURPLE_CMD_FLAG_PROTOCOL_ONLY, proto_id, jabber_cmd_ping, |
|
35570
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3732 | _("ping <jid>: Ping a user/component/server."), NULL); |
|
29845
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
3733 | commands = g_slist_prepend(commands, GUINT_TO_POINTER(id)); |
|
27028
1a2ef7ddb463
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
27027
diff
changeset
|
3734 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
3735 | id = purple_cmd_register("buzz", "w", PURPLE_CMD_P_PROTOCOL, |
| 37112 | 3736 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PROTOCOL_ONLY | |
| 3737 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, proto_id, jabber_cmd_buzz, | |
|
35570
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3738 | _("buzz: Buzz a user to get their attention"), NULL); |
|
29845
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
3739 | commands = g_slist_prepend(commands, GUINT_TO_POINTER(id)); |
|
29827
324821bfa1af
jabber: Added a /mood command make up for the lost PurplePluginAction to
Marcus Lundblad <malu@pidgin.im>
parents:
29787
diff
changeset
|
3740 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
3741 | id = purple_cmd_register("mood", "ws", PURPLE_CMD_P_PROTOCOL, |
|
35570
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3742 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM | |
| 37112 | 3743 | PURPLE_CMD_FLAG_PROTOCOL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, |
| 3744 | proto_id, jabber_cmd_mood, | |
|
35570
3d01f136f220
Fix xmpp MUC commands for other xmpp-based protocols
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35298
diff
changeset
|
3745 | _("mood <mood> [text]: Set current user mood"), NULL); |
|
29845
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
3746 | commands = g_slist_prepend(commands, GUINT_TO_POINTER(id)); |
|
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
3747 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
3748 | g_hash_table_insert(jabber_cmds, protocol, commands); |
| 9130 | 3749 | } |
| 3750 | ||
|
29845
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
3751 | static void cmds_free_func(gpointer value) |
|
27028
1a2ef7ddb463
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
27027
diff
changeset
|
3752 | { |
|
29845
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
3753 | GSList *commands = value; |
|
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
3754 | while (commands) { |
|
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
3755 | purple_cmd_unregister(GPOINTER_TO_UINT(commands->data)); |
|
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
3756 | commands = g_slist_delete_link(commands, commands); |
|
27028
1a2ef7ddb463
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
27027
diff
changeset
|
3757 | } |
|
1a2ef7ddb463
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
27027
diff
changeset
|
3758 | } |
|
1a2ef7ddb463
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
27027
diff
changeset
|
3759 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
3760 | static void jabber_unregister_commands(PurpleProtocol *protocol) |
|
29845
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
3761 | { |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
3762 | g_hash_table_remove(jabber_cmds, protocol); |
|
29845
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
3763 | } |
|
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
3764 | |
|
36496
e7fe371c60a6
Refactored jabber to use the new API
Ankit Vani <a@nevitus.org>
parents:
36444
diff
changeset
|
3765 | #if 0 |
|
24734
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24721
diff
changeset
|
3766 | /* IPC functions */ |
|
23598
54fe227bf99e
* adding documentation for IPC function contact_has_feature
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23597
diff
changeset
|
3767 | |
|
24734
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24721
diff
changeset
|
3768 | /** |
|
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24721
diff
changeset
|
3769 | * IPC function for determining if a contact supports a certain feature. |
|
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24721
diff
changeset
|
3770 | * |
|
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24721
diff
changeset
|
3771 | * @param account The PurpleAccount |
|
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24721
diff
changeset
|
3772 | * @param jid The full JID of the contact. |
|
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24721
diff
changeset
|
3773 | * @param feature The feature's namespace. |
|
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24721
diff
changeset
|
3774 | * |
|
23598
54fe227bf99e
* adding documentation for IPC function contact_has_feature
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23597
diff
changeset
|
3775 | * @return TRUE if supports feature; else FALSE. |
|
54fe227bf99e
* adding documentation for IPC function contact_has_feature
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23597
diff
changeset
|
3776 | */ |
|
23597
ec0bcdfa1da1
* adding IPC function 'contact_has_feature'
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23596
diff
changeset
|
3777 | static gboolean |
|
24734
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24721
diff
changeset
|
3778 | jabber_ipc_contact_has_feature(PurpleAccount *account, const gchar *jid, |
|
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24721
diff
changeset
|
3779 | const gchar *feature) |
|
23597
ec0bcdfa1da1
* adding IPC function 'contact_has_feature'
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23596
diff
changeset
|
3780 | { |
|
24734
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24721
diff
changeset
|
3781 | PurpleConnection *gc = purple_account_get_connection(account); |
|
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24721
diff
changeset
|
3782 | JabberStream *js; |
|
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24721
diff
changeset
|
3783 | JabberBuddy *jb; |
|
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24721
diff
changeset
|
3784 | JabberBuddyResource *jbr; |
|
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24721
diff
changeset
|
3785 | gchar *resource; |
|
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24721
diff
changeset
|
3786 | |
|
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24721
diff
changeset
|
3787 | if (!purple_account_is_connected(account)) |
|
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24721
diff
changeset
|
3788 | return FALSE; |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
3789 | js = purple_connection_get_protocol_data(gc); |
|
24721
227944e5d0d6
constify, ifdef out an old-caps remnant, and rewrite a little
Paul Aurich <darkrain42@pidgin.im>
parents:
24716
diff
changeset
|
3790 | |
|
27155
53502d71efdd
Remove trailing whitespace that has snuck in.
Paul Aurich <darkrain42@pidgin.im>
parents:
27143
diff
changeset
|
3791 | if (!(resource = jabber_get_resource(jid)) || |
|
24734
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24721
diff
changeset
|
3792 | !(jb = jabber_buddy_find(js, jid, FALSE)) || |
|
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24721
diff
changeset
|
3793 | !(jbr = jabber_buddy_find_resource(jb, resource))) { |
|
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24721
diff
changeset
|
3794 | g_free(resource); |
|
24721
227944e5d0d6
constify, ifdef out an old-caps remnant, and rewrite a little
Paul Aurich <darkrain42@pidgin.im>
parents:
24716
diff
changeset
|
3795 | return FALSE; |
|
24734
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24721
diff
changeset
|
3796 | } |
|
24721
227944e5d0d6
constify, ifdef out an old-caps remnant, and rewrite a little
Paul Aurich <darkrain42@pidgin.im>
parents:
24716
diff
changeset
|
3797 | |
|
24734
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24721
diff
changeset
|
3798 | g_free(resource); |
|
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24721
diff
changeset
|
3799 | |
|
24802
eb481e98ac6a
Sprinkle jabber_resource_has_capability in places
Paul Aurich <darkrain42@pidgin.im>
parents:
24737
diff
changeset
|
3800 | return jabber_resource_has_capability(jbr, feature); |
|
23596
164fbee281c1
* fixing a bug in jabber_caps_compare()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23586
diff
changeset
|
3801 | } |
|
164fbee281c1
* fixing a bug in jabber_caps_compare()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23586
diff
changeset
|
3802 | |
|
23599
ac402ffdcbec
* removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23598
diff
changeset
|
3803 | static void |
|
24721
227944e5d0d6
constify, ifdef out an old-caps remnant, and rewrite a little
Paul Aurich <darkrain42@pidgin.im>
parents:
24716
diff
changeset
|
3804 | jabber_ipc_add_feature(const gchar *feature) |
|
23599
ac402ffdcbec
* removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23598
diff
changeset
|
3805 | { |
|
24721
227944e5d0d6
constify, ifdef out an old-caps remnant, and rewrite a little
Paul Aurich <darkrain42@pidgin.im>
parents:
24716
diff
changeset
|
3806 | if (!feature) |
|
227944e5d0d6
constify, ifdef out an old-caps remnant, and rewrite a little
Paul Aurich <darkrain42@pidgin.im>
parents:
24716
diff
changeset
|
3807 | return; |
| 23600 | 3808 | jabber_add_feature(feature, 0); |
|
24721
227944e5d0d6
constify, ifdef out an old-caps remnant, and rewrite a little
Paul Aurich <darkrain42@pidgin.im>
parents:
24716
diff
changeset
|
3809 | |
|
227944e5d0d6
constify, ifdef out an old-caps remnant, and rewrite a little
Paul Aurich <darkrain42@pidgin.im>
parents:
24716
diff
changeset
|
3810 | /* send presence with new caps info for all connected accounts */ |
|
23601
f7e44345f4b9
* implemented jabber_caps_broadcast_change() and finished jabber_ipc_add_feature() IPC function
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23600
diff
changeset
|
3811 | jabber_caps_broadcast_change(); |
| 9130 | 3812 | } |
|
36496
e7fe371c60a6
Refactored jabber to use the new API
Ankit Vani <a@nevitus.org>
parents:
36444
diff
changeset
|
3813 | #endif |
| 9130 | 3814 | |
|
36668
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3815 | static PurpleAccount *find_acct(const char *protocol, const char *acct_id) |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3816 | { |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3817 | PurpleAccount *acct = NULL; |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3818 | |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3819 | /* If we have a specific acct, use it */ |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3820 | if (acct_id) { |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3821 | acct = purple_accounts_find(acct_id, protocol); |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3822 | if (acct && !purple_account_is_connected(acct)) |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3823 | acct = NULL; |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3824 | } else { /* Otherwise find an active account for the protocol */ |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3825 | GList *l = purple_accounts_get_all(); |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3826 | while (l) { |
| 38358 | 3827 | if (purple_strequal(protocol, purple_account_get_protocol_id(l->data)) |
|
36668
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3828 | && purple_account_is_connected(l->data)) { |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3829 | acct = l->data; |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3830 | break; |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3831 | } |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3832 | l = l->next; |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3833 | } |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3834 | } |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3835 | |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3836 | return acct; |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3837 | } |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3838 | |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3839 | static gboolean xmpp_uri_handler(const char *proto, const char *user, GHashTable *params) |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3840 | { |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3841 | char *acct_id = params ? g_hash_table_lookup(params, "account") : NULL; |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3842 | PurpleAccount *acct; |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3843 | |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3844 | if (g_ascii_strcasecmp(proto, "xmpp")) |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3845 | return FALSE; |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3846 | |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3847 | acct = find_acct(proto, acct_id); |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3848 | |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3849 | if (!acct) |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3850 | return FALSE; |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3851 | |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3852 | /* xmpp:romeo@montague.net?message;subject=Test%20Message;body=Here%27s%20a%20test%20message */ |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3853 | /* params is NULL if the URI has no '?' (or anything after it) */ |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3854 | if (!params || g_hash_table_lookup_extended(params, "message", NULL, NULL)) { |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3855 | char *body = g_hash_table_lookup(params, "body"); |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3856 | if (user && *user) { |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3857 | PurpleIMConversation *im = |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3858 | purple_im_conversation_new(acct, user); |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3859 | purple_conversation_present(PURPLE_CONVERSATION(im)); |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3860 | if (body && *body) |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3861 | purple_conversation_send_confirm(PURPLE_CONVERSATION(im), body); |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3862 | } |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3863 | } else if (g_hash_table_lookup_extended(params, "roster", NULL, NULL)) { |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3864 | char *name = g_hash_table_lookup(params, "name"); |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3865 | if (user && *user) |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3866 | purple_blist_request_add_buddy(acct, user, NULL, name); |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3867 | } else if (g_hash_table_lookup_extended(params, "join", NULL, NULL)) { |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3868 | PurpleConnection *gc = purple_account_get_connection(acct); |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3869 | if (user && *user) { |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3870 | GHashTable *params = jabber_chat_info_defaults(gc, user); |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3871 | jabber_chat_join(gc, params); |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3872 | } |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3873 | return TRUE; |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3874 | } |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3875 | |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3876 | return FALSE; |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
3877 | } |
| 9130 | 3878 | |
|
29844
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
3879 | static void |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
3880 | jabber_do_init(void) |
| 14358 | 3881 | { |
|
27286
f637c4c27815
Fixup after propagating new caps stuff
Marcus Lundblad <malu@pidgin.im>
parents:
27285
diff
changeset
|
3882 | GHashTable *ui_info = purple_core_get_ui_info(); |
|
27293
5234a1fe1531
Avoid an assertion when the UI doesn't have a get_ui_info ui_op
Paul Aurich <darkrain42@pidgin.im>
parents:
27292
diff
changeset
|
3883 | const gchar *ui_type; |
|
27756
cc054031e076
Identify clients in XMPP caps based on the ui_info hash. Closes #9672.
Paul Aurich <darkrain42@pidgin.im>
parents:
27755
diff
changeset
|
3884 | const gchar *type = "pc"; /* default client type, if unknown or |
|
27286
f637c4c27815
Fixup after propagating new caps stuff
Marcus Lundblad <malu@pidgin.im>
parents:
27285
diff
changeset
|
3885 | unspecified */ |
|
27756
cc054031e076
Identify clients in XMPP caps based on the ui_info hash. Closes #9672.
Paul Aurich <darkrain42@pidgin.im>
parents:
27755
diff
changeset
|
3886 | const gchar *ui_name = NULL; |
|
29847
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3887 | #ifdef HAVE_CYRUS_SASL |
|
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3888 | /* We really really only want to do this once per process */ |
|
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3889 | static gboolean sasl_initialized = FALSE; |
|
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3890 | #ifdef _WIN32 |
|
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3891 | UINT old_error_mode; |
|
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3892 | gchar *sasldir; |
|
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3893 | #endif |
|
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3894 | int ret; |
|
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3895 | #endif |
|
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3896 | |
|
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3897 | /* XXX - If any other plugin wants SASL this won't be good ... */ |
|
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3898 | #ifdef HAVE_CYRUS_SASL |
|
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3899 | if (!sasl_initialized) { |
|
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3900 | sasl_initialized = TRUE; |
|
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3901 | #ifdef _WIN32 |
|
35901
5bcb306a4edf
cross-win32: FHS support for win32
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35823
diff
changeset
|
3902 | sasldir = g_build_filename(wpurple_bin_dir(), "sasl2", NULL); |
|
29847
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3903 | sasl_set_path(SASL_PATH_TYPE_PLUGIN, sasldir); |
|
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3904 | g_free(sasldir); |
|
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3905 | /* Suppress error popups for failing to load sasl plugins */ |
|
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3906 | old_error_mode = SetErrorMode(SEM_FAILCRITICALERRORS); |
|
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3907 | #endif |
|
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3908 | if ((ret = sasl_client_init(NULL)) != SASL_OK) { |
|
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3909 | purple_debug_error("xmpp", "Error (%d) initializing SASL.\n", ret); |
|
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3910 | } |
|
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3911 | #ifdef _WIN32 |
|
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3912 | /* Restore the original error mode */ |
|
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3913 | SetErrorMode(old_error_mode); |
|
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3914 | #endif |
|
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3915 | } |
|
c4713809ccce
jabber: Only initialize SASL once, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29845
diff
changeset
|
3916 | #endif |
|
27286
f637c4c27815
Fixup after propagating new caps stuff
Marcus Lundblad <malu@pidgin.im>
parents:
27285
diff
changeset
|
3917 | |
|
29845
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
3918 | jabber_cmds = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, cmds_free_func); |
|
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
3919 | |
|
27293
5234a1fe1531
Avoid an assertion when the UI doesn't have a get_ui_info ui_op
Paul Aurich <darkrain42@pidgin.im>
parents:
27292
diff
changeset
|
3920 | ui_type = ui_info ? g_hash_table_lookup(ui_info, "client_type") : NULL; |
|
27286
f637c4c27815
Fixup after propagating new caps stuff
Marcus Lundblad <malu@pidgin.im>
parents:
27285
diff
changeset
|
3921 | if (ui_type) { |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
3922 | if (purple_strequal(ui_type, "pc") || |
|
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
3923 | purple_strequal(ui_type, "console") || |
|
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
3924 | purple_strequal(ui_type, "phone") || |
|
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
3925 | purple_strequal(ui_type, "handheld") || |
|
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
3926 | purple_strequal(ui_type, "web") || |
|
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
3927 | purple_strequal(ui_type, "bot")) { |
|
27286
f637c4c27815
Fixup after propagating new caps stuff
Marcus Lundblad <malu@pidgin.im>
parents:
27285
diff
changeset
|
3928 | type = ui_type; |
|
f637c4c27815
Fixup after propagating new caps stuff
Marcus Lundblad <malu@pidgin.im>
parents:
27285
diff
changeset
|
3929 | } |
|
f637c4c27815
Fixup after propagating new caps stuff
Marcus Lundblad <malu@pidgin.im>
parents:
27285
diff
changeset
|
3930 | } |
|
23586
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23428
diff
changeset
|
3931 | |
|
27756
cc054031e076
Identify clients in XMPP caps based on the ui_info hash. Closes #9672.
Paul Aurich <darkrain42@pidgin.im>
parents:
27755
diff
changeset
|
3932 | if (ui_info) |
|
cc054031e076
Identify clients in XMPP caps based on the ui_info hash. Closes #9672.
Paul Aurich <darkrain42@pidgin.im>
parents:
27755
diff
changeset
|
3933 | ui_name = g_hash_table_lookup(ui_info, "name"); |
|
cc054031e076
Identify clients in XMPP caps based on the ui_info hash. Closes #9672.
Paul Aurich <darkrain42@pidgin.im>
parents:
27755
diff
changeset
|
3934 | if (ui_name == NULL) |
|
cc054031e076
Identify clients in XMPP caps based on the ui_info hash. Closes #9672.
Paul Aurich <darkrain42@pidgin.im>
parents:
27755
diff
changeset
|
3935 | ui_name = PACKAGE; |
|
cc054031e076
Identify clients in XMPP caps based on the ui_info hash. Closes #9672.
Paul Aurich <darkrain42@pidgin.im>
parents:
27755
diff
changeset
|
3936 | |
|
cc054031e076
Identify clients in XMPP caps based on the ui_info hash. Closes #9672.
Paul Aurich <darkrain42@pidgin.im>
parents:
27755
diff
changeset
|
3937 | jabber_add_identity("client", type, NULL, ui_name); |
|
23586
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23428
diff
changeset
|
3938 | |
|
23597
ec0bcdfa1da1
* adding IPC function 'contact_has_feature'
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23596
diff
changeset
|
3939 | /* initialize jabber_features list */ |
|
37182
2706e3f48315
Replace 0s that represent null function pointers with NULL
mmcconville@mykolab.com
parents:
37164
diff
changeset
|
3940 | jabber_add_feature(NS_LAST_ACTIVITY, NULL); |
|
2706e3f48315
Replace 0s that represent null function pointers with NULL
mmcconville@mykolab.com
parents:
37164
diff
changeset
|
3941 | jabber_add_feature(NS_OOB_IQ_DATA, NULL); |
|
2706e3f48315
Replace 0s that represent null function pointers with NULL
mmcconville@mykolab.com
parents:
37164
diff
changeset
|
3942 | jabber_add_feature(NS_ENTITY_TIME, NULL); |
|
2706e3f48315
Replace 0s that represent null function pointers with NULL
mmcconville@mykolab.com
parents:
37164
diff
changeset
|
3943 | jabber_add_feature("jabber:iq:version", NULL); |
|
2706e3f48315
Replace 0s that represent null function pointers with NULL
mmcconville@mykolab.com
parents:
37164
diff
changeset
|
3944 | jabber_add_feature("jabber:x:conference", NULL); |
|
2706e3f48315
Replace 0s that represent null function pointers with NULL
mmcconville@mykolab.com
parents:
37164
diff
changeset
|
3945 | jabber_add_feature(NS_BYTESTREAMS, NULL); |
|
2706e3f48315
Replace 0s that represent null function pointers with NULL
mmcconville@mykolab.com
parents:
37164
diff
changeset
|
3946 | jabber_add_feature("http://jabber.org/protocol/caps", NULL); |
|
2706e3f48315
Replace 0s that represent null function pointers with NULL
mmcconville@mykolab.com
parents:
37164
diff
changeset
|
3947 | jabber_add_feature("http://jabber.org/protocol/chatstates", NULL); |
|
2706e3f48315
Replace 0s that represent null function pointers with NULL
mmcconville@mykolab.com
parents:
37164
diff
changeset
|
3948 | jabber_add_feature(NS_DISCO_INFO, NULL); |
|
2706e3f48315
Replace 0s that represent null function pointers with NULL
mmcconville@mykolab.com
parents:
37164
diff
changeset
|
3949 | jabber_add_feature(NS_DISCO_ITEMS, NULL); |
|
2706e3f48315
Replace 0s that represent null function pointers with NULL
mmcconville@mykolab.com
parents:
37164
diff
changeset
|
3950 | jabber_add_feature(NS_IBB, NULL); |
|
2706e3f48315
Replace 0s that represent null function pointers with NULL
mmcconville@mykolab.com
parents:
37164
diff
changeset
|
3951 | jabber_add_feature("http://jabber.org/protocol/muc", NULL); |
|
2706e3f48315
Replace 0s that represent null function pointers with NULL
mmcconville@mykolab.com
parents:
37164
diff
changeset
|
3952 | jabber_add_feature("http://jabber.org/protocol/muc#user", NULL); |
|
2706e3f48315
Replace 0s that represent null function pointers with NULL
mmcconville@mykolab.com
parents:
37164
diff
changeset
|
3953 | jabber_add_feature("http://jabber.org/protocol/si", NULL); |
|
2706e3f48315
Replace 0s that represent null function pointers with NULL
mmcconville@mykolab.com
parents:
37164
diff
changeset
|
3954 | jabber_add_feature(NS_SI_FILE_TRANSFER, NULL); |
|
2706e3f48315
Replace 0s that represent null function pointers with NULL
mmcconville@mykolab.com
parents:
37164
diff
changeset
|
3955 | jabber_add_feature(NS_XHTML_IM, NULL); |
|
2706e3f48315
Replace 0s that represent null function pointers with NULL
mmcconville@mykolab.com
parents:
37164
diff
changeset
|
3956 | jabber_add_feature(NS_PING, NULL); |
|
26659
918350344dc7
Fix merge: Move the Jingle features to jabber.c
Paul Aurich <darkrain42@pidgin.im>
parents:
26658
diff
changeset
|
3957 | |
|
27028
1a2ef7ddb463
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
27027
diff
changeset
|
3958 | /* Buzz/Attention */ |
|
28979
191942cc7747
jabber: Start putting all the namespaces in one location with consistent naming.
Paul Aurich <darkrain42@pidgin.im>
parents:
28928
diff
changeset
|
3959 | jabber_add_feature(NS_ATTENTION, jabber_buzz_isenabled); |
|
27028
1a2ef7ddb463
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
27027
diff
changeset
|
3960 | |
|
1a2ef7ddb463
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
27027
diff
changeset
|
3961 | /* Bits Of Binary */ |
|
37182
2706e3f48315
Replace 0s that represent null function pointers with NULL
mmcconville@mykolab.com
parents:
37164
diff
changeset
|
3962 | jabber_add_feature(NS_BOB, NULL); |
|
27028
1a2ef7ddb463
Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents:
27027
diff
changeset
|
3963 | |
|
26659
918350344dc7
Fix merge: Move the Jingle features to jabber.c
Paul Aurich <darkrain42@pidgin.im>
parents:
26658
diff
changeset
|
3964 | /* Jingle features! */ |
|
37182
2706e3f48315
Replace 0s that represent null function pointers with NULL
mmcconville@mykolab.com
parents:
37164
diff
changeset
|
3965 | jabber_add_feature(JINGLE, NULL); |
|
26666
4c95bdba5627
Advertise ICEUDP only when libnice is available
Paul Aurich <darkrain42@pidgin.im>
parents:
26665
diff
changeset
|
3966 | |
|
26665
16f54aa7c7d1
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <darkrain42@pidgin.im>
parents:
26663
diff
changeset
|
3967 | #ifdef USE_VV |
|
28980
4a0f7340b539
jabber: Add the missing file and fix up the Google session namespaces
Paul Aurich <darkrain42@pidgin.im>
parents:
28979
diff
changeset
|
3968 | jabber_add_feature(NS_GOOGLE_PROTOCOL_SESSION, jabber_audio_enabled); |
|
28979
191942cc7747
jabber: Start putting all the namespaces in one location with consistent naming.
Paul Aurich <darkrain42@pidgin.im>
parents:
28928
diff
changeset
|
3969 | jabber_add_feature(NS_GOOGLE_VOICE, jabber_audio_enabled); |
|
191942cc7747
jabber: Start putting all the namespaces in one location with consistent naming.
Paul Aurich <darkrain42@pidgin.im>
parents:
28928
diff
changeset
|
3970 | jabber_add_feature(NS_GOOGLE_VIDEO, jabber_video_enabled); |
|
191942cc7747
jabber: Start putting all the namespaces in one location with consistent naming.
Paul Aurich <darkrain42@pidgin.im>
parents:
28928
diff
changeset
|
3971 | jabber_add_feature(NS_GOOGLE_CAMERA, jabber_video_enabled); |
|
37182
2706e3f48315
Replace 0s that represent null function pointers with NULL
mmcconville@mykolab.com
parents:
37164
diff
changeset
|
3972 | jabber_add_feature(JINGLE_APP_RTP, NULL); |
|
26668
ef06285f3b64
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents:
26666
diff
changeset
|
3973 | jabber_add_feature(JINGLE_APP_RTP_SUPPORT_AUDIO, jabber_audio_enabled); |
|
ef06285f3b64
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents:
26666
diff
changeset
|
3974 | jabber_add_feature(JINGLE_APP_RTP_SUPPORT_VIDEO, jabber_video_enabled); |
|
37182
2706e3f48315
Replace 0s that represent null function pointers with NULL
mmcconville@mykolab.com
parents:
37164
diff
changeset
|
3975 | jabber_add_feature(JINGLE_TRANSPORT_RAWUDP, NULL); |
|
2706e3f48315
Replace 0s that represent null function pointers with NULL
mmcconville@mykolab.com
parents:
37164
diff
changeset
|
3976 | jabber_add_feature(JINGLE_TRANSPORT_ICEUDP, NULL); |
|
29541
37f0297ff3ad
Rebroadcast XMPP caps whenever the UI caps change.
Michael Ruprecht <maiku@pidgin.im>
parents:
28656
diff
changeset
|
3977 | |
|
37f0297ff3ad
Rebroadcast XMPP caps whenever the UI caps change.
Michael Ruprecht <maiku@pidgin.im>
parents:
28656
diff
changeset
|
3978 | g_signal_connect(G_OBJECT(purple_media_manager_get()), "ui-caps-changed", |
|
37f0297ff3ad
Rebroadcast XMPP caps whenever the UI caps change.
Michael Ruprecht <maiku@pidgin.im>
parents:
28656
diff
changeset
|
3979 | G_CALLBACK(jabber_caps_broadcast_change), NULL); |
|
26665
16f54aa7c7d1
Advertise video/voice features only when the UI says it has those caps
Paul Aurich <darkrain42@pidgin.im>
parents:
26663
diff
changeset
|
3980 | #endif |
|
26659
918350344dc7
Fix merge: Move the Jingle features to jabber.c
Paul Aurich <darkrain42@pidgin.im>
parents:
26658
diff
changeset
|
3981 | |
|
29844
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
3982 | /* reverse order of unload_plugin */ |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
3983 | jabber_iq_init(); |
|
29848
999c0235bbc6
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <darkrain42@pidgin.im>
parents:
29847
diff
changeset
|
3984 | jabber_presence_init(); |
|
29844
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
3985 | jabber_caps_init(); |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
3986 | /* PEP things should be init via jabber_pep_init, not here */ |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
3987 | jabber_pep_init(); |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
3988 | jabber_data_init(); |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
3989 | jabber_bosh_init(); |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
3990 | |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
3991 | /* TODO: Implement adding and retrieving own features via IPC API */ |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
3992 | |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
3993 | jabber_ibb_init(); |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
3994 | jabber_si_init(); |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
3995 | |
|
28855
c5bc85f9c00e
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <darkrain42@pidgin.im>
parents:
28832
diff
changeset
|
3996 | jabber_auth_init(); |
|
29844
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
3997 | } |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
3998 | |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
3999 | static void |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4000 | jabber_do_uninit(void) |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4001 | { |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4002 | /* reverse order of jabber_do_init */ |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4003 | jabber_bosh_uninit(); |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4004 | jabber_data_uninit(); |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4005 | jabber_si_uninit(); |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4006 | jabber_ibb_uninit(); |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4007 | /* PEP things should be uninit via jabber_pep_uninit, not here */ |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4008 | jabber_pep_uninit(); |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4009 | jabber_caps_uninit(); |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4010 | jabber_presence_uninit(); |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4011 | jabber_iq_uninit(); |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4012 | |
| 30036 | 4013 | #ifdef USE_VV |
| 4014 | g_signal_handlers_disconnect_by_func(G_OBJECT(purple_media_manager_get()), | |
| 4015 | G_CALLBACK(jabber_caps_broadcast_change), NULL); | |
| 4016 | #endif | |
| 4017 | ||
|
29844
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4018 | jabber_auth_uninit(); |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4019 | jabber_features_destroy(); |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4020 | jabber_identities_destroy(); |
|
29845
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
4021 | |
|
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
4022 | g_hash_table_destroy(jabber_cmds); |
|
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
4023 | jabber_cmds = NULL; |
|
29844
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4024 | } |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4025 | |
|
36684
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
4026 | static void jabber_init_protocol(PurpleProtocol *protocol) |
|
29844
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4027 | { |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4028 | ++plugin_ref; |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4029 | |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4030 | if (plugin_ref == 1) |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4031 | jabber_do_init(); |
|
28855
c5bc85f9c00e
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <darkrain42@pidgin.im>
parents:
28832
diff
changeset
|
4032 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
4033 | jabber_register_commands(protocol); |
|
29845
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
4034 | |
|
36496
e7fe371c60a6
Refactored jabber to use the new API
Ankit Vani <a@nevitus.org>
parents:
36444
diff
changeset
|
4035 | #if 0 |
|
23597
ec0bcdfa1da1
* adding IPC function 'contact_has_feature'
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23596
diff
changeset
|
4036 | /* IPC functions */ |
|
ec0bcdfa1da1
* adding IPC function 'contact_has_feature'
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23596
diff
changeset
|
4037 | purple_plugin_ipc_register(plugin, "contact_has_feature", PURPLE_CALLBACK(jabber_ipc_contact_has_feature), |
|
24734
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24721
diff
changeset
|
4038 | purple_marshal_BOOLEAN__POINTER_POINTER_POINTER, |
|
34810
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4039 | G_TYPE_BOOLEAN, 3, |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4040 | PURPLE_TYPE_ACCOUNT, G_TYPE_STRING, G_TYPE_STRING); |
|
27103
815af6acd59b
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents:
27028
diff
changeset
|
4041 | |
| 23600 | 4042 | purple_plugin_ipc_register(plugin, "add_feature", PURPLE_CALLBACK(jabber_ipc_add_feature), |
| 4043 | purple_marshal_VOID__POINTER, | |
|
34810
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4044 | G_TYPE_NONE, 1, G_TYPE_STRING); |
|
27223
d41e83f82148
Examples for the namespace-(un)registering of IQs and added IPC versions
Paul Aurich <darkrain42@pidgin.im>
parents:
27221
diff
changeset
|
4045 | |
|
d41e83f82148
Examples for the namespace-(un)registering of IQs and added IPC versions
Paul Aurich <darkrain42@pidgin.im>
parents:
27221
diff
changeset
|
4046 | purple_plugin_ipc_register(plugin, "register_namespace_watcher", |
|
d41e83f82148
Examples for the namespace-(un)registering of IQs and added IPC versions
Paul Aurich <darkrain42@pidgin.im>
parents:
27221
diff
changeset
|
4047 | PURPLE_CALLBACK(jabber_iq_signal_register), |
|
d41e83f82148
Examples for the namespace-(un)registering of IQs and added IPC versions
Paul Aurich <darkrain42@pidgin.im>
parents:
27221
diff
changeset
|
4048 | purple_marshal_VOID__POINTER_POINTER, |
|
34810
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4049 | G_TYPE_NONE, 2, |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4050 | G_TYPE_STRING, /* node */ |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4051 | G_TYPE_STRING); /* namespace */ |
|
27223
d41e83f82148
Examples for the namespace-(un)registering of IQs and added IPC versions
Paul Aurich <darkrain42@pidgin.im>
parents:
27221
diff
changeset
|
4052 | |
|
d41e83f82148
Examples for the namespace-(un)registering of IQs and added IPC versions
Paul Aurich <darkrain42@pidgin.im>
parents:
27221
diff
changeset
|
4053 | purple_plugin_ipc_register(plugin, "unregister_namespace_watcher", |
|
d41e83f82148
Examples for the namespace-(un)registering of IQs and added IPC versions
Paul Aurich <darkrain42@pidgin.im>
parents:
27221
diff
changeset
|
4054 | PURPLE_CALLBACK(jabber_iq_signal_unregister), |
|
d41e83f82148
Examples for the namespace-(un)registering of IQs and added IPC versions
Paul Aurich <darkrain42@pidgin.im>
parents:
27221
diff
changeset
|
4055 | purple_marshal_VOID__POINTER_POINTER, |
|
34810
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4056 | G_TYPE_NONE, 2, |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4057 | G_TYPE_STRING, /* node */ |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4058 | G_TYPE_STRING); /* namespace */ |
|
36496
e7fe371c60a6
Refactored jabber to use the new API
Ankit Vani <a@nevitus.org>
parents:
36444
diff
changeset
|
4059 | #endif |
|
29844
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4060 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
4061 | purple_signal_register(protocol, "jabber-register-namespace-watcher", |
|
29844
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4062 | purple_marshal_VOID__POINTER_POINTER, |
|
34810
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4063 | G_TYPE_NONE, 2, |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4064 | G_TYPE_STRING, /* node */ |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4065 | G_TYPE_STRING); /* namespace */ |
|
29844
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4066 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
4067 | purple_signal_register(protocol, "jabber-unregister-namespace-watcher", |
|
29844
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4068 | purple_marshal_VOID__POINTER_POINTER, |
|
34810
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4069 | G_TYPE_NONE, 2, |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4070 | G_TYPE_STRING, /* node */ |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4071 | G_TYPE_STRING); /* namespace */ |
|
29844
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4072 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
4073 | purple_signal_connect(protocol, "jabber-register-namespace-watcher", |
|
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
4074 | protocol, PURPLE_CALLBACK(jabber_iq_signal_register), NULL); |
|
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
4075 | purple_signal_connect(protocol, "jabber-unregister-namespace-watcher", |
|
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
4076 | protocol, PURPLE_CALLBACK(jabber_iq_signal_unregister), NULL); |
|
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
4077 | |
|
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
4078 | |
|
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
4079 | purple_signal_register(protocol, "jabber-receiving-xmlnode", |
|
34810
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4080 | purple_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2, |
|
34815
7fdf8dca3bc1
Changed types for 'outgoing' values to G_TYPE_POINTER in signal registrations in protocols
Ankit Vani <a@nevitus.org>
parents:
34810
diff
changeset
|
4081 | PURPLE_TYPE_CONNECTION, |
|
35189
e4c046cc8a77
Use more understandable descriptions in places where outgoing purple values and old cipher API was used
Ankit Vani <a@nevitus.org>
parents:
35044
diff
changeset
|
4082 | G_TYPE_POINTER); /* pointer to a PurpleXmlNode* */ |
|
29844
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4083 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
4084 | purple_signal_register(protocol, "jabber-sending-xmlnode", |
|
34810
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4085 | purple_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2, |
|
34815
7fdf8dca3bc1
Changed types for 'outgoing' values to G_TYPE_POINTER in signal registrations in protocols
Ankit Vani <a@nevitus.org>
parents:
34810
diff
changeset
|
4086 | PURPLE_TYPE_CONNECTION, |
|
35189
e4c046cc8a77
Use more understandable descriptions in places where outgoing purple values and old cipher API was used
Ankit Vani <a@nevitus.org>
parents:
35044
diff
changeset
|
4087 | G_TYPE_POINTER); /* pointer to a PurpleXmlNode* */ |
|
29844
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4088 | |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4089 | /* |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4090 | * Do not remove this or the plugin will fail. Completely. You have been |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4091 | * warned! |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4092 | */ |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
4093 | purple_signal_connect_priority(protocol, "jabber-sending-xmlnode", |
|
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
4094 | protocol, PURPLE_CALLBACK(jabber_send_signal_cb), |
|
29844
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4095 | NULL, PURPLE_SIGNAL_PRIORITY_HIGHEST); |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4096 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
4097 | purple_signal_register(protocol, "jabber-sending-text", |
|
34810
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4098 | purple_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2, |
|
34815
7fdf8dca3bc1
Changed types for 'outgoing' values to G_TYPE_POINTER in signal registrations in protocols
Ankit Vani <a@nevitus.org>
parents:
34810
diff
changeset
|
4099 | PURPLE_TYPE_CONNECTION, |
|
7fdf8dca3bc1
Changed types for 'outgoing' values to G_TYPE_POINTER in signal registrations in protocols
Ankit Vani <a@nevitus.org>
parents:
34810
diff
changeset
|
4100 | G_TYPE_POINTER); /* pointer to a string */ |
|
29844
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4101 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
4102 | purple_signal_register(protocol, "jabber-receiving-message", |
|
29844
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4103 | purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER_POINTER, |
|
34810
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4104 | G_TYPE_BOOLEAN, 6, |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4105 | PURPLE_TYPE_CONNECTION, |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4106 | G_TYPE_STRING, /* type */ |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4107 | G_TYPE_STRING, /* id */ |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4108 | G_TYPE_STRING, /* from */ |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4109 | G_TYPE_STRING, /* to */ |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4110 | PURPLE_TYPE_XMLNODE); |
|
29844
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4111 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
4112 | purple_signal_register(protocol, "jabber-receiving-iq", |
|
29844
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4113 | purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER, |
|
34810
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4114 | G_TYPE_BOOLEAN, 5, |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4115 | PURPLE_TYPE_CONNECTION, |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4116 | G_TYPE_STRING, /* type */ |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4117 | G_TYPE_STRING, /* id */ |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4118 | G_TYPE_STRING, /* from */ |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4119 | PURPLE_TYPE_XMLNODE); |
|
29844
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4120 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
4121 | purple_signal_register(protocol, "jabber-watched-iq", |
|
29844
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4122 | purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER, |
|
34810
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4123 | G_TYPE_BOOLEAN, 5, |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4124 | PURPLE_TYPE_CONNECTION, |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4125 | G_TYPE_STRING, /* type */ |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4126 | G_TYPE_STRING, /* id */ |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4127 | G_TYPE_STRING, /* from */ |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4128 | PURPLE_TYPE_XMLNODE); /* child */ |
|
29844
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4129 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
4130 | purple_signal_register(protocol, "jabber-receiving-presence", |
|
29844
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4131 | purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER, |
|
34810
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4132 | G_TYPE_BOOLEAN, 4, |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4133 | PURPLE_TYPE_CONNECTION, |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4134 | G_TYPE_STRING, /* type */ |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4135 | G_TYPE_STRING, /* from */ |
|
8a3d21b27a22
Refactored bonjour, gg, irc and jabber to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
4136 | PURPLE_TYPE_XMLNODE); |
| 14358 | 4137 | } |
|
24737
b8a96a07e7ac
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <darkrain42@pidgin.im>
parents:
24735
diff
changeset
|
4138 | |
|
36684
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
4139 | static void jabber_uninit_protocol(PurpleProtocol *protocol) |
|
24737
b8a96a07e7ac
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <darkrain42@pidgin.im>
parents:
24735
diff
changeset
|
4140 | { |
|
29844
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4141 | g_return_if_fail(plugin_ref > 0); |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4142 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
4143 | purple_signals_unregister_by_instance(protocol); |
|
36496
e7fe371c60a6
Refactored jabber to use the new API
Ankit Vani <a@nevitus.org>
parents:
36444
diff
changeset
|
4144 | #if 0 |
|
28832
4e4b609b85e4
jabber: Use purple_connection_get_prpl() instead of jabber_plugin.
Paul Aurich <darkrain42@pidgin.im>
parents:
28830
diff
changeset
|
4145 | purple_plugin_ipc_unregister_all(plugin); |
|
36496
e7fe371c60a6
Refactored jabber to use the new API
Ankit Vani <a@nevitus.org>
parents:
36444
diff
changeset
|
4146 | #endif |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
4147 | jabber_unregister_commands(protocol); |
|
29845
5684cbe452f7
jabber: And fix up the commands now to be per-plugin
Paul Aurich <darkrain42@pidgin.im>
parents:
29844
diff
changeset
|
4148 | |
|
29844
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4149 | --plugin_ref; |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4150 | if (plugin_ref == 0) |
|
6c6e346e1390
jabber: Move the initialization into the jabber plugin, and only initialize some things once.
Paul Aurich <darkrain42@pidgin.im>
parents:
29843
diff
changeset
|
4151 | jabber_do_uninit(); |
|
24737
b8a96a07e7ac
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <darkrain42@pidgin.im>
parents:
24735
diff
changeset
|
4152 | } |
|
36582
095b9c85c45c
Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents:
36574
diff
changeset
|
4153 | |
|
095b9c85c45c
Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents:
36574
diff
changeset
|
4154 | static void |
|
36684
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
4155 | jabber_protocol_init(PurpleProtocol *protocol) |
|
36582
095b9c85c45c
Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents:
36574
diff
changeset
|
4156 | { |
| 37004 | 4157 | protocol->id = "prpl-jabber"; |
|
36684
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
4158 | protocol->name = "XMPP"; |
|
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
4159 | protocol->options = OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | |
|
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
4160 | OPT_PROTO_MAIL_CHECK | |
|
36582
095b9c85c45c
Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents:
36574
diff
changeset
|
4161 | #ifdef HAVE_CYRUS_SASL |
|
36684
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
4162 | OPT_PROTO_PASSWORD_OPTIONAL | |
|
36582
095b9c85c45c
Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents:
36574
diff
changeset
|
4163 | #endif |
|
36684
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
4164 | OPT_PROTO_SLASH_COMMANDS_NATIVE; |
|
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
4165 | |
|
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
4166 | protocol->icon_spec = purple_buddy_icon_spec_new("png", |
|
36609
637155f87448
Refactored the protocols to use purple_buddy_icon_spec_new()
Ankit Vani <a@nevitus.org>
parents:
36582
diff
changeset
|
4167 | 32, 32, 96, 96, 0, |
|
637155f87448
Refactored the protocols to use purple_buddy_icon_spec_new()
Ankit Vani <a@nevitus.org>
parents:
36582
diff
changeset
|
4168 | PURPLE_ICON_SCALE_SEND | |
|
637155f87448
Refactored the protocols to use purple_buddy_icon_spec_new()
Ankit Vani <a@nevitus.org>
parents:
36582
diff
changeset
|
4169 | PURPLE_ICON_SCALE_DISPLAY); |
|
36582
095b9c85c45c
Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents:
36574
diff
changeset
|
4170 | } |
|
095b9c85c45c
Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents:
36574
diff
changeset
|
4171 | |
|
095b9c85c45c
Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents:
36574
diff
changeset
|
4172 | static void |
|
36684
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
4173 | jabber_protocol_class_init(PurpleProtocolClass *klass) |
|
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
4174 | { |
|
36732
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4175 | klass->login = jabber_login; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4176 | klass->close = jabber_close; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4177 | klass->status_types = jabber_status_types; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4178 | klass->list_icon = jabber_list_icon; |
|
36684
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
4179 | } |
|
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
4180 | |
|
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
4181 | static void |
|
36729
7f9fac14ed60
Temporarily replaced PurpleProtocolInterface with PurpleProtocolClientIface in protocols
Ankit Vani <a@nevitus.org>
parents:
36716
diff
changeset
|
4182 | jabber_protocol_client_iface_init(PurpleProtocolClientIface *client_iface) |
|
36582
095b9c85c45c
Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents:
36574
diff
changeset
|
4183 | { |
|
36732
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4184 | client_iface->get_actions = jabber_get_actions; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4185 | client_iface->list_emblem = jabber_list_emblem; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4186 | client_iface->status_text = jabber_status_text; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4187 | client_iface->tooltip_text = jabber_tooltip_text; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4188 | client_iface->blist_node_menu = jabber_blist_node_menu; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4189 | client_iface->convo_closed = jabber_convo_closed; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4190 | client_iface->normalize = jabber_normalize; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4191 | client_iface->find_blist_chat = jabber_find_blist_chat; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4192 | client_iface->offline_message = jabber_offline_message; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4193 | client_iface->get_moods = jabber_get_moods; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4194 | } |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4195 | |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4196 | static void |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4197 | jabber_protocol_server_iface_init(PurpleProtocolServerIface *server_iface) |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4198 | { |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4199 | server_iface->register_user = jabber_register_account; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4200 | server_iface->unregister_user = jabber_unregister_account; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4201 | server_iface->set_info = jabber_set_info; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4202 | server_iface->get_info = jabber_buddy_get_info; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4203 | server_iface->set_status = jabber_set_status; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4204 | server_iface->set_idle = jabber_idle_set; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4205 | server_iface->add_buddy = jabber_roster_add_buddy; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4206 | server_iface->remove_buddy = jabber_roster_remove_buddy; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4207 | server_iface->keepalive = jabber_keepalive; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4208 | server_iface->alias_buddy = jabber_roster_alias_change; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4209 | server_iface->group_buddy = jabber_roster_group_change; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4210 | server_iface->rename_group = jabber_roster_group_rename; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4211 | server_iface->set_buddy_icon = jabber_set_buddy_icon; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4212 | server_iface->send_raw = jabber_protocol_send_raw; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4213 | } |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4214 | |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4215 | static void |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4216 | jabber_protocol_im_iface_init(PurpleProtocolIMIface *im_iface) |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4217 | { |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4218 | im_iface->send = jabber_message_send_im; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4219 | im_iface->send_typing = jabber_send_typing; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4220 | } |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4221 | |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4222 | static void |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4223 | jabber_protocol_chat_iface_init(PurpleProtocolChatIface *chat_iface) |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4224 | { |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4225 | chat_iface->info = jabber_chat_info; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4226 | chat_iface->info_defaults = jabber_chat_info_defaults; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4227 | chat_iface->join = jabber_chat_join; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4228 | chat_iface->get_name = jabber_get_chat_name; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4229 | chat_iface->invite = jabber_chat_invite; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4230 | chat_iface->leave = jabber_chat_leave; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4231 | chat_iface->send = jabber_message_send_chat; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4232 | chat_iface->get_user_real_name = jabber_chat_user_real_name; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4233 | chat_iface->set_topic = jabber_chat_set_topic; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4234 | } |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4235 | |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4236 | static void |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4237 | jabber_protocol_privacy_iface_init(PurpleProtocolPrivacyIface *privacy_iface) |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4238 | { |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4239 | privacy_iface->add_deny = jabber_add_deny; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4240 | privacy_iface->rem_deny = jabber_rem_deny; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4241 | } |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4242 | |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4243 | static void |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4244 | jabber_protocol_roomlist_iface_init(PurpleProtocolRoomlistIface *roomlist_iface) |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4245 | { |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4246 | roomlist_iface->get_list = jabber_roomlist_get_list; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4247 | roomlist_iface->cancel = jabber_roomlist_cancel; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4248 | roomlist_iface->room_serialize = jabber_roomlist_room_serialize; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4249 | } |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4250 | |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4251 | static void |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4252 | jabber_protocol_attention_iface_init(PurpleProtocolAttentionIface *attention_iface) |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4253 | { |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4254 | attention_iface->send = jabber_send_attention; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4255 | attention_iface->get_types = jabber_attention_types; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4256 | } |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4257 | |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4258 | static void |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4259 | jabber_protocol_media_iface_init(PurpleProtocolMediaIface *media_iface) |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4260 | { |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4261 | media_iface->initiate_session = jabber_initiate_media; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4262 | media_iface->get_caps = jabber_get_media_caps; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4263 | } |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4264 | |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4265 | static void |
|
38827
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38433
diff
changeset
|
4266 | jabber_protocol_xfer_iface_init(PurpleProtocolXferInterface *xfer_iface) |
|
36732
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4267 | { |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4268 | xfer_iface->can_receive = jabber_can_receive_file; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4269 | xfer_iface->send = jabber_si_xfer_send; |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4270 | xfer_iface->new_xfer = jabber_si_new_xfer; |
|
36582
095b9c85c45c
Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents:
36574
diff
changeset
|
4271 | } |
|
095b9c85c45c
Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents:
36574
diff
changeset
|
4272 | |
|
36714
ec178f7d66da
Refactored protocols to use the new type definition macros
Ankit Vani <a@nevitus.org>
parents:
36701
diff
changeset
|
4273 | PURPLE_DEFINE_TYPE_EXTENDED( |
|
ec178f7d66da
Refactored protocols to use the new type definition macros
Ankit Vani <a@nevitus.org>
parents:
36701
diff
changeset
|
4274 | JabberProtocol, jabber_protocol, PURPLE_TYPE_PROTOCOL, G_TYPE_FLAG_ABSTRACT, |
|
36732
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4275 | |
|
36729
7f9fac14ed60
Temporarily replaced PurpleProtocolInterface with PurpleProtocolClientIface in protocols
Ankit Vani <a@nevitus.org>
parents:
36716
diff
changeset
|
4276 | PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_CLIENT_IFACE, |
|
36732
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4277 | jabber_protocol_client_iface_init) |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4278 | |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4279 | PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_SERVER_IFACE, |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4280 | jabber_protocol_server_iface_init) |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4281 | |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4282 | PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_IM_IFACE, |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4283 | jabber_protocol_im_iface_init) |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4284 | |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4285 | PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_CHAT_IFACE, |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4286 | jabber_protocol_chat_iface_init) |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4287 | |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4288 | PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_PRIVACY_IFACE, |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4289 | jabber_protocol_privacy_iface_init) |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4290 | |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4291 | PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_ROOMLIST_IFACE, |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4292 | jabber_protocol_roomlist_iface_init) |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4293 | |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4294 | PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_ATTENTION_IFACE, |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4295 | jabber_protocol_attention_iface_init) |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4296 | |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4297 | PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_MEDIA_IFACE, |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4298 | jabber_protocol_media_iface_init) |
|
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4299 | |
|
38827
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38433
diff
changeset
|
4300 | PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_XFER, |
|
36732
39a42632a4c8
Refactored jabber to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
4301 | jabber_protocol_xfer_iface_init) |
|
36714
ec178f7d66da
Refactored protocols to use the new type definition macros
Ankit Vani <a@nevitus.org>
parents:
36701
diff
changeset
|
4302 | ); |
|
36668
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4303 | |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4304 | static PurplePluginInfo * |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4305 | plugin_query(GError **error) |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4306 | { |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4307 | return purple_plugin_info_new( |
|
36985
9faafe43603e
Rename protocol plugin IDs to prpl-*
Ankit Vani <a@nevitus.org>
parents:
36928
diff
changeset
|
4308 | "id", "prpl-xmpp", |
|
36668
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4309 | "name", "XMPP Protocols", |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4310 | "version", DISPLAY_VERSION, |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4311 | "category", N_("Protocol"), |
|
37248
ef82ac226e4b
jabber: removed explicit Facebook support
James Geboski <jgeboski@gmail.com>
parents:
37182
diff
changeset
|
4312 | "summary", N_("XMPP and GTalk Protocols Plugin"), |
|
ef82ac226e4b
jabber: removed explicit Facebook support
James Geboski <jgeboski@gmail.com>
parents:
37182
diff
changeset
|
4313 | "description", N_("XMPP and GTalk Protocols Plugin"), |
|
36668
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4314 | "website", PURPLE_WEBSITE, |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4315 | "abi-version", PURPLE_ABI_VERSION, |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4316 | "flags", PURPLE_PLUGIN_INFO_FLAGS_INTERNAL | |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4317 | PURPLE_PLUGIN_INFO_FLAGS_AUTO_LOAD, |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4318 | NULL |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4319 | ); |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4320 | } |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4321 | |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4322 | static gboolean |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4323 | plugin_load(PurplePlugin *plugin, GError **error) |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4324 | { |
|
36889
4dfe09057bed
Register jingle types dynamically
Ankit Vani <a@nevitus.org>
parents:
36862
diff
changeset
|
4325 | jingle_session_register_type(plugin); |
|
4dfe09057bed
Register jingle types dynamically
Ankit Vani <a@nevitus.org>
parents:
36862
diff
changeset
|
4326 | |
|
4dfe09057bed
Register jingle types dynamically
Ankit Vani <a@nevitus.org>
parents:
36862
diff
changeset
|
4327 | jingle_transport_register_type(plugin); |
|
4dfe09057bed
Register jingle types dynamically
Ankit Vani <a@nevitus.org>
parents:
36862
diff
changeset
|
4328 | jingle_iceudp_register_type(plugin); |
|
4dfe09057bed
Register jingle types dynamically
Ankit Vani <a@nevitus.org>
parents:
36862
diff
changeset
|
4329 | jingle_rawudp_register_type(plugin); |
|
4dfe09057bed
Register jingle types dynamically
Ankit Vani <a@nevitus.org>
parents:
36862
diff
changeset
|
4330 | jingle_google_p2p_register_type(plugin); |
|
4dfe09057bed
Register jingle types dynamically
Ankit Vani <a@nevitus.org>
parents:
36862
diff
changeset
|
4331 | |
|
4dfe09057bed
Register jingle types dynamically
Ankit Vani <a@nevitus.org>
parents:
36862
diff
changeset
|
4332 | jingle_content_register_type(plugin); |
|
37164
aea7e3b20138
Added send_dtmf to protocol media interface
Ankit Vani <a@nevitus.org>
parents:
37158
diff
changeset
|
4333 | #ifdef USE_VV |
|
36889
4dfe09057bed
Register jingle types dynamically
Ankit Vani <a@nevitus.org>
parents:
36862
diff
changeset
|
4334 | jingle_rtp_register_type(plugin); |
|
37164
aea7e3b20138
Added send_dtmf to protocol media interface
Ankit Vani <a@nevitus.org>
parents:
37158
diff
changeset
|
4335 | #endif |
|
36889
4dfe09057bed
Register jingle types dynamically
Ankit Vani <a@nevitus.org>
parents:
36862
diff
changeset
|
4336 | |
|
36714
ec178f7d66da
Refactored protocols to use the new type definition macros
Ankit Vani <a@nevitus.org>
parents:
36701
diff
changeset
|
4337 | jabber_protocol_register_type(plugin); |
|
ec178f7d66da
Refactored protocols to use the new type definition macros
Ankit Vani <a@nevitus.org>
parents:
36701
diff
changeset
|
4338 | |
|
ec178f7d66da
Refactored protocols to use the new type definition macros
Ankit Vani <a@nevitus.org>
parents:
36701
diff
changeset
|
4339 | gtalk_protocol_register_type(plugin); |
|
ec178f7d66da
Refactored protocols to use the new type definition macros
Ankit Vani <a@nevitus.org>
parents:
36701
diff
changeset
|
4340 | xmpp_protocol_register_type(plugin); |
|
ec178f7d66da
Refactored protocols to use the new type definition macros
Ankit Vani <a@nevitus.org>
parents:
36701
diff
changeset
|
4341 | |
|
36668
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4342 | xmpp_protocol = purple_protocols_add(XMPP_TYPE_PROTOCOL, error); |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4343 | if (!xmpp_protocol) |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4344 | return FALSE; |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4345 | |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4346 | gtalk_protocol = purple_protocols_add(GTALK_TYPE_PROTOCOL, error); |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4347 | if (!gtalk_protocol) |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4348 | return FALSE; |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4349 | |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4350 | purple_signal_connect(purple_get_core(), "uri-handler", xmpp_protocol, |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4351 | PURPLE_CALLBACK(xmpp_uri_handler), NULL); |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4352 | purple_signal_connect(purple_get_core(), "uri-handler", gtalk_protocol, |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4353 | PURPLE_CALLBACK(xmpp_uri_handler), NULL); |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4354 | |
|
36684
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
4355 | jabber_init_protocol(xmpp_protocol); |
|
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
4356 | jabber_init_protocol(gtalk_protocol); |
|
36668
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4357 | |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4358 | return TRUE; |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4359 | } |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4360 | |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4361 | static gboolean |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4362 | plugin_unload(PurplePlugin *plugin, GError **error) |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4363 | { |
|
36684
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
4364 | jabber_uninit_protocol(gtalk_protocol); |
|
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
4365 | jabber_uninit_protocol(xmpp_protocol); |
|
36668
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4366 | |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4367 | if (!purple_protocols_remove(gtalk_protocol, error)) |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4368 | return FALSE; |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4369 | |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4370 | if (!purple_protocols_remove(xmpp_protocol, error)) |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4371 | return FALSE; |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4372 | |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4373 | return TRUE; |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4374 | } |
|
15719256474a
Add/remove XMPPProtocol, GTalkProtocol, FacebookProtocol via the single jabber plugin
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
4375 | |
|
36714
ec178f7d66da
Refactored protocols to use the new type definition macros
Ankit Vani <a@nevitus.org>
parents:
36701
diff
changeset
|
4376 | PURPLE_PLUGIN_INIT(jabber, plugin_query, plugin_load, plugin_unload); |