Sat, 28 Mar 2009 00:58:02 +0000
Don't assume a PurpleMedia instance will be created immediately.
| 2086 | 1 | /* |
| 15884 | 2 | * purple - Jabber Protocol Plugin |
| 2086 | 3 | * |
| 7014 | 4 | * Copyright (C) 2003, Nathan Walp <faceprint@faceprint.com> |
| 2086 | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | |
| 7 | * it under the terms of the GNU General Public License as published by | |
| 8 | * the Free Software Foundation; either version 2 of the License, or | |
| 9 | * (at your option) any later version. | |
| 7014 | 10 | * |
| 2086 | 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | * GNU General Public License for more details. | |
| 15 | * | |
| 16 | * You should have received a copy of the GNU General Public License | |
| 17 | * 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
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 2086 | 19 | * |
| 20 | */ | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
21 | #include "internal.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
22 | |
| 7014 | 23 | #include "account.h" |
| 24 | #include "accountopt.h" | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
25 | #include "blist.h" |
| 9130 | 26 | #include "cmds.h" |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10504
diff
changeset
|
27 | #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
|
28 | #include "conversation.h" |
| 7014 | 29 | #include "debug.h" |
| 11387 | 30 | #include "dnssrv.h" |
| 7014 | 31 | #include "message.h" |
| 7072 | 32 | #include "notify.h" |
| 8713 | 33 | #include "pluginpref.h" |
|
25290
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
34 | #include "privacy.h" |
|
14175
2bc5a80c5071
[gaim-migrate @ 16747]
Mark Doliner <markdoliner@pidgin.im>
parents:
14170
diff
changeset
|
35 | #include "proxy.h" |
| 7014 | 36 | #include "prpl.h" |
| 7072 | 37 | #include "request.h" |
| 7014 | 38 | #include "server.h" |
|
7095
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7072
diff
changeset
|
39 | #include "util.h" |
| 9943 | 40 | #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
|
41 | #include "xmlnode.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
42 | |
| 7014 | 43 | #include "auth.h" |
| 44 | #include "buddy.h" | |
| 45 | #include "chat.h" | |
|
23626
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23325
diff
changeset
|
46 | #include "data.h" |
| 8312 | 47 | #include "disco.h" |
| 15265 | 48 | #include "google.h" |
| 7014 | 49 | #include "iq.h" |
| 50 | #include "jutil.h" | |
| 51 | #include "message.h" | |
| 52 | #include "parser.h" | |
| 53 | #include "presence.h" | |
| 54 | #include "jabber.h" | |
| 55 | #include "roster.h" | |
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
56 | #include "ping.h" |
|
9466
b6425eab60ca
[gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents:
9414
diff
changeset
|
57 | #include "si.h" |
| 7923 | 58 | #include "xdata.h" |
|
17768
7be011945a1b
added preliminary frame for pep-support
Andreas Monitzer <am@adiumx.com>
parents:
17767
diff
changeset
|
59 | #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
|
60 | #include "adhoccommands.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
61 | |
|
26143
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
26117
diff
changeset
|
62 | #include "jingle/jingle.h" |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
26117
diff
changeset
|
63 | #include "jingle/rtp.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
64 | |
|
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
|
65 | #define JABBER_CONNECT_STEPS (js->gsc ? 9 : 5) |
| 2086 | 66 | |
| 15884 | 67 | static PurplePlugin *my_protocol = NULL; |
| 21623 | 68 | GList *jabber_features = NULL; |
|
4249
62583b5d3663
[gaim-migrate @ 4499]
Robert McQueen <robot101@debian.org>
parents:
4245
diff
changeset
|
69 | |
|
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
|
70 | static void jabber_unregister_account_cb(JabberStream *js); |
|
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
|
71 | static void try_srv_connect(JabberStream *js); |
|
4249
62583b5d3663
[gaim-migrate @ 4499]
Robert McQueen <robot101@debian.org>
parents:
4245
diff
changeset
|
72 | |
| 7014 | 73 | static void jabber_stream_init(JabberStream *js) |
| 74 | { | |
| 75 | char *open_stream; | |
|
3340
7e59a209931d
[gaim-migrate @ 3359]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3337
diff
changeset
|
76 | |
| 7014 | 77 | open_stream = g_strdup_printf("<stream:stream to='%s' " |
| 78 | "xmlns='jabber:client' " | |
| 7395 | 79 | "xmlns:stream='http://etherx.jabber.org/streams' " |
| 80 | "version='1.0'>", | |
| 7291 | 81 | js->user->domain); |
| 13808 | 82 | /* setup the parser fresh for each stream */ |
| 83 | jabber_parser_setup(js); | |
| 7642 | 84 | jabber_send_raw(js, open_stream, -1); |
| 14062 | 85 | js->reinit = FALSE; |
| 7014 | 86 | g_free(open_stream); |
| 2086 | 87 | } |
| 88 | ||
| 7395 | 89 | static void |
| 90 | jabber_session_initialized_cb(JabberStream *js, xmlnode *packet, gpointer data) | |
| 3311 | 91 | { |
| 7014 | 92 | const char *type = xmlnode_get_attrib(packet, "type"); |
| 93 | if(type && !strcmp(type, "result")) { | |
| 94 | jabber_stream_set_state(js, JABBER_STREAM_CONNECTED); | |
|
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
|
95 | 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
|
96 | jabber_unregister_account_cb(js); |
| 7014 | 97 | } else { |
| 21279 | 98 | purple_connection_error_reason (js->gc, |
| 99 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
100 | ("Error initializing session")); |
| 3311 | 101 | } |
| 102 | } | |
| 103 | ||
| 7014 | 104 | static void jabber_session_init(JabberStream *js) |
| 3311 | 105 | { |
| 7014 | 106 | JabberIq *iq = jabber_iq_new(js, JABBER_IQ_SET); |
| 107 | xmlnode *session; | |
| 3311 | 108 | |
| 7395 | 109 | jabber_iq_set_callback(iq, jabber_session_initialized_cb, NULL); |
| 3311 | 110 | |
| 7014 | 111 | session = xmlnode_new_child(iq->node, "session"); |
| 13808 | 112 | xmlnode_set_namespace(session, "urn:ietf:params:xml:ns:xmpp-session"); |
| 3311 | 113 | |
| 7014 | 114 | jabber_iq_send(iq); |
| 3311 | 115 | } |
| 116 | ||
| 7395 | 117 | static void jabber_bind_result_cb(JabberStream *js, xmlnode *packet, |
| 118 | gpointer data) | |
| 119 | { | |
| 8401 | 120 | const char *type = xmlnode_get_attrib(packet, "type"); |
| 121 | xmlnode *bind; | |
| 122 | ||
| 123 | if(type && !strcmp(type, "result") && | |
| 124 | (bind = xmlnode_get_child_with_namespace(packet, "bind", "urn:ietf:params:xml:ns:xmpp-bind"))) { | |
| 125 | xmlnode *jid; | |
| 126 | char *full_jid; | |
| 127 | if((jid = xmlnode_get_child(bind, "jid")) && (full_jid = xmlnode_get_data(jid))) { | |
| 10289 | 128 | JabberBuddy *my_jb = NULL; |
| 8401 | 129 | jabber_id_free(js->user); |
| 130 | if(!(js->user = jabber_id_new(full_jid))) { | |
| 21279 | 131 | purple_connection_error_reason (js->gc, |
| 132 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
133 | _("Invalid response from server.")); |
| 8401 | 134 | } |
| 10289 | 135 | if((my_jb = jabber_buddy_find(js, full_jid, TRUE))) |
| 136 | my_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
|
137 | |
|
77ba88ca54a6
Set the connection display name to the server-assigned full jid for XMPP
Daniel Atallah <datallah@pidgin.im>
parents:
24254
diff
changeset
|
138 | 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
|
139 | |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10490
diff
changeset
|
140 | g_free(full_jid); |
| 8401 | 141 | } |
| 142 | } else { | |
| 21279 | 143 | 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
|
144 | char *msg = jabber_parse_error(js, packet, &reason); |
|
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
145 | purple_connection_error_reason (js->gc, reason, msg); |
| 8401 | 146 | g_free(msg); |
| 147 | } | |
| 7395 | 148 | |
| 149 | jabber_session_init(js); | |
| 150 | } | |
| 151 | ||
|
24819
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
152 | 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
|
153 | 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
|
154 | *dot = NULL; |
|
24819
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
155 | |
|
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
156 | /* 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
|
157 | if (input == NULL || *input == '\0') |
|
24819
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
158 | return NULL; |
|
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
159 | |
|
24833
d2257d9b0ffa
Avoid needlessly calling gethostname() if __HOSTNAME__ doesn't appear in the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24828
diff
changeset
|
160 | if (strstr(input, "__HOSTNAME__") == NULL) |
| 24850 | 161 | 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
|
162 | |
|
24819
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
163 | /* Replace __HOSTNAME__ with hostname */ |
|
24824
2da1f210b9a2
me likes this better, References #5565
Ka-Hing Cheung <khc@pidgin.im>
parents:
24820
diff
changeset
|
164 | if (gethostname(hostname, sizeof(hostname) - 1)) { |
|
2da1f210b9a2
me likes this better, References #5565
Ka-Hing Cheung <khc@pidgin.im>
parents:
24820
diff
changeset
|
165 | 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
|
166 | /* 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
|
167 | 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
|
168 | 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
|
169 | 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
|
170 | instead |
|
2da1f210b9a2
me likes this better, References #5565
Ka-Hing Cheung <khc@pidgin.im>
parents:
24820
diff
changeset
|
171 | */ |
|
24819
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
172 | strcpy(hostname, "localhost"); |
|
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
173 | } |
|
24824
2da1f210b9a2
me likes this better, References #5565
Ka-Hing Cheung <khc@pidgin.im>
parents:
24820
diff
changeset
|
174 | hostname[sizeof(hostname) - 1] = '\0'; |
|
24819
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
175 | |
|
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
|
176 | /* 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
|
177 | * 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
|
178 | * 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
|
179 | if((dot = strchr(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
|
180 | dot = '\0'; |
|
251e085b3cfa
Grab only the "short" hostname on systems (like Fedora/RedHat, but others too)
Matěj Cepl <mcepl@redhat.com>
parents:
25573
diff
changeset
|
181 | |
|
24819
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
182 | return purple_strreplace(input, "__HOSTNAME__", hostname); |
|
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
183 | } |
|
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
184 | |
| 7395 | 185 | static void jabber_stream_features_parse(JabberStream *js, xmlnode *packet) |
| 186 | { | |
| 8296 | 187 | if(xmlnode_get_child(packet, "starttls")) { |
| 188 | if(jabber_process_starttls(js, packet)) | |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
189 | |
| 8296 | 190 | return; |
|
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
|
191 | } else if(purple_account_get_bool(js->gc->account, "require_tls", FALSE) && !js->gsc) { |
| 21279 | 192 | purple_connection_error_reason (js->gc, |
| 193 | PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, | |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
194 | _("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
|
195 | return; |
| 8296 | 196 | } |
| 197 | ||
| 10988 | 198 | if(js->registration) { |
| 199 | jabber_register_start(js); | |
| 200 | } else if(xmlnode_get_child(packet, "mechanisms")) { | |
| 7395 | 201 | jabber_auth_start(js, packet); |
| 202 | } else if(xmlnode_get_child(packet, "bind")) { | |
| 203 | xmlnode *bind, *resource; | |
|
24819
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
204 | char *requested_resource; |
| 7395 | 205 | JabberIq *iq = jabber_iq_new(js, JABBER_IQ_SET); |
| 206 | bind = xmlnode_new_child(iq->node, "bind"); | |
| 13808 | 207 | xmlnode_set_namespace(bind, "urn:ietf:params:xml:ns:xmpp-bind"); |
|
24819
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
208 | requested_resource = jabber_prep_resource(js->user->resource); |
|
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
209 | |
|
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
210 | if (requested_resource != NULL) { |
|
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
211 | resource = xmlnode_new_child(bind, "resource"); |
|
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
212 | 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
|
213 | g_free(requested_resource); |
|
24819
95e726e2bc06
Some improvements to XMPP resource handling:
Jonathan Sailor <jsailor@jesnetplus.com>
parents:
24693
diff
changeset
|
214 | } |
| 7395 | 215 | |
| 216 | jabber_iq_set_callback(iq, jabber_bind_result_cb, NULL); | |
| 217 | ||
| 218 | jabber_iq_send(iq); | |
| 8296 | 219 | } else /* if(xmlnode_get_child_with_namespace(packet, "auth")) */ { |
| 220 | /* If we get an empty stream:features packet, or we explicitly get | |
| 221 | * an auth feature with namespace http://jabber.org/features/iq-auth | |
| 222 | * we should revert back to iq:auth authentication, even though we're | |
| 223 | * connecting to an XMPP server. */ | |
| 224 | js->auth_type = JABBER_AUTH_IQ_AUTH; | |
| 225 | jabber_stream_set_state(js, JABBER_STREAM_AUTHENTICATING); | |
| 7395 | 226 | } |
| 227 | } | |
| 228 | ||
| 7014 | 229 | static void jabber_stream_handle_error(JabberStream *js, xmlnode *packet) |
| 3311 | 230 | { |
| 21279 | 231 | 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
|
232 | char *msg = jabber_parse_error(js, packet, &reason); |
| 3311 | 233 | |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
234 | purple_connection_error_reason (js->gc, reason, msg); |
|
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
235 | |
| 8401 | 236 | g_free(msg); |
| 2086 | 237 | } |
| 238 | ||
| 7014 | 239 | static void tls_init(JabberStream *js); |
| 2086 | 240 | |
|
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
|
241 | void jabber_process_packet(JabberStream *js, xmlnode **packet) |
| 2086 | 242 | { |
| 15980 | 243 | const char *xmlns; |
| 244 | ||
|
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
|
245 | purple_signal_emit(my_protocol, "jabber-receiving-xmlnode", js->gc, packet); |
| 14358 | 246 | |
| 247 | /* 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
|
248 | if(NULL == *packet) |
| 14358 | 249 | return; |
| 250 | ||
|
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
|
251 | xmlns = xmlnode_get_namespace(*packet); |
| 15980 | 252 | |
|
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
|
253 | if(!strcmp((*packet)->name, "iq")) { |
|
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
|
254 | jabber_iq_parse(js, *packet); |
|
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
|
255 | } else if(!strcmp((*packet)->name, "presence")) { |
|
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
|
256 | jabber_presence_parse(js, *packet); |
|
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
|
257 | } else if(!strcmp((*packet)->name, "message")) { |
|
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
|
258 | jabber_message_parse(js, *packet); |
|
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
|
259 | } else if(!strcmp((*packet)->name, "stream:features")) { |
|
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
|
260 | jabber_stream_features_parse(js, *packet); |
| 21623 | 261 | } else if (!strcmp((*packet)->name, "features") && xmlns && |
| 15980 | 262 | !strcmp(xmlns, "http://etherx.jabber.org/streams")) { |
|
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
|
263 | jabber_stream_features_parse(js, *packet); |
|
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
|
264 | } else if(!strcmp((*packet)->name, "stream:error") || |
| 21623 | 265 | (!strcmp((*packet)->name, "error") && xmlns && |
| 15980 | 266 | !strcmp(xmlns, "http://etherx.jabber.org/streams"))) |
| 267 | { | |
|
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
|
268 | jabber_stream_handle_error(js, *packet); |
|
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
|
269 | } else if(!strcmp((*packet)->name, "challenge")) { |
| 7014 | 270 | if(js->state == JABBER_STREAM_AUTHENTICATING) |
|
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
|
271 | jabber_auth_handle_challenge(js, *packet); |
|
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
|
272 | } else if(!strcmp((*packet)->name, "success")) { |
| 7014 | 273 | if(js->state == JABBER_STREAM_AUTHENTICATING) |
|
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
|
274 | jabber_auth_handle_success(js, *packet); |
|
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
|
275 | } else if(!strcmp((*packet)->name, "failure")) { |
| 7014 | 276 | if(js->state == JABBER_STREAM_AUTHENTICATING) |
|
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
|
277 | jabber_auth_handle_failure(js, *packet); |
|
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
|
278 | } else if(!strcmp((*packet)->name, "proceed")) { |
| 7014 | 279 | if(js->state == JABBER_STREAM_AUTHENTICATING && !js->gsc) |
| 280 | tls_init(js); | |
| 281 | } else { | |
| 15884 | 282 | purple_debug(PURPLE_DEBUG_WARNING, "jabber", "Unknown packet: %s\n", |
|
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
|
283 | (*packet)->name); |
| 2086 | 284 | } |
| 285 | } | |
| 286 | ||
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
287 | 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
|
288 | { |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
289 | int ret; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
290 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
291 | if (js->gsc) |
| 15884 | 292 | ret = purple_ssl_write(js->gsc, data, len); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
293 | else |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
294 | ret = write(js->fd, data, len); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
295 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
296 | return ret; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
297 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
298 | |
| 15884 | 299 | 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
|
300 | { |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
301 | JabberStream *js = data; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
302 | int ret, writelen; |
| 15884 | 303 | writelen = purple_circ_buffer_get_max_read(js->write_buffer); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
304 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
305 | if (writelen == 0) { |
| 15884 | 306 | purple_input_remove(js->writeh); |
|
13746
790924f38349
[gaim-migrate @ 16155]
Mark Doliner <markdoliner@pidgin.im>
parents:
13546
diff
changeset
|
307 | js->writeh = 0; |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
308 | return; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
309 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
310 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
311 | ret = jabber_do_send(js, js->write_buffer->outptr, writelen); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
312 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
313 | if (ret < 0 && errno == EAGAIN) |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
314 | return; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
315 | else if (ret <= 0) { |
| 21279 | 316 | purple_connection_error_reason (js->gc, |
| 317 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
318 | _("Write error")); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
319 | return; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
320 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
321 | |
| 15884 | 322 | purple_circ_buffer_mark_read(js->write_buffer, ret); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
323 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
324 | |
|
23519
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
325 | static gboolean do_jabber_send_raw(JabberStream *js, const char *data, int len) |
| 2086 | 326 | { |
| 7014 | 327 | int ret; |
|
23519
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
328 | gboolean success = TRUE; |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
329 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
330 | if (len == -1) |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
331 | len = strlen(data); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
332 | |
|
13746
790924f38349
[gaim-migrate @ 16155]
Mark Doliner <markdoliner@pidgin.im>
parents:
13546
diff
changeset
|
333 | if (js->writeh == 0) |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
334 | ret = jabber_do_send(js, data, len); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
335 | else { |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
336 | ret = -1; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
337 | errno = EAGAIN; |
|
2814
91cc1a0cdee0
[gaim-migrate @ 2827]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2800
diff
changeset
|
338 | } |
|
91cc1a0cdee0
[gaim-migrate @ 2827]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2800
diff
changeset
|
339 | |
|
23519
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
340 | if (ret < 0 && errno != EAGAIN) { |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
341 | purple_connection_error_reason (js->gc, |
| 21279 | 342 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
343 | _("Write error")); |
|
23519
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
344 | success = FALSE; |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
345 | } else if (ret < len) { |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
346 | if (ret < 0) |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
347 | ret = 0; |
|
13746
790924f38349
[gaim-migrate @ 16155]
Mark Doliner <markdoliner@pidgin.im>
parents:
13546
diff
changeset
|
348 | if (js->writeh == 0) |
| 15884 | 349 | js->writeh = purple_input_add( |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
350 | js->gsc ? js->gsc->fd : js->fd, |
| 15884 | 351 | PURPLE_INPUT_WRITE, jabber_send_cb, js); |
| 352 | purple_circ_buffer_append(js->write_buffer, | |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
353 | data + ret, len - ret); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
354 | } |
|
23519
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
355 | |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
356 | return success; |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
357 | } |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
358 | |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
359 | 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
|
360 | { |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
361 | |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
362 | /* because printing a tab to debug every minute gets old */ |
|
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
|
363 | if(strcmp(data, "\t")) { |
|
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
|
364 | 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
|
365 | |
|
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
|
366 | /* Because debug logs with plaintext passwords make me sad */ |
|
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
|
367 | if(js->state != JABBER_STREAM_CONNECTED && |
|
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
|
368 | /* 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
|
369 | (((tag_start = strstr(data, "<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
|
370 | strstr(data, "xmlns='urn:ietf:params:xml:ns:xmpp-sasl'")) || |
|
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
|
371 | ((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
|
372 | 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
|
373 | (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
|
374 | 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
|
375 | 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
|
376 | |
|
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
|
377 | 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
|
378 | |
|
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
|
379 | 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
|
380 | *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
|
381 | } |
|
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
|
382 | |
|
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
|
383 | purple_debug(PURPLE_DEBUG_MISC, "jabber", "Sending%s: %s%s%s\n", |
|
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
|
384 | js->gsc ? " (ssl)" : "", text ? text : 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
|
385 | 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
|
386 | 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
|
387 | |
|
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
|
388 | 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
|
389 | } |
|
23519
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
390 | |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
391 | /* 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
|
392 | * splitting it on the maximum buffer length negotiated */ |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
393 | |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
394 | purple_signal_emit(my_protocol, "jabber-sending-text", js->gc, &data); |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
395 | if (data == NULL) |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
396 | return; |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
397 | |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
398 | #ifdef HAVE_CYRUS_SASL |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
399 | if (js->sasl_maxbuf>0) { |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
400 | int pos = 0; |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
401 | |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
402 | if (!js->gsc && js->fd<0) |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
403 | return; |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
404 | |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
405 | if (len == -1) |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
406 | len = strlen(data); |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
407 | |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
408 | while (pos < len) { |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
409 | int towrite; |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
410 | const char *out; |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
411 | unsigned olen; |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
412 | |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
413 | towrite = MIN((len - pos), js->sasl_maxbuf); |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
414 | |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
415 | sasl_encode(js->sasl, &data[pos], towrite, &out, &olen); |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
416 | pos += towrite; |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
417 | |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
418 | if (!do_jabber_send_raw(js, out, olen)) |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
419 | break; |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
420 | } |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
421 | return; |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
422 | } |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
423 | #endif |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
424 | |
|
7cbd7ed333d3
Cleanup some duplication and simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23428
diff
changeset
|
425 | do_jabber_send_raw(js, data, len); |
| 14604 | 426 | } |
| 7014 | 427 | |
|
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
|
428 | int jabber_prpl_send_raw(PurpleConnection *gc, const char *buf, int len) |
| 14604 | 429 | { |
| 430 | JabberStream *js = (JabberStream*)gc->proto_data; | |
| 431 | jabber_send_raw(js, buf, len); | |
| 432 | return len; | |
|
2814
91cc1a0cdee0
[gaim-migrate @ 2827]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2800
diff
changeset
|
433 | } |
|
91cc1a0cdee0
[gaim-migrate @ 2827]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2800
diff
changeset
|
434 | |
| 7014 | 435 | void jabber_send(JabberStream *js, xmlnode *packet) |
| 2086 | 436 | { |
| 7014 | 437 | char *txt; |
| 7642 | 438 | int len; |
| 2086 | 439 | |
| 15884 | 440 | purple_signal_emit(my_protocol, "jabber-sending-xmlnode", js->gc, &packet); |
| 14358 | 441 | |
| 442 | /* if we get NULL back, we're done processing */ | |
| 443 | if(NULL == packet) | |
| 444 | return; | |
| 445 | ||
| 7642 | 446 | txt = xmlnode_to_str(packet, &len); |
| 447 | jabber_send_raw(js, txt, len); | |
| 7014 | 448 | g_free(txt); |
| 2086 | 449 | } |
| 450 | ||
|
23520
9c2d88f3a10b
We only allow one keepalive timeout, so simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23519
diff
changeset
|
451 | static void jabber_pong_cb(JabberStream *js, xmlnode *packet, gpointer unused) |
|
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
|
452 | { |
|
23520
9c2d88f3a10b
We only allow one keepalive timeout, so simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23519
diff
changeset
|
453 | purple_timeout_remove(js->keepalive_timeout); |
|
22096
0d28b254d322
Keep track of the keepalive timeout source so it can be removed when the account disconnects. This prevents a possible crash if the timeout fired after the account disconnected.
Evan Schoenberg <evands@pidgin.im>
parents:
22067
diff
changeset
|
454 | js->keepalive_timeout = -1; |
|
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
|
455 | } |
|
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
|
456 | |
|
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
|
457 | static gboolean jabber_pong_timeout(PurpleConnection *gc) |
|
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
|
458 | { |
|
22101
747c8ade85aa
Masca noticed that 0d28b254d322fb0006034065870603672e5666d2 made jabber.c not
Will Thompson <resiak@pidgin.im>
parents:
22096
diff
changeset
|
459 | JabberStream *js = gc->proto_data; |
|
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
|
460 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
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
|
461 | _("Ping timeout")); |
|
22096
0d28b254d322
Keep track of the keepalive timeout source so it can be removed when the account disconnects. This prevents a possible crash if the timeout fired after the account disconnected.
Evan Schoenberg <evands@pidgin.im>
parents:
22067
diff
changeset
|
462 | js->keepalive_timeout = -1; |
|
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
|
463 | 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
|
464 | } |
|
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
|
465 | |
|
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
|
466 | void jabber_keepalive(PurpleConnection *gc) |
| 2086 | 467 | { |
|
22096
0d28b254d322
Keep track of the keepalive timeout source so it can be removed when the account disconnects. This prevents a possible crash if the timeout fired after the account disconnected.
Evan Schoenberg <evands@pidgin.im>
parents:
22067
diff
changeset
|
468 | JabberStream *js = gc->proto_data; |
|
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
|
469 | |
|
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
|
470 | if (js->keepalive_timeout == -1) { |
|
661321b20a01
Only allow one keepalive_timeout at a time. This prevents us from starting a
Evan Schoenberg <evands@pidgin.im>
parents:
22580
diff
changeset
|
471 | JabberIq *iq = jabber_iq_new(js, JABBER_IQ_GET); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
472 | |
|
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
|
473 | xmlnode *ping = xmlnode_new_child(iq->node, "ping"); |
|
661321b20a01
Only allow one keepalive_timeout at a time. This prevents us from starting a
Evan Schoenberg <evands@pidgin.im>
parents:
22580
diff
changeset
|
474 | xmlnode_set_namespace(ping, "urn:xmpp:ping"); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
475 | |
|
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
|
476 | js->keepalive_timeout = purple_timeout_add_seconds(120, (GSourceFunc)(jabber_pong_timeout), gc); |
|
23520
9c2d88f3a10b
We only allow one keepalive timeout, so simplify this.
Daniel Atallah <datallah@pidgin.im>
parents:
23519
diff
changeset
|
477 | jabber_iq_set_callback(iq, jabber_pong_cb, NULL); |
|
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
|
478 | jabber_iq_send(iq); |
|
661321b20a01
Only allow one keepalive_timeout at a time. This prevents us from starting a
Evan Schoenberg <evands@pidgin.im>
parents:
22580
diff
changeset
|
479 | } |
| 2086 | 480 | } |
| 481 | ||
| 7014 | 482 | static void |
| 15884 | 483 | jabber_recv_cb_ssl(gpointer data, PurpleSslConnection *gsc, |
| 484 | PurpleInputCondition cond) | |
| 6764 | 485 | { |
| 15884 | 486 | PurpleConnection *gc = data; |
| 7014 | 487 | JabberStream *js = gc->proto_data; |
| 6764 | 488 | int len; |
| 7014 | 489 | static char buf[4096]; |
| 6768 | 490 | |
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
14004
diff
changeset
|
491 | /* TODO: It should be possible to make this check unnecessary */ |
| 15884 | 492 | if(!PURPLE_CONNECTION_IS_VALID(gc)) { |
| 493 | purple_ssl_close(gsc); | |
| 6768 | 494 | return; |
| 495 | } | |
| 496 | ||
| 15884 | 497 | while((len = purple_ssl_read(gsc, buf, sizeof(buf) - 1)) > 0) { |
|
22277
7c386db62c81
Don't send keep-alives if we've received data since in the last KEEPALIVE_INTERVAL seconds
Sean Egan <seanegan@pidgin.im>
parents:
22225
diff
changeset
|
498 | gc->last_received = time(NULL); |
| 6764 | 499 | buf[len] = '\0'; |
| 15884 | 500 | purple_debug(PURPLE_DEBUG_INFO, "jabber", "Recv (ssl)(%d): %s\n", len, buf); |
| 7014 | 501 | jabber_parser_process(js, buf, len); |
| 14062 | 502 | if(js->reinit) |
| 503 | jabber_stream_init(js); | |
| 13280 | 504 | } |
| 505 | ||
|
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
|
506 | if(len < 0 && errno == EAGAIN) |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
507 | 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
|
508 | else { |
|
19dd5b0bbe76
Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <markdoliner@pidgin.im>
parents:
23532
diff
changeset
|
509 | if (len == 0) |
|
19dd5b0bbe76
Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <markdoliner@pidgin.im>
parents:
23532
diff
changeset
|
510 | purple_debug_info("jabber", "Server closed the connection.\n"); |
|
19dd5b0bbe76
Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <markdoliner@pidgin.im>
parents:
23532
diff
changeset
|
511 | else |
|
19dd5b0bbe76
Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <markdoliner@pidgin.im>
parents:
23532
diff
changeset
|
512 | purple_debug_info("jabber", "Disconnected: %s\n", g_strerror(errno)); |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
513 | purple_connection_error_reason (js->gc, |
| 21279 | 514 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
515 | _("Read Error")); |
|
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
|
516 | } |
| 2086 | 517 | } |
| 518 | ||
| 7014 | 519 | static void |
| 15884 | 520 | jabber_recv_cb(gpointer data, gint source, PurpleInputCondition condition) |
| 2086 | 521 | { |
| 15884 | 522 | PurpleConnection *gc = data; |
| 7014 | 523 | JabberStream *js = gc->proto_data; |
| 524 | int len; | |
| 525 | static char buf[4096]; | |
| 2086 | 526 | |
| 15884 | 527 | if(!PURPLE_CONNECTION_IS_VALID(gc)) |
| 7014 | 528 | return; |
| 2956 | 529 | |
| 7014 | 530 | if((len = read(js->fd, buf, sizeof(buf) - 1)) > 0) { |
|
22277
7c386db62c81
Don't send keep-alives if we've received data since in the last KEEPALIVE_INTERVAL seconds
Sean Egan <seanegan@pidgin.im>
parents:
22225
diff
changeset
|
531 | gc->last_received = time(NULL); |
| 12508 | 532 | #ifdef HAVE_CYRUS_SASL |
| 533 | if (js->sasl_maxbuf>0) { | |
| 534 | const char *out; | |
|
14697
518c0fae208e
[gaim-migrate @ 17381]
Daniel Atallah <datallah@pidgin.im>
parents:
14668
diff
changeset
|
535 | unsigned int olen; |
| 12508 | 536 | sasl_decode(js->sasl, buf, len, &out, &olen); |
| 537 | if (olen>0) { | |
| 15884 | 538 | purple_debug(PURPLE_DEBUG_INFO, "jabber", "RecvSASL (%u): %s\n", olen, out); |
| 12508 | 539 | jabber_parser_process(js,out,olen); |
| 14700 | 540 | if(js->reinit) |
| 541 | jabber_stream_init(js); | |
| 12508 | 542 | } |
| 543 | return; | |
| 544 | } | |
| 545 | #endif | |
| 7014 | 546 | buf[len] = '\0'; |
| 15884 | 547 | purple_debug(PURPLE_DEBUG_INFO, "jabber", "Recv (%d): %s\n", len, buf); |
| 7014 | 548 | jabber_parser_process(js, buf, len); |
| 14700 | 549 | if(js->reinit) |
| 550 | 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
|
551 | } else if(len < 0 && errno == EAGAIN) { |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
552 | return; |
| 7177 | 553 | } else { |
|
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
|
554 | if (len == 0) |
|
19dd5b0bbe76
Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <markdoliner@pidgin.im>
parents:
23532
diff
changeset
|
555 | purple_debug_info("jabber", "Server closed the connection.\n"); |
|
19dd5b0bbe76
Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <markdoliner@pidgin.im>
parents:
23532
diff
changeset
|
556 | else |
|
19dd5b0bbe76
Only check for EAGAIN if read returned less than 0. This fixes a bug
Mark Doliner <markdoliner@pidgin.im>
parents:
23532
diff
changeset
|
557 | purple_debug_info("jabber", "Disconnected: %s\n", g_strerror(errno)); |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
558 | purple_connection_error_reason (js->gc, |
| 21279 | 559 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
560 | _("Read Error")); |
| 7014 | 561 | } |
| 2086 | 562 | } |
| 563 | ||
| 7014 | 564 | static void |
| 15884 | 565 | jabber_login_callback_ssl(gpointer data, PurpleSslConnection *gsc, |
| 566 | PurpleInputCondition cond) | |
| 6764 | 567 | { |
| 15884 | 568 | PurpleConnection *gc = data; |
|
15023
c38f385a128a
[gaim-migrate @ 17740]
Evan Schoenberg <evands@pidgin.im>
parents:
14899
diff
changeset
|
569 | JabberStream *js; |
|
c38f385a128a
[gaim-migrate @ 17740]
Evan Schoenberg <evands@pidgin.im>
parents:
14899
diff
changeset
|
570 | |
|
c38f385a128a
[gaim-migrate @ 17740]
Evan Schoenberg <evands@pidgin.im>
parents:
14899
diff
changeset
|
571 | /* TODO: It should be possible to make this check unnecessary */ |
| 15884 | 572 | if(!PURPLE_CONNECTION_IS_VALID(gc)) { |
| 573 | purple_ssl_close(gsc); | |
|
15023
c38f385a128a
[gaim-migrate @ 17740]
Evan Schoenberg <evands@pidgin.im>
parents:
14899
diff
changeset
|
574 | return; |
|
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
|
575 | } |
|
15023
c38f385a128a
[gaim-migrate @ 17740]
Evan Schoenberg <evands@pidgin.im>
parents:
14899
diff
changeset
|
576 | |
|
c38f385a128a
[gaim-migrate @ 17740]
Evan Schoenberg <evands@pidgin.im>
parents:
14899
diff
changeset
|
577 | js = gc->proto_data; |
| 6764 | 578 | |
| 7014 | 579 | if(js->state == JABBER_STREAM_CONNECTING) |
| 7642 | 580 | jabber_send_raw(js, "<?xml version='1.0' ?>", -1); |
| 7014 | 581 | jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING); |
| 15884 | 582 | 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
|
583 | |
|
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
|
584 | /* 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
|
585 | jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING_ENCRYPTION); |
| 6764 | 586 | } |
| 587 | ||
| 7014 | 588 | |
| 589 | static void | |
|
14175
2bc5a80c5071
[gaim-migrate @ 16747]
Mark Doliner <markdoliner@pidgin.im>
parents:
14170
diff
changeset
|
590 | jabber_login_callback(gpointer data, gint source, const gchar *error) |
| 6764 | 591 | { |
| 15884 | 592 | PurpleConnection *gc = data; |
| 7014 | 593 | JabberStream *js = gc->proto_data; |
| 2086 | 594 | |
|
8783
7be6da5bc279
[gaim-migrate @ 9545]
Mark Doliner <markdoliner@pidgin.im>
parents:
8778
diff
changeset
|
595 | if (source < 0) { |
|
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
|
596 | if (js->srv_rec != NULL) { |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
597 | purple_debug_error("jabber", "Unable to connect to server: %s. Trying next SRV record.\n", error); |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
598 | try_srv_connect(js); |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
599 | } else { |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
600 | gchar *tmp; |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
601 | tmp = g_strdup_printf(_("Could not establish a connection with the server:\n%s"), |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
602 | error); |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
603 | purple_connection_error_reason(gc, |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
604 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
605 | g_free(tmp); |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
606 | } |
|
8783
7be6da5bc279
[gaim-migrate @ 9545]
Mark Doliner <markdoliner@pidgin.im>
parents:
8778
diff
changeset
|
607 | return; |
|
7be6da5bc279
[gaim-migrate @ 9545]
Mark Doliner <markdoliner@pidgin.im>
parents:
8778
diff
changeset
|
608 | } |
|
7be6da5bc279
[gaim-migrate @ 9545]
Mark Doliner <markdoliner@pidgin.im>
parents:
8778
diff
changeset
|
609 | |
|
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
|
610 | g_free(js->srv_rec); |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
611 | js->srv_rec = NULL; |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
612 | |
| 7014 | 613 | js->fd = source; |
| 2956 | 614 | |
| 7014 | 615 | if(js->state == JABBER_STREAM_CONNECTING) |
| 7642 | 616 | jabber_send_raw(js, "<?xml version='1.0' ?>", -1); |
|
2300
06a3c10f4918
[gaim-migrate @ 2310]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2289
diff
changeset
|
617 | |
| 7014 | 618 | jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING); |
| 15884 | 619 | gc->inpa = purple_input_add(js->fd, PURPLE_INPUT_READ, jabber_recv_cb, gc); |
| 7014 | 620 | } |
| 2086 | 621 | |
| 7014 | 622 | static void |
| 15884 | 623 | jabber_ssl_connect_failure(PurpleSslConnection *gsc, PurpleSslErrorType error, |
| 7426 | 624 | gpointer data) |
| 625 | { | |
| 15884 | 626 | 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
|
627 | JabberStream *js; |
| 7426 | 628 | |
|
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
|
629 | /* If the connection is already disconnected, we don't need to do anything else */ |
| 15884 | 630 | if(!PURPLE_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
|
631 | return; |
|
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
|
632 | |
|
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
|
633 | js = gc->proto_data; |
|
14312
6ce4512aa9a8
[gaim-migrate @ 16932]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
634 | js->gsc = NULL; |
|
6ce4512aa9a8
[gaim-migrate @ 16932]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
635 | |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
636 | purple_connection_ssl_error (gc, error); |
| 7426 | 637 | } |
| 638 | ||
| 7427 | 639 | static void tls_init(JabberStream *js) |
| 640 | { | |
| 15884 | 641 | purple_input_remove(js->gc->inpa); |
| 7427 | 642 | js->gc->inpa = 0; |
|
18449
2d2df64f4303
applied changes from f9186fabb483b56a9d7e8fb7241b2520e9930413
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18235
diff
changeset
|
643 | js->gsc = purple_ssl_connect_with_host_fd(js->gc->account, 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
|
644 | jabber_login_callback_ssl, jabber_ssl_connect_failure, js->certificate_CN, js->gc); |
| 7427 | 645 | } |
| 646 | ||
|
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
|
647 | 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
|
648 | gboolean fatal_failure) |
| 11387 | 649 | { |
|
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
|
650 | /* 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
|
651 | * 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
|
652 | * 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
|
653 | * 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
|
654 | 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
|
655 | 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
|
656 | 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
|
657 | 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
|
658 | 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
|
659 | |
| 17052 | 660 | if (purple_proxy_connect(js->gc, js->gc->account, host, |
|
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
|
661 | port, jabber_login_callback, js->gc) == NULL) { |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
662 | if (fatal_failure) { |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
663 | purple_connection_error_reason (js->gc, |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
664 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
665 | _("Unable to create socket")); |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
666 | } |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
667 | |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
668 | 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
|
669 | } |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
670 | |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
671 | 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
|
672 | } |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
673 | |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
674 | static void try_srv_connect(JabberStream *js) |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
675 | { |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
676 | while (js->srv_rec != NULL && js->srv_rec_idx < js->max_srv_rec_idx) { |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
677 | PurpleSrvResponse *tmp_resp = js->srv_rec + (js->srv_rec_idx++); |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
678 | if (jabber_login_connect(js, tmp_resp->hostname, tmp_resp->hostname, tmp_resp->port, 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
|
679 | return; |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
680 | } |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
681 | |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
682 | g_free(js->srv_rec); |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
683 | js->srv_rec = NULL; |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
684 | |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
685 | /* Fall back to the defaults (I'm not sure if we should actually do this) */ |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
686 | jabber_login_connect(js, js->user->domain, js->user->domain, |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
687 | purple_account_get_int(js->gc->account, "port", 5222), TRUE); |
| 11387 | 688 | } |
| 689 | ||
| 15884 | 690 | static void srv_resolved_cb(PurpleSrvResponse *resp, int results, gpointer data) |
| 11387 | 691 | { |
|
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
|
692 | JabberStream *js = data; |
|
14370
12ef3d4096ee
[gaim-migrate @ 16998]
Mark Doliner <markdoliner@pidgin.im>
parents:
14358
diff
changeset
|
693 | js->srv_query_data = NULL; |
| 11387 | 694 | |
| 695 | if(results) { | |
|
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
|
696 | js->srv_rec = resp; |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
697 | js->srv_rec_idx = 0; |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
698 | js->max_srv_rec_idx = results; |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
699 | try_srv_connect(js); |
| 11387 | 700 | } else { |
| 17052 | 701 | jabber_login_connect(js, js->user->domain, js->user->domain, |
|
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
|
702 | purple_account_get_int(js->gc->account, "port", 5222), TRUE); |
| 11387 | 703 | } |
| 704 | } | |
| 705 | ||
|
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
|
706 | void |
| 15884 | 707 | jabber_login(PurpleAccount *account) |
| 2086 | 708 | { |
| 15884 | 709 | PurpleConnection *gc = purple_account_get_connection(account); |
| 710 | const char *connect_server = purple_account_get_string(account, | |
| 7014 | 711 | "connect_server", ""); |
| 712 | JabberStream *js; | |
| 10289 | 713 | JabberBuddy *my_jb = NULL; |
| 2086 | 714 | |
|
23626
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23325
diff
changeset
|
715 | gc->flags |= PURPLE_CONNECTION_HTML | |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23325
diff
changeset
|
716 | PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY; |
| 7014 | 717 | js = gc->proto_data = g_new0(JabberStream, 1); |
| 718 | js->gc = gc; | |
|
8013
03f5b77cdaf0
[gaim-migrate @ 8693]
Olivier Blin <blino@users.sourceforge.net>
parents:
8011
diff
changeset
|
719 | js->fd = -1; |
| 8312 | 720 | js->iq_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, |
| 721 | g_free, g_free); | |
| 722 | js->disco_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, | |
| 7395 | 723 | g_free, g_free); |
| 7014 | 724 | js->buddies = g_hash_table_new_full(g_str_hash, g_str_equal, |
| 7116 | 725 | g_free, (GDestroyNotify)jabber_buddy_free); |
| 7014 | 726 | js->chats = g_hash_table_new_full(g_str_hash, g_str_equal, |
| 8396 | 727 | g_free, (GDestroyNotify)jabber_chat_free); |
| 15884 | 728 | js->user = jabber_id_new(purple_account_get_username(account)); |
| 7322 | 729 | js->next_id = g_random_int(); |
| 15884 | 730 | js->write_buffer = purple_circ_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
|
731 | js->old_length = 0; |
|
22096
0d28b254d322
Keep track of the keepalive timeout source so it can be removed when the account disconnects. This prevents a possible crash if the timeout fired after the account disconnected.
Evan Schoenberg <evands@pidgin.im>
parents:
22067
diff
changeset
|
732 | js->keepalive_timeout = -1; |
|
23428
852abef162e9
Don't crash if the given jabber id is invalid. For example,
Mark Doliner <markdoliner@pidgin.im>
parents:
23413
diff
changeset
|
733 | js->certificate_CN = g_strdup(connect_server[0] ? connect_server : js->user ? js->user->domain : NULL); |
|
23698
0815965bd80b
Moved jingle.c global variable "sessions" into JabberStream.
Michael Ruprecht <maiku@pidgin.im>
parents:
23697
diff
changeset
|
734 | 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
|
735 | 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
|
736 | js->stun_port = 0; |
|
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26269
diff
changeset
|
737 | js->stun_query = NULL; |
| 5613 | 738 | |
| 7310 | 739 | if(!js->user) { |
| 21279 | 740 | purple_connection_error_reason (gc, |
| 741 | PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, | |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
742 | _("Invalid XMPP ID")); |
| 7310 | 743 | return; |
| 744 | } | |
|
26286
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26269
diff
changeset
|
745 | |
|
17008
502623177086
Handle people forgetting to enter a domain. Also, change 'server,' in the account options to 'domain,' which is its proper name, and hopefully less confusion
Sean Egan <seanegan@pidgin.im>
parents:
17007
diff
changeset
|
746 | if (!js->user->domain || *(js->user->domain) == '\0') { |
| 21279 | 747 | purple_connection_error_reason (gc, |
| 748 | PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, | |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
749 | _("Invalid XMPP ID. Domain must be set.")); |
|
17008
502623177086
Handle people forgetting to enter a domain. Also, change 'server,' in the account options to 'domain,' which is its proper name, and hopefully less confusion
Sean Egan <seanegan@pidgin.im>
parents:
17007
diff
changeset
|
750 | return; |
|
502623177086
Handle people forgetting to enter a domain. Also, change 'server,' in the account options to 'domain,' which is its proper name, and hopefully less confusion
Sean Egan <seanegan@pidgin.im>
parents:
17007
diff
changeset
|
751 | } |
|
26286
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26269
diff
changeset
|
752 | |
| 15884 | 753 | if((my_jb = jabber_buddy_find(js, purple_account_get_username(account), TRUE))) |
| 10289 | 754 | my_jb->subscription |= JABBER_SUB_BOTH; |
| 755 | ||
| 7014 | 756 | jabber_stream_set_state(js, JABBER_STREAM_CONNECTING); |
| 2956 | 757 | |
| 11387 | 758 | /* if they've got old-ssl mode going, we probably want to ignore SRV lookups */ |
| 15884 | 759 | if(purple_account_get_bool(js->gc->account, "old_ssl", FALSE)) { |
| 760 | if(purple_ssl_is_supported()) { | |
| 761 | js->gsc = purple_ssl_connect(js->gc->account, | |
|
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
|
762 | js->certificate_CN, |
| 15884 | 763 | purple_account_get_int(account, "port", 5223), jabber_login_callback_ssl, |
| 11387 | 764 | jabber_ssl_connect_failure, js->gc); |
| 7630 | 765 | } else { |
| 21279 | 766 | purple_connection_error_reason (js->gc, |
| 767 | PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, | |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
768 | _("SSL support unavailable")); |
| 7630 | 769 | } |
| 3311 | 770 | } |
| 3770 | 771 | |
| 11387 | 772 | /* no old-ssl, so if they've specified a connect server, we'll use that, otherwise we'll |
| 773 | * invoke the magic of SRV lookups, to figure out host and port */ | |
| 7014 | 774 | if(!js->gsc) { |
| 11387 | 775 | if(connect_server[0]) { |
|
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
|
776 | jabber_login_connect(js, js->user->domain, connect_server, purple_account_get_int(account, "port", 5222), TRUE); |
| 11387 | 777 | } else { |
| 15884 | 778 | js->srv_query_data = purple_srv_resolve("xmpp-client", |
|
14370
12ef3d4096ee
[gaim-migrate @ 16998]
Mark Doliner <markdoliner@pidgin.im>
parents:
14358
diff
changeset
|
779 | "tcp", js->user->domain, srv_resolved_cb, js); |
| 11387 | 780 | } |
| 2956 | 781 | } |
| 2086 | 782 | } |
| 783 | ||
| 11387 | 784 | |
| 7072 | 785 | static gboolean |
| 786 | conn_close_cb(gpointer data) | |
| 787 | { | |
| 788 | JabberStream *js = data; | |
| 15884 | 789 | PurpleAccount *account = purple_connection_get_account(js->gc); |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10504
diff
changeset
|
790 | |
|
17810
c8d4297080cb
Fixed a leak: The XML parser was never cleaned up on disconnect.
Andreas Monitzer <am@adiumx.com>
parents:
17806
diff
changeset
|
791 | jabber_parser_free(js); |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10504
diff
changeset
|
792 | |
| 15884 | 793 | purple_account_disconnect(account); |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10504
diff
changeset
|
794 | |
| 7072 | 795 | return FALSE; |
| 796 | } | |
| 797 | ||
| 798 | static void | |
| 799 | jabber_connection_schedule_close(JabberStream *js) | |
| 800 | { | |
| 15884 | 801 | purple_timeout_add(0, conn_close_cb, js); |
| 7072 | 802 | } |
| 803 | ||
| 804 | static void | |
| 7395 | 805 | jabber_registration_result_cb(JabberStream *js, xmlnode *packet, gpointer data) |
| 7072 | 806 | { |
|
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
|
807 | PurpleAccount *account = purple_connection_get_account(js->gc); |
| 7072 | 808 | const char *type = xmlnode_get_attrib(packet, "type"); |
| 809 | 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
|
810 | char *to = data; |
| 7072 | 811 | |
| 812 | if(!strcmp(type, "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
|
813 | if(js->registration) { |
| 7072 | 814 | buf = g_strdup_printf(_("Registration of %s@%s successful"), |
| 815 | js->user->node, js->user->domain); | |
|
17815
232d57a6b6df
Simplified registration callback per request of Sean.
Andreas Monitzer <am@adiumx.com>
parents:
17814
diff
changeset
|
816 | if(account->registration_cb) |
|
232d57a6b6df
Simplified registration callback per request of Sean.
Andreas Monitzer <am@adiumx.com>
parents:
17814
diff
changeset
|
817 | (account->registration_cb)(account, TRUE, account->registration_cb_user_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
|
818 | } 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
|
819 | 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
|
820 | 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
|
821 | 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
|
822 | } |
| 15884 | 823 | purple_notify_info(NULL, _("Registration Successful"), |
| 7072 | 824 | _("Registration Successful"), buf); |
| 825 | g_free(buf); | |
| 826 | } else { | |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
827 | char *msg = jabber_parse_error(js, packet, NULL); |
| 7072 | 828 | |
| 8401 | 829 | if(!msg) |
| 830 | msg = g_strdup(_("Unknown Error")); | |
| 7072 | 831 | |
| 15884 | 832 | purple_notify_error(NULL, _("Registration Failed"), |
| 8401 | 833 | _("Registration Failed"), msg); |
| 834 | g_free(msg); | |
|
17815
232d57a6b6df
Simplified registration callback per request of Sean.
Andreas Monitzer <am@adiumx.com>
parents:
17814
diff
changeset
|
835 | if(account->registration_cb) |
|
232d57a6b6df
Simplified registration callback per request of Sean.
Andreas Monitzer <am@adiumx.com>
parents:
17814
diff
changeset
|
836 | (account->registration_cb)(account, FALSE, account->registration_cb_user_data); |
| 7072 | 837 | } |
|
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
|
838 | 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
|
839 | if(js->registration) |
| 7072 | 840 | jabber_connection_schedule_close(js); |
| 841 | } | |
| 842 | ||
| 843 | static void | |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
844 | jabber_unregistration_result_cb(JabberStream *js, xmlnode *packet, gpointer data) |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
845 | { |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
846 | const char *type = xmlnode_get_attrib(packet, "type"); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
847 | char *buf; |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
848 | 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
|
849 | |
|
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
|
850 | /* 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
|
851 | * 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
|
852 | 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
|
853 | |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
854 | if(!strcmp(type, "result")) { |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
855 | 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
|
856 | to); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
857 | purple_notify_info(NULL, _("Unregistration Successful"), |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
858 | _("Unregistration Successful"), buf); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
859 | g_free(buf); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
860 | } else { |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
861 | 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
|
862 | |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
863 | if(!msg) |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
864 | 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
|
865 | |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
866 | purple_notify_error(NULL, _("Unregistration Failed"), |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
867 | _("Unregistration Failed"), msg); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
868 | g_free(msg); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
869 | } |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
870 | g_free(to); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
871 | } |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
872 | |
|
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
|
873 | 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
|
874 | 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
|
875 | 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
|
876 | } 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
|
877 | |
| 7072 | 878 | 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
|
879 | jabber_register_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fields) |
| 7072 | 880 | { |
| 881 | GList *groups, *flds; | |
| 882 | xmlnode *query, *y; | |
| 883 | JabberIq *iq; | |
| 7264 | 884 | char *username; |
| 7072 | 885 | |
|
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
|
886 | iq = jabber_iq_new_query(cbdata->js, JABBER_IQ_SET, "jabber:iq:register"); |
| 7072 | 887 | query = 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
|
888 | if (cbdata->who) |
|
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
|
889 | xmlnode_set_attrib(iq->node, "to", cbdata->who); |
| 7072 | 890 | |
| 15884 | 891 | for(groups = purple_request_fields_get_groups(fields); groups; |
| 7072 | 892 | groups = groups->next) { |
| 15884 | 893 | for(flds = purple_request_field_group_get_fields(groups->data); |
| 7072 | 894 | flds; flds = flds->next) { |
| 15884 | 895 | PurpleRequestField *field = flds->data; |
| 896 | const char *id = purple_request_field_get_id(field); | |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
897 | if(!strcmp(id,"unregister")) { |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
898 | 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
|
899 | if(value) { |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
900 | /* unregister from service. this doesn't include any of the fields, so remove them from the stanza by recreating it |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
901 | (there's no "remove child" function for xmlnode) */ |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
902 | jabber_iq_free(iq); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
903 | iq = jabber_iq_new_query(cbdata->js, JABBER_IQ_SET, "jabber:iq:register"); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
904 | query = 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
|
905 | if (cbdata->who) |
|
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
|
906 | xmlnode_set_attrib(iq->node,"to",cbdata->who); |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
907 | 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
|
908 | |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
909 | 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
|
910 | |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
911 | jabber_iq_send(iq); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
912 | g_free(cbdata); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
913 | return; |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
914 | } |
| 7072 | 915 | } else { |
| 15884 | 916 | const char *value = purple_request_field_string_get_value(field); |
| 7072 | 917 | |
| 918 | if(!strcmp(id, "username")) { | |
| 919 | y = xmlnode_new_child(query, "username"); | |
| 920 | } else if(!strcmp(id, "password")) { | |
| 921 | y = xmlnode_new_child(query, "password"); | |
| 922 | } else if(!strcmp(id, "name")) { | |
| 923 | y = xmlnode_new_child(query, "name"); | |
| 924 | } else if(!strcmp(id, "email")) { | |
| 925 | y = xmlnode_new_child(query, "email"); | |
| 926 | } else if(!strcmp(id, "nick")) { | |
| 927 | y = xmlnode_new_child(query, "nick"); | |
| 928 | } else if(!strcmp(id, "first")) { | |
| 929 | y = xmlnode_new_child(query, "first"); | |
| 930 | } else if(!strcmp(id, "last")) { | |
| 931 | y = xmlnode_new_child(query, "last"); | |
| 932 | } else if(!strcmp(id, "address")) { | |
| 933 | y = xmlnode_new_child(query, "address"); | |
| 934 | } else if(!strcmp(id, "city")) { | |
| 935 | y = xmlnode_new_child(query, "city"); | |
| 936 | } else if(!strcmp(id, "state")) { | |
| 937 | y = xmlnode_new_child(query, "state"); | |
| 938 | } else if(!strcmp(id, "zip")) { | |
| 939 | y = xmlnode_new_child(query, "zip"); | |
| 940 | } else if(!strcmp(id, "phone")) { | |
| 941 | y = xmlnode_new_child(query, "phone"); | |
| 942 | } else if(!strcmp(id, "url")) { | |
| 943 | y = xmlnode_new_child(query, "url"); | |
| 944 | } else if(!strcmp(id, "date")) { | |
| 945 | y = xmlnode_new_child(query, "date"); | |
| 946 | } else { | |
| 947 | continue; | |
| 948 | } | |
| 949 | xmlnode_insert_data(y, value, -1); | |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
950 | if(cbdata->js->registration && !strcmp(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
|
951 | 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
|
952 | cbdata->js->user->node = g_strdup(value); |
| 7264 | 953 | } |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
954 | if(cbdata->js->registration && !strcmp(id, "password")) |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
955 | purple_account_set_password(cbdata->js->gc->account, value); |
| 7072 | 956 | } |
| 957 | } | |
|
19897
8b5abbdebc87
merge of 'b0586b3697e8044ccd62a369b0c0f9125b2ef732'
Daniel Atallah <datallah@pidgin.im>
diff
changeset
|
958 | } |
| 7072 | 959 | |
|
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
|
960 | if(cbdata->js->registration) { |
|
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
|
961 | username = g_strdup_printf("%s@%s/%s", cbdata->js->user->node, cbdata->js->user->domain, |
|
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
|
962 | cbdata->js->user->resource); |
|
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
|
963 | purple_account_set_username(cbdata->js->gc->account, username); |
|
21668
3698b848759b
The Jabber registration process depends upon having a non-NULL cbdata->who,
Evan Schoenberg <evands@pidgin.im>
parents:
21667
diff
changeset
|
964 | 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
|
965 | } |
| 7264 | 966 | |
|
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
|
967 | jabber_iq_set_callback(iq, jabber_registration_result_cb, cbdata->who); |
| 7072 | 968 | |
| 969 | 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
|
970 | g_free(cbdata); |
| 7072 | 971 | } |
| 972 | ||
| 973 | 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
|
974 | jabber_register_cancel_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fields) |
| 7072 | 975 | { |
|
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
|
976 | 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
|
977 | if(account && cbdata->js->registration) { |
|
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
|
978 | if(account->registration_cb) |
|
17815
232d57a6b6df
Simplified registration callback per request of Sean.
Andreas Monitzer <am@adiumx.com>
parents:
17814
diff
changeset
|
979 | (account->registration_cb)(account, FALSE, account->registration_cb_user_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
|
980 | jabber_connection_schedule_close(cbdata->js); |
|
20320
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20316
diff
changeset
|
981 | } |
|
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
|
982 | 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
|
983 | g_free(cbdata); |
| 7072 | 984 | } |
| 985 | ||
| 7923 | 986 | static void jabber_register_x_data_cb(JabberStream *js, xmlnode *result, gpointer data) |
| 987 | { | |
| 988 | xmlnode *query; | |
| 989 | 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
|
990 | char *to = data; |
| 7923 | 991 | |
| 992 | iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register"); | |
| 993 | query = 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
|
994 | if (to) |
|
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
|
995 | xmlnode_set_attrib(iq->node,"to",to); |
| 7923 | 996 | |
| 997 | xmlnode_insert_child(query, result); | |
| 998 | ||
|
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
|
999 | jabber_iq_set_callback(iq, jabber_registration_result_cb, to); |
| 7923 | 1000 | jabber_iq_send(iq); |
| 1001 | } | |
| 1002 | ||
| 7072 | 1003 | void jabber_register_parse(JabberStream *js, xmlnode *packet) |
| 1004 | { | |
|
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
|
1005 | PurpleAccount *account = purple_connection_get_account(js->gc); |
| 14356 | 1006 | const char *type; |
|
21668
3698b848759b
The Jabber registration process depends upon having a non-NULL cbdata->who,
Evan Schoenberg <evands@pidgin.im>
parents:
21667
diff
changeset
|
1007 | const char *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
|
1008 | 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
|
1009 | 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
|
1010 | PurpleRequestField *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
|
1011 | xmlnode *query, *x, *y; |
|
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
|
1012 | 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
|
1013 | JabberRegisterCBData *cbdata; |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1014 | gboolean registered = FALSE; |
| 7072 | 1015 | |
| 14356 | 1016 | if(!(type = xmlnode_get_attrib(packet, "type")) || strcmp(type, "result")) |
| 1017 | return; | |
| 1018 | ||
|
21668
3698b848759b
The Jabber registration process depends upon having a non-NULL cbdata->who,
Evan Schoenberg <evands@pidgin.im>
parents:
21667
diff
changeset
|
1019 | from = xmlnode_get_attrib(packet, "from"); |
|
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
|
1020 | |
|
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
|
1021 | if(js->registration) { |
| 7072 | 1022 | /* get rid of the login thingy */ |
| 15884 | 1023 | purple_connection_set_state(js->gc, PURPLE_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
|
1024 | } |
| 7072 | 1025 | |
|
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
|
1026 | query = xmlnode_get_child(packet, "query"); |
| 7072 | 1027 | |
|
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
|
1028 | if(xmlnode_get_child(query, "registered")) { |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1029 | 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
|
1030 | |
|
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
|
1031 | if(js->registration) { |
| 15884 | 1032 | purple_notify_error(NULL, _("Already Registered"), |
|
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
|
1033 | _("Already Registered"), NULL); |
|
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
|
1034 | if(account->registration_cb) |
|
17815
232d57a6b6df
Simplified registration callback per request of Sean.
Andreas Monitzer <am@adiumx.com>
parents:
17814
diff
changeset
|
1035 | (account->registration_cb)(account, FALSE, account->registration_cb_user_data); |
| 7072 | 1036 | jabber_connection_schedule_close(js); |
| 1037 | return; | |
| 1038 | } | |
|
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
|
1039 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
1040 | |
|
25573
6937721bb0a1
The jabber_register_parse function was looking for the <x> node as a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25552
diff
changeset
|
1041 | if((x = 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
|
1042 | 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
|
1043 | 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
|
1044 | |
|
25573
6937721bb0a1
The jabber_register_parse function was looking for the <x> node as a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25552
diff
changeset
|
1045 | } else if((x = xmlnode_get_child_with_namespace(query, "x", "jabber:x:oob"))) { |
|
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
|
1046 | xmlnode *url; |
| 7923 | 1047 | |
|
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
|
1048 | if((url = xmlnode_get_child(x, "url"))) { |
|
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
|
1049 | char *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
|
1050 | if((href = xmlnode_get_data(url))) { |
|
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
|
1051 | 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
|
1052 | 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
|
1053 | |
|
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
|
1054 | if(js->registration) { |
|
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
|
1055 | js->gc->wants_to_die = TRUE; |
|
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
|
1056 | if(account->registration_cb) /* succeeded, but we have no login info */ |
|
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
|
1057 | (account->registration_cb)(account, TRUE, account->registration_cb_user_data); |
|
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
|
1058 | jabber_connection_schedule_close(js); |
| 8398 | 1059 | } |
|
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
|
1060 | return; |
| 7923 | 1061 | } |
| 1062 | } | |
|
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
|
1063 | } |
| 7923 | 1064 | |
|
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
|
1065 | /* as a last resort, use the old jabber:iq:register syntax */ |
| 7923 | 1066 | |
|
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
|
1067 | 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
|
1068 | 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
|
1069 | purple_request_fields_add_group(fields, group); |
| 7072 | 1070 | |
|
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
|
1071 | if(js->registration) |
|
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
|
1072 | field = purple_request_field_string_new("username", _("Username"), js->user->node, 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
|
1073 | else |
|
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
|
1074 | field = purple_request_field_string_new("username", _("Username"), NULL, FALSE); |
| 7072 | 1075 | |
|
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
|
1076 | purple_request_field_group_add_field(group, field); |
| 7072 | 1077 | |
|
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
|
1078 | if(js->registration) |
| 15884 | 1079 | field = purple_request_field_string_new("password", _("Password"), |
|
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
|
1080 | purple_connection_get_password(js->gc), 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
|
1081 | else |
|
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
|
1082 | field = purple_request_field_string_new("password", _("Password"), NULL, FALSE); |
| 7072 | 1083 | |
|
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
|
1084 | purple_request_field_string_set_masked(field, TRUE); |
|
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
|
1085 | purple_request_field_group_add_field(group, field); |
| 7072 | 1086 | |
|
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
|
1087 | if(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
|
1088 | if(js->registration) |
| 15884 | 1089 | field = purple_request_field_string_new("name", _("Name"), |
|
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
|
1090 | purple_account_get_alias(js->gc->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
|
1091 | else |
|
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
|
1092 | field = purple_request_field_string_new("name", _("Name"), NULL, FALSE); |
|
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
|
1093 | 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
|
1094 | } |
|
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
|
1095 | if(xmlnode_get_child(query, "email")) { |
|
23325
a374a26fe217
Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@pidgin.im>
parents:
23097
diff
changeset
|
1096 | field = purple_request_field_string_new("email", _("Email"), NULL, FALSE); |
|
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
|
1097 | 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
|
1098 | } |
|
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
|
1099 | if(xmlnode_get_child(query, "nick")) { |
|
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
|
1100 | field = purple_request_field_string_new("nick", _("Nickname"), NULL, FALSE); |
|
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
|
1101 | 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
|
1102 | } |
|
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
|
1103 | if(xmlnode_get_child(query, "first")) { |
|
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
|
1104 | field = purple_request_field_string_new("first", _("First name"), NULL, FALSE); |
|
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
|
1105 | 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
|
1106 | } |
|
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
|
1107 | if(xmlnode_get_child(query, "last")) { |
|
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
|
1108 | field = purple_request_field_string_new("last", _("Last name"), NULL, FALSE); |
|
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
|
1109 | 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
|
1110 | } |
|
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
|
1111 | if(xmlnode_get_child(query, "address")) { |
|
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
|
1112 | field = purple_request_field_string_new("address", _("Address"), NULL, FALSE); |
|
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
|
1113 | 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
|
1114 | } |
|
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
|
1115 | if(xmlnode_get_child(query, "city")) { |
|
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
|
1116 | field = purple_request_field_string_new("city", _("City"), NULL, FALSE); |
|
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
|
1117 | 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
|
1118 | } |
|
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
|
1119 | if(xmlnode_get_child(query, "state")) { |
|
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
|
1120 | field = purple_request_field_string_new("state", _("State"), NULL, FALSE); |
|
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
|
1121 | 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
|
1122 | } |
|
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
|
1123 | if(xmlnode_get_child(query, "zip")) { |
|
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
|
1124 | field = purple_request_field_string_new("zip", _("Postal code"), NULL, FALSE); |
|
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
|
1125 | 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
|
1126 | } |
|
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
|
1127 | if(xmlnode_get_child(query, "phone")) { |
|
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
|
1128 | field = purple_request_field_string_new("phone", _("Phone"), NULL, FALSE); |
|
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
|
1129 | 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
|
1130 | } |
|
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
|
1131 | if(xmlnode_get_child(query, "url")) { |
|
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
|
1132 | field = purple_request_field_string_new("url", _("URL"), NULL, FALSE); |
|
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
|
1133 | 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
|
1134 | } |
|
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
|
1135 | if(xmlnode_get_child(query, "date")) { |
|
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
|
1136 | field = purple_request_field_string_new("date", _("Date"), NULL, FALSE); |
|
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
|
1137 | 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
|
1138 | } |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1139 | if(registered) { |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1140 | 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
|
1141 | 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
|
1142 | } |
| 7072 | 1143 | |
|
20320
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20316
diff
changeset
|
1144 | if((y = xmlnode_get_child(query, "instructions"))) |
|
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20316
diff
changeset
|
1145 | instructions = xmlnode_get_data(y); |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1146 | else if(registered) |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1147 | 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
|
1148 | "to change your account registration.")); |
|
20320
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20316
diff
changeset
|
1149 | else |
|
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20316
diff
changeset
|
1150 | instructions = g_strdup(_("Please fill out the information below " |
|
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20316
diff
changeset
|
1151 | "to register your new account.")); |
| 7072 | 1152 | |
|
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
|
1153 | 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
|
1154 | 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
|
1155 | cbdata->who = g_strdup(from); |
| 7072 | 1156 | |
|
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
|
1157 | if(js->registration) |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
1158 | 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
|
1159 | _("Register New XMPP Account"), instructions, fields, |
| 7072 | 1160 | _("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
|
1161 | _("Cancel"), G_CALLBACK(jabber_register_cancel_cb), |
|
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
|
1162 | purple_connection_get_account(js->gc), NULL, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
1163 | 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
|
1164 | 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
|
1165 | 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
|
1166 | 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
|
1167 | 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
|
1168 | :g_strdup_printf(_("Register New Account at %s"), from); |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
1169 | purple_request_fields(js->gc, title, |
|
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
|
1170 | title, instructions, fields, |
|
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
|
1171 | (registered ? _("Change Registration") : _("Register")), G_CALLBACK(jabber_register_cb), |
|
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
|
1172 | _("Cancel"), G_CALLBACK(jabber_register_cancel_cb), |
|
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
|
1173 | purple_connection_get_account(js->gc), NULL, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
1174 | 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
|
1175 | 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
|
1176 | } |
|
14140
fcb570e0b2db
[gaim-migrate @ 16699]
Daniel Atallah <datallah@pidgin.im>
parents:
14115
diff
changeset
|
1177 | |
|
20320
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20316
diff
changeset
|
1178 | g_free(instructions); |
|
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20316
diff
changeset
|
1179 | } |
| 7072 | 1180 | |
| 8016 | 1181 | void jabber_register_start(JabberStream *js) |
| 7072 | 1182 | { |
| 1183 | JabberIq *iq; | |
| 1184 | ||
| 1185 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:register"); | |
| 1186 | jabber_iq_send(iq); | |
| 1187 | } | |
| 1188 | ||
|
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
|
1189 | 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
|
1190 | 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
|
1191 | |
|
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
|
1192 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:register"); |
|
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
|
1193 | xmlnode_set_attrib(iq->node, "to", 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
|
1194 | 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
|
1195 | } |
|
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
|
1196 | |
|
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
|
1197 | void jabber_register_account(PurpleAccount *account) |
| 7072 | 1198 | { |
| 15884 | 1199 | PurpleConnection *gc = purple_account_get_connection(account); |
| 7072 | 1200 | JabberStream *js; |
| 10289 | 1201 | JabberBuddy *my_jb = NULL; |
| 15884 | 1202 | const char *connect_server = purple_account_get_string(account, |
| 7072 | 1203 | "connect_server", ""); |
| 1204 | const char *server; | |
| 1205 | ||
| 1206 | js = gc->proto_data = g_new0(JabberStream, 1); | |
| 1207 | js->gc = gc; | |
| 1208 | js->registration = TRUE; | |
| 8312 | 1209 | js->iq_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, |
| 1210 | g_free, g_free); | |
| 1211 | js->disco_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, | |
| 7395 | 1212 | g_free, g_free); |
| 15884 | 1213 | js->user = jabber_id_new(purple_account_get_username(account)); |
| 7322 | 1214 | js->next_id = g_random_int(); |
|
22111
7b7ed5e93969
Fixes for incorrectly displaying user tune emblem and empty current media.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22101
diff
changeset
|
1215 | js->old_length = 0; |
| 7072 | 1216 | |
| 7310 | 1217 | if(!js->user) { |
| 21279 | 1218 | purple_connection_error_reason (gc, |
| 1219 | PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, | |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
1220 | _("Invalid XMPP ID")); |
| 7310 | 1221 | return; |
| 1222 | } | |
| 1223 | ||
| 15884 | 1224 | js->write_buffer = purple_circ_buffer_new(512); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
1225 | |
| 15884 | 1226 | if((my_jb = jabber_buddy_find(js, purple_account_get_username(account), TRUE))) |
| 10289 | 1227 | my_jb->subscription |= JABBER_SUB_BOTH; |
| 1228 | ||
| 7072 | 1229 | server = connect_server[0] ? connect_server : js->user->domain; |
|
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
|
1230 | js->certificate_CN = g_strdup(server); |
| 7072 | 1231 | |
|
26286
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26269
diff
changeset
|
1232 | 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
|
1233 | js->stun_port = 0; |
|
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26269
diff
changeset
|
1234 | js->stun_query = NULL; |
|
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26269
diff
changeset
|
1235 | |
| 7072 | 1236 | jabber_stream_set_state(js, JABBER_STREAM_CONNECTING); |
| 1237 | ||
| 15884 | 1238 | if(purple_account_get_bool(account, "old_ssl", FALSE)) { |
| 1239 | if(purple_ssl_is_supported()) { | |
| 1240 | js->gsc = purple_ssl_connect(account, server, | |
| 1241 | purple_account_get_int(account, "port", 5222), | |
| 7630 | 1242 | jabber_login_callback_ssl, jabber_ssl_connect_failure, gc); |
| 1243 | } else { | |
| 21279 | 1244 | purple_connection_error_reason (gc, |
| 1245 | PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, | |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
1246 | _("SSL support unavailable")); |
| 7630 | 1247 | } |
| 7072 | 1248 | } |
| 1249 | ||
| 1250 | if(!js->gsc) { | |
| 15069 | 1251 | if (connect_server[0]) { |
| 17052 | 1252 | jabber_login_connect(js, js->user->domain, server, |
| 15884 | 1253 | purple_account_get_int(account, |
|
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
|
1254 | "port", 5222), TRUE); |
| 15069 | 1255 | } else { |
| 15884 | 1256 | js->srv_query_data = purple_srv_resolve("xmpp-client", |
| 15069 | 1257 | "tcp", |
| 1258 | js->user->domain, | |
| 1259 | srv_resolved_cb, | |
| 1260 | js); | |
| 1261 | } | |
| 7072 | 1262 | } |
| 1263 | } | |
| 1264 | ||
|
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
|
1265 | static void jabber_unregister_account_iq_cb(JabberStream *js, xmlnode *packet, gpointer data) { |
|
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
|
1266 | PurpleAccount *account = purple_connection_get_account(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
|
1267 | const char *type = xmlnode_get_attrib(packet,"type"); |
|
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
|
1268 | if(!strcmp(type,"error")) { |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
1269 | 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
|
1270 | |
|
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
|
1271 | purple_notify_error(js->gc, _("Error unregistering 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
|
1272 | _("Error unregistering account"), msg); |
|
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
|
1273 | 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
|
1274 | if(js->unregistration_cb) |
|
18995
6ba7743720cb
Mixed up TRUE and FALSE.
Andreas Monitzer <am@adiumx.com>
parents:
18994
diff
changeset
|
1275 | js->unregistration_cb(account, FALSE, 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
|
1276 | } else if(!strcmp(type,"result")) { |
|
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
|
1277 | purple_notify_info(js->gc, _("Account successfully unregistered"), |
|
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
|
1278 | _("Account successfully unregistered"), NULL); |
|
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
|
1279 | if(js->unregistration_cb) |
|
18995
6ba7743720cb
Mixed up TRUE and FALSE.
Andreas Monitzer <am@adiumx.com>
parents:
18994
diff
changeset
|
1280 | 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
|
1281 | } |
|
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
|
1282 | } |
|
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
|
1283 | |
|
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
|
1284 | 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
|
1285 | JabberIq *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
|
1286 | xmlnode *query; |
|
19994
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1287 | |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1288 | 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
|
1289 | |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1290 | 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
|
1291 | |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1292 | query = xmlnode_get_child_with_namespace(iq->node, "query", "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
|
1293 | |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1294 | xmlnode_new_child(query, "remove"); |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1295 | xmlnode_set_attrib(iq->node, "to", js->user->domain); |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1296 | |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1297 | 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
|
1298 | 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
|
1299 | } |
|
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
|
1300 | |
|
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
|
1301 | 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
|
1302 | 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
|
1303 | 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
|
1304 | |
|
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
|
1305 | if(gc->state != PURPLE_CONNECTED) { |
|
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
|
1306 | if(gc->state != PURPLE_CONNECTING) |
|
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
|
1307 | jabber_login(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
|
1308 | js = gc->proto_data; |
|
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
|
1309 | 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
|
1310 | 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
|
1311 | 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
|
1312 | 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
|
1313 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
1314 | |
|
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
|
1315 | js = gc->proto_data; |
|
19994
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1316 | |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1317 | 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
|
1318 | 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
|
1319 | return; |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1320 | } |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1321 | |
|
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
|
1322 | 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
|
1323 | 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
|
1324 | 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
|
1325 | |
|
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
|
1326 | 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
|
1327 | } |
|
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
|
1328 | |
|
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
|
1329 | void jabber_close(PurpleConnection *gc) |
| 2086 | 1330 | { |
| 7014 | 1331 | JabberStream *js = gc->proto_data; |
| 2956 | 1332 | |
|
23717
5a7e463b226d
Further decoupled Jingle code from jabber.c:
Michael Ruprecht <maiku@pidgin.im>
parents:
23716
diff
changeset
|
1333 | /* 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
|
1334 | 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
|
1335 | |
| 14004 | 1336 | /* Don't perform any actions on the ssl connection |
| 1337 | * if we were forcibly disconnected because it will crash | |
| 1338 | * on some SSL backends. | |
|
13154
1a93fddf2a9a
[gaim-migrate @ 15516]
Evan Schoenberg <evands@pidgin.im>
parents:
13051
diff
changeset
|
1339 | */ |
|
1a93fddf2a9a
[gaim-migrate @ 15516]
Evan Schoenberg <evands@pidgin.im>
parents:
13051
diff
changeset
|
1340 | if (!gc->disconnect_timeout) |
| 14003 | 1341 | jabber_send_raw(js, "</stream:stream>", -1); |
| 3311 | 1342 | |
|
14370
12ef3d4096ee
[gaim-migrate @ 16998]
Mark Doliner <markdoliner@pidgin.im>
parents:
14358
diff
changeset
|
1343 | if (js->srv_query_data) |
| 15884 | 1344 | purple_srv_cancel(js->srv_query_data); |
|
14370
12ef3d4096ee
[gaim-migrate @ 16998]
Mark Doliner <markdoliner@pidgin.im>
parents:
14358
diff
changeset
|
1345 | |
| 7014 | 1346 | if(js->gsc) { |
|
13243
5a127fc7db90
[gaim-migrate @ 15608]
Evan Schoenberg <evands@pidgin.im>
parents:
13238
diff
changeset
|
1347 | #ifdef HAVE_OPENSSL |
|
5a127fc7db90
[gaim-migrate @ 15608]
Evan Schoenberg <evands@pidgin.im>
parents:
13238
diff
changeset
|
1348 | if (!gc->disconnect_timeout) |
| 13385 | 1349 | #endif |
| 15884 | 1350 | purple_ssl_close(js->gsc); |
| 8360 | 1351 | } else if (js->fd > 0) { |
| 7072 | 1352 | if(js->gc->inpa) |
| 15884 | 1353 | purple_input_remove(js->gc->inpa); |
| 7014 | 1354 | close(js->fd); |
| 1355 | } | |
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
1356 | |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
1357 | jabber_buddy_remove_all_pending_buddy_info_requests(js); |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
1358 | |
|
17810
c8d4297080cb
Fixed a leak: The XML parser was never cleaned up on disconnect.
Andreas Monitzer <am@adiumx.com>
parents:
17806
diff
changeset
|
1359 | 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
|
1360 | |
| 8312 | 1361 | if(js->iq_callbacks) |
| 1362 | g_hash_table_destroy(js->iq_callbacks); | |
| 1363 | if(js->disco_callbacks) | |
| 1364 | g_hash_table_destroy(js->disco_callbacks); | |
| 7072 | 1365 | if(js->buddies) |
| 1366 | g_hash_table_destroy(js->buddies); | |
| 1367 | if(js->chats) | |
| 1368 | 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
|
1369 | |
| 8043 | 1370 | while(js->chat_servers) { |
| 1371 | g_free(js->chat_servers->data); | |
| 1372 | js->chat_servers = g_list_delete_link(js->chat_servers, js->chat_servers); | |
| 1373 | } | |
|
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
|
1374 | |
| 11675 | 1375 | while(js->user_directories) { |
| 1376 | g_free(js->user_directories->data); | |
| 1377 | js->user_directories = g_list_delete_link(js->user_directories, js->user_directories); | |
| 1378 | } | |
|
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
|
1379 | |
|
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
|
1380 | 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
|
1381 | 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
|
1382 | 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
|
1383 | 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
|
1384 | 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
|
1385 | 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
|
1386 | 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
|
1387 | } |
|
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
|
1388 | |
|
24012
913d6f18cb95
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <datallah@pidgin.im>
parents:
23911
diff
changeset
|
1389 | while(js->url_datas) { |
|
913d6f18cb95
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <datallah@pidgin.im>
parents:
23911
diff
changeset
|
1390 | purple_util_fetch_url_cancel(js->url_datas->data); |
|
913d6f18cb95
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <datallah@pidgin.im>
parents:
23911
diff
changeset
|
1391 | js->url_datas = g_slist_delete_link(js->url_datas, js->url_datas); |
|
913d6f18cb95
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <datallah@pidgin.im>
parents:
23911
diff
changeset
|
1392 | } |
|
913d6f18cb95
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <datallah@pidgin.im>
parents:
23911
diff
changeset
|
1393 | |
|
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
|
1394 | g_free(js->stream_id); |
| 7587 | 1395 | if(js->user) |
| 1396 | jabber_id_free(js->user); | |
|
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
|
1397 | g_free(js->avatar_hash); |
|
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
|
1398 | |
| 15884 | 1399 | purple_circ_buffer_destroy(js->write_buffer); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
1400 | if(js->writeh) |
| 15884 | 1401 | purple_input_remove(js->writeh); |
| 12508 | 1402 | #ifdef HAVE_CYRUS_SASL |
| 1403 | if(js->sasl) | |
| 1404 | sasl_dispose(&js->sasl); | |
| 1405 | if(js->sasl_mechs) | |
| 1406 | 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
|
1407 | g_free(js->sasl_cb); |
|
18449
2d2df64f4303
applied changes from f9186fabb483b56a9d7e8fb7241b2520e9930413
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18235
diff
changeset
|
1408 | #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
|
1409 | 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
|
1410 | 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
|
1411 | 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
|
1412 | 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
|
1413 | g_free(cmd->node); |
| 17827 | 1414 | 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
|
1415 | 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
|
1416 | 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
|
1417 | } |
| 15198 | 1418 | 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
|
1419 | g_free(js->certificate_CN); |
| 15225 | 1420 | g_free(js->gmail_last_time); |
| 1421 | 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
|
1422 | 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
|
1423 | 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
|
1424 | 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
|
1425 | 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
|
1426 | 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
|
1427 | 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
|
1428 | g_free(js->old_track); |
|
23097
fd61a293d5e1
patch from Andrew Gaul to fix another memleak
Ka-Hing Cheung <khc@pidgin.im>
parents:
22759
diff
changeset
|
1429 | g_free(js->expected_rspauth); |
|
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
|
1430 | |
|
22096
0d28b254d322
Keep track of the keepalive timeout source so it can be removed when the account disconnects. This prevents a possible crash if the timeout fired after the account disconnected.
Evan Schoenberg <evands@pidgin.im>
parents:
22067
diff
changeset
|
1431 | if (js->keepalive_timeout != -1) |
|
0d28b254d322
Keep track of the keepalive timeout source so it can be removed when the account disconnects. This prevents a possible crash if the timeout fired after the account disconnected.
Evan Schoenberg <evands@pidgin.im>
parents:
22067
diff
changeset
|
1432 | purple_timeout_remove(js->keepalive_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
|
1433 | |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
1434 | g_free(js->srv_rec); |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
1435 | js->srv_rec = NULL; |
|
f8989c154a60
Add support for using multiple "xmpp-client" records on a domain, by trying the
Daniel Atallah <datallah@pidgin.im>
parents:
23539
diff
changeset
|
1436 | |
|
26286
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26269
diff
changeset
|
1437 | g_free(js->stun_ip); |
|
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26269
diff
changeset
|
1438 | 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
|
1439 | |
|
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26269
diff
changeset
|
1440 | /* cancel DNS query for STUN, if one is ongoing */ |
|
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26269
diff
changeset
|
1441 | if (js->stun_query) { |
|
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26269
diff
changeset
|
1442 | purple_dnsquery_destroy(js->stun_query); |
|
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26269
diff
changeset
|
1443 | js->stun_query = NULL; |
|
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26269
diff
changeset
|
1444 | } |
|
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26269
diff
changeset
|
1445 | |
|
23911
f54fe603e84a
Fix a stupid mistake in the previous commit.
Daniel Atallah <datallah@pidgin.im>
parents:
23910
diff
changeset
|
1446 | g_free(js); |
|
f54fe603e84a
Fix a stupid mistake in the previous commit.
Daniel Atallah <datallah@pidgin.im>
parents:
23910
diff
changeset
|
1447 | |
|
11389
c1e05b75b0b0
[gaim-migrate @ 13617]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11387
diff
changeset
|
1448 | gc->proto_data = NULL; |
| 5093 | 1449 | } |
| 1450 | ||
| 7014 | 1451 | void jabber_stream_set_state(JabberStream *js, JabberStreamState state) |
|
3105
8c23b0ec1036
[gaim-migrate @ 3119]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3074
diff
changeset
|
1452 | { |
| 7014 | 1453 | js->state = state; |
| 1454 | switch(state) { | |
| 1455 | case JABBER_STREAM_OFFLINE: | |
| 1456 | break; | |
| 1457 | case JABBER_STREAM_CONNECTING: | |
| 15884 | 1458 | purple_connection_update_progress(js->gc, _("Connecting"), 1, |
| 7014 | 1459 | JABBER_CONNECT_STEPS); |
| 1460 | break; | |
| 1461 | case JABBER_STREAM_INITIALIZING: | |
| 15884 | 1462 | purple_connection_update_progress(js->gc, _("Initializing Stream"), |
| 7014 | 1463 | js->gsc ? 5 : 2, JABBER_CONNECT_STEPS); |
| 1464 | jabber_stream_init(js); | |
| 1465 | 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
|
1466 | 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
|
1467 | 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
|
1468 | 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
|
1469 | break; |
| 7014 | 1470 | case JABBER_STREAM_AUTHENTICATING: |
| 15884 | 1471 | 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
|
1472 | js->gsc ? 7 : 3, JABBER_CONNECT_STEPS); |
| 8296 | 1473 | if(js->protocol_version == JABBER_PROTO_0_9 && js->registration) { |
| 1474 | jabber_register_start(js); | |
| 1475 | } else if(js->auth_type == JABBER_AUTH_IQ_AUTH) { | |
|
25242
36a2911cba0f
some server(s) don't like empty resource which we now default to. I am not
Ka-Hing Cheung <khc@pidgin.im>
parents:
25087
diff
changeset
|
1476 | /* with dreamhost's xmpp server at least, you have to |
|
36a2911cba0f
some server(s) don't like empty resource which we now default to. I am not
Ka-Hing Cheung <khc@pidgin.im>
parents:
25087
diff
changeset
|
1477 | specify a resource or you will get a "406: Not |
|
36a2911cba0f
some server(s) don't like empty resource which we now default to. I am not
Ka-Hing Cheung <khc@pidgin.im>
parents:
25087
diff
changeset
|
1478 | Acceptable" |
|
36a2911cba0f
some server(s) don't like empty resource which we now default to. I am not
Ka-Hing Cheung <khc@pidgin.im>
parents:
25087
diff
changeset
|
1479 | */ |
|
36a2911cba0f
some server(s) don't like empty resource which we now default to. I am not
Ka-Hing Cheung <khc@pidgin.im>
parents:
25087
diff
changeset
|
1480 | if(!js->user->resource || *js->user->resource == '\0') { |
|
36a2911cba0f
some server(s) don't like empty resource which we now default to. I am not
Ka-Hing Cheung <khc@pidgin.im>
parents:
25087
diff
changeset
|
1481 | g_free(js->user->resource); |
|
36a2911cba0f
some server(s) don't like empty resource which we now default to. I am not
Ka-Hing Cheung <khc@pidgin.im>
parents:
25087
diff
changeset
|
1482 | js->user->resource = g_strdup("Home"); |
|
36a2911cba0f
some server(s) don't like empty resource which we now default to. I am not
Ka-Hing Cheung <khc@pidgin.im>
parents:
25087
diff
changeset
|
1483 | } |
|
36a2911cba0f
some server(s) don't like empty resource which we now default to. I am not
Ka-Hing Cheung <khc@pidgin.im>
parents:
25087
diff
changeset
|
1484 | |
| 8296 | 1485 | jabber_auth_start_old(js); |
| 8016 | 1486 | } |
| 7014 | 1487 | break; |
| 1488 | case JABBER_STREAM_REINITIALIZING: | |
| 15884 | 1489 | 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
|
1490 | (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
|
1491 | |
| 14700 | 1492 | /* The stream will be reinitialized later, in jabber_recv_cb_ssl() */ |
| 1493 | js->reinit = TRUE; | |
|
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
|
1494 | |
| 7014 | 1495 | break; |
| 1496 | case JABBER_STREAM_CONNECTED: | |
|
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
|
1497 | /* now we can alert the core that we're ready to send status */ |
| 15884 | 1498 | purple_connection_set_state(js->gc, PURPLE_CONNECTED); |
| 8312 | 1499 | jabber_disco_items_server(js); |
| 7014 | 1500 | break; |
|
3105
8c23b0ec1036
[gaim-migrate @ 3119]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3074
diff
changeset
|
1501 | } |
|
8c23b0ec1036
[gaim-migrate @ 3119]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3074
diff
changeset
|
1502 | } |
|
8c23b0ec1036
[gaim-migrate @ 3119]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3074
diff
changeset
|
1503 | |
| 7014 | 1504 | char *jabber_get_next_id(JabberStream *js) |
| 2086 | 1505 | { |
| 15884 | 1506 | return g_strdup_printf("purple%x", js->next_id++); |
| 2086 | 1507 | } |
| 1508 | ||
|
14453
1cc75906700c
[gaim-migrate @ 17098]
Mark Doliner <markdoliner@pidgin.im>
parents:
14375
diff
changeset
|
1509 | |
|
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
|
1510 | void jabber_idle_set(PurpleConnection *gc, int idle) |
|
3340
7e59a209931d
[gaim-migrate @ 3359]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3337
diff
changeset
|
1511 | { |
| 7014 | 1512 | JabberStream *js = gc->proto_data; |
|
3340
7e59a209931d
[gaim-migrate @ 3359]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3337
diff
changeset
|
1513 | |
| 7014 | 1514 | js->idle = idle ? time(NULL) - idle : idle; |
|
3314
12fa45677717
[gaim-migrate @ 3332]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3311
diff
changeset
|
1515 | } |
|
12fa45677717
[gaim-migrate @ 3332]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3311
diff
changeset
|
1516 | |
|
25290
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1517 | static void jabber_blocklist_parse(JabberStream *js, xmlnode *packet, gpointer data) |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1518 | { |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1519 | xmlnode *blocklist, *item; |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1520 | PurpleAccount *account; |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1521 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1522 | blocklist = xmlnode_get_child_with_namespace(packet, |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1523 | "blocklist", "urn:xmpp:blocking"); |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1524 | 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
|
1525 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1526 | if (blocklist == NULL) |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1527 | return; |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1528 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1529 | item = xmlnode_get_child(blocklist, "item"); |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1530 | while (item != NULL) { |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1531 | const char *jid = xmlnode_get_attrib(item, "jid"); |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1532 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1533 | purple_privacy_deny_add(account, jid, TRUE); |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1534 | item = xmlnode_get_next_twin(item); |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1535 | } |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1536 | } |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1537 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1538 | 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
|
1539 | { |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1540 | JabberIq *iq; |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1541 | xmlnode *blocklist; |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1542 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1543 | 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
|
1544 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1545 | blocklist = xmlnode_new_child(iq->node, "blocklist"); |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1546 | xmlnode_set_namespace(blocklist, "urn:xmpp:blocking"); |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1547 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1548 | 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
|
1549 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1550 | 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
|
1551 | } |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1552 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1553 | 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
|
1554 | { |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1555 | JabberStream *js; |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1556 | JabberIq *iq; |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1557 | xmlnode *block, *item; |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1558 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1559 | js = gc->proto_data; |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1560 | if (js == NULL) |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1561 | return; |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1562 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1563 | 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
|
1564 | { |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1565 | jabber_google_roster_add_deny(gc, who); |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1566 | return; |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1567 | } |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1568 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1569 | 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
|
1570 | { |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1571 | purple_notify_error(NULL, _("Server doesn't support blocking"), |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1572 | _("Server doesn't support blocking"), NULL); |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1573 | return; |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1574 | } |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1575 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1576 | 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
|
1577 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1578 | block = xmlnode_new_child(iq->node, "block"); |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1579 | xmlnode_set_namespace(block, "urn:xmpp:blocking"); |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1580 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1581 | item = xmlnode_new_child(block, "item"); |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1582 | xmlnode_set_attrib(item, "jid", who); |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1583 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1584 | 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
|
1585 | } |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1586 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1587 | 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
|
1588 | { |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1589 | JabberStream *js; |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1590 | JabberIq *iq; |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1591 | xmlnode *unblock, *item; |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1592 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1593 | js = gc->proto_data; |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1594 | if (js == NULL) |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1595 | return; |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1596 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1597 | 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
|
1598 | { |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1599 | jabber_google_roster_rem_deny(gc, who); |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1600 | return; |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1601 | } |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1602 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1603 | 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
|
1604 | return; |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1605 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1606 | 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
|
1607 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1608 | unblock = xmlnode_new_child(iq->node, "unblock"); |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1609 | xmlnode_set_namespace(unblock, "urn:xmpp:blocking"); |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1610 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1611 | item = xmlnode_new_child(unblock, "item"); |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1612 | xmlnode_set_attrib(item, "jid", who); |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1613 | |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1614 | 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
|
1615 | } |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
25242
diff
changeset
|
1616 | |
|
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
|
1617 | void jabber_add_feature(const char *shortname, const char *namespace, JabberFeatureEnabled cb) { |
|
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
|
1618 | 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
|
1619 | |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1620 | g_return_if_fail(shortname != NULL); |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1621 | 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
|
1622 | |
|
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
|
1623 | 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
|
1624 | feat->shortname = g_strdup(shortname); |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1625 | 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
|
1626 | 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
|
1627 | |
|
17779
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1628 | /* try to remove just in case it already exists in the list */ |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1629 | jabber_remove_feature(shortname); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
1630 | |
|
17779
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1631 | 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
|
1632 | } |
|
e67998927a3c
Added the ability to define extensions to caps
Andreas Monitzer <am@adiumx.com>
parents:
17769
diff
changeset
|
1633 | |
|
17773
6956b763b3d1
Implemented adding callbacks for PEP events. Moved the feature list to be application-global instead of per-connection (makes more sense).
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
1634 | void jabber_remove_feature(const char *shortname) { |
|
17779
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1635 | GList *feature; |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1636 | 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
|
1637 | JabberFeature *feat = (JabberFeature*)feature->data; |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1638 | if(!strcmp(feat->shortname, shortname)) { |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1639 | g_free(feat->shortname); |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1640 | g_free(feat->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
|
1641 | |
|
17779
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1642 | g_free(feature->data); |
| 21623 | 1643 | 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
|
1644 | break; |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1645 | } |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1646 | } |
|
17770
e67998927a3c
Added the ability to define extensions to caps
Andreas Monitzer <am@adiumx.com>
parents:
17769
diff
changeset
|
1647 | } |
|
e67998927a3c
Added the ability to define extensions to caps
Andreas Monitzer <am@adiumx.com>
parents:
17769
diff
changeset
|
1648 | |
|
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
|
1649 | const char *jabber_list_icon(PurpleAccount *a, PurpleBuddy *b) |
| 2086 | 1650 | { |
| 4687 | 1651 | return "jabber"; |
| 1652 | } | |
| 4916 | 1653 | |
|
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
|
1654 | const char* jabber_list_emblem(PurpleBuddy *b) |
| 4916 | 1655 | { |
| 7014 | 1656 | JabberStream *js; |
|
13486
4ea1a712aaa3
[gaim-migrate @ 15861]
Daniel Atallah <datallah@pidgin.im>
parents:
13385
diff
changeset
|
1657 | JabberBuddy *jb = NULL; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
1658 | PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(b)); |
| 7014 | 1659 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
1660 | if(!gc) |
|
15558
6fb7a0ad8a0b
clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents:
15524
diff
changeset
|
1661 | return NULL; |
|
6fb7a0ad8a0b
clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents:
15524
diff
changeset
|
1662 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
1663 | js = gc->proto_data; |
|
13486
4ea1a712aaa3
[gaim-migrate @ 15861]
Daniel Atallah <datallah@pidgin.im>
parents:
13385
diff
changeset
|
1664 | if(js) |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
1665 | jb = jabber_buddy_find(js, purple_buddy_get_name(b), FALSE); |
| 5135 | 1666 | |
| 15884 | 1667 | if(!PURPLE_BUDDY_IS_ONLINE(b)) { |
| 7014 | 1668 | if(jb && (jb->subscription & JABBER_SUB_PENDING || |
| 1669 | !(jb->subscription & JABBER_SUB_TO))) | |
| 15524 | 1670 | return "not-authorized"; |
| 2086 | 1671 | } |
| 15524 | 1672 | return NULL; |
| 4916 | 1673 | } |
| 2086 | 1674 | |
|
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
|
1675 | char *jabber_status_text(PurpleBuddy *b) |
|
2205
68c42ce8eba6
[gaim-migrate @ 2215]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2170
diff
changeset
|
1676 | { |
| 7014 | 1677 | 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
|
1678 | JabberBuddy *jb = NULL; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
1679 | 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
|
1680 | 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
|
1681 | |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
1682 | if (gc && gc->proto_data) |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
1683 | jb = jabber_buddy_find(gc->proto_data, purple_buddy_get_name(b), FALSE); |
| 5234 | 1684 | |
| 15884 | 1685 | if(jb && !PURPLE_BUDDY_IS_ONLINE(b) && (jb->subscription & JABBER_SUB_PENDING || !(jb->subscription & JABBER_SUB_TO))) { |
| 7014 | 1686 | ret = g_strdup(_("Not Authorized")); |
| 15884 | 1687 | } else if(jb && !PURPLE_BUDDY_IS_ONLINE(b) && jb->error_msg) { |
| 7014 | 1688 | ret = g_strdup(jb->error_msg); |
| 2956 | 1689 | } else { |
|
7095
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7072
diff
changeset
|
1690 | char *stripped; |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7072
diff
changeset
|
1691 | |
| 15884 | 1692 | if(!(stripped = purple_markup_strip_html(jabber_buddy_get_status_msg(jb)))) { |
|
21195
fd63ef5027d7
Music support for Google Talk
Sean Egan <seanegan@pidgin.im>
parents:
21193
diff
changeset
|
1693 | PurplePresence *presence = purple_buddy_get_presence(b); |
|
fd63ef5027d7
Music support for Google Talk
Sean Egan <seanegan@pidgin.im>
parents:
21193
diff
changeset
|
1694 | if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) { |
|
fd63ef5027d7
Music support for Google Talk
Sean Egan <seanegan@pidgin.im>
parents:
21193
diff
changeset
|
1695 | PurpleStatus *status = purple_presence_get_status(presence, "tune"); |
|
fd63ef5027d7
Music support for Google Talk
Sean Egan <seanegan@pidgin.im>
parents:
21193
diff
changeset
|
1696 | stripped = g_strdup(purple_status_get_attr_string(status, PURPLE_TUNE_TITLE)); |
|
fd63ef5027d7
Music support for Google Talk
Sean Egan <seanegan@pidgin.im>
parents:
21193
diff
changeset
|
1697 | } |
| 9954 | 1698 | } |
| 2086 | 1699 | |
| 7014 | 1700 | if(stripped) { |
| 1701 | ret = g_markup_escape_text(stripped, -1); | |
| 1702 | g_free(stripped); | |
| 1703 | } | |
| 2086 | 1704 | } |
| 1705 | ||
| 7014 | 1706 | return ret; |
| 2956 | 1707 | } |
| 1708 | ||
|
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
|
1709 | void jabber_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) |
| 4744 | 1710 | { |
| 11609 | 1711 | JabberBuddy *jb; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
1712 | PurpleAccount *account; |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
1713 | PurpleConnection *gc; |
| 11609 | 1714 | |
|
12970
c2f3b4dcf711
[gaim-migrate @ 15323]
Richard Laager <rlaager@pidgin.im>
parents:
12948
diff
changeset
|
1715 | 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
|
1716 | |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
1717 | account = purple_buddy_get_account(b); |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
1718 | g_return_if_fail(account != NULL); |
| 11609 | 1719 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
1720 | gc = purple_account_get_connection(account); |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
1721 | g_return_if_fail(gc != NULL); |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
1722 | g_return_if_fail(gc->proto_data != NULL); |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
1723 | |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
1724 | jb = jabber_buddy_find(gc->proto_data, purple_buddy_get_name(b), FALSE); |
| 7014 | 1725 | |
| 8194 | 1726 | if(jb) { |
| 11609 | 1727 | JabberBuddyResource *jbr = NULL; |
|
21195
fd63ef5027d7
Music support for Google Talk
Sean Egan <seanegan@pidgin.im>
parents:
21193
diff
changeset
|
1728 | PurplePresence *presence = purple_buddy_get_presence(b); |
| 8194 | 1729 | const char *sub; |
| 11609 | 1730 | GList *l; |
|
19920
7b0d20da73d0
Don't put "Mood: \(null\) \(null\)" on XMPP buddies
Sean Egan <seanegan@pidgin.im>
parents:
19897
diff
changeset
|
1731 | const char *mood; |
| 11609 | 1732 | |
|
12948
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1733 | 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
|
1734 | 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
|
1735 | |
|
12948
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1736 | if(jb->subscription & JABBER_SUB_FROM) { |
|
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1737 | if(jb->subscription & JABBER_SUB_TO) |
|
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1738 | sub = _("Both"); |
|
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1739 | else if(jb->subscription & JABBER_SUB_PENDING) |
|
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1740 | sub = _("From (To pending)"); |
|
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1741 | else |
|
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1742 | sub = _("From"); |
|
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1743 | } else { |
|
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1744 | if(jb->subscription & JABBER_SUB_TO) |
|
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1745 | sub = _("To"); |
|
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1746 | else if(jb->subscription & JABBER_SUB_PENDING) |
|
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1747 | sub = _("None (To pending)"); |
|
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1748 | else |
|
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1749 | sub = _("None"); |
|
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1750 | } |
|
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
|
1751 | |
| 15884 | 1752 | purple_notify_user_info_add_pair(user_info, _("Subscription"), sub); |
|
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
|
1753 | |
|
21195
fd63ef5027d7
Music support for Google Talk
Sean Egan <seanegan@pidgin.im>
parents:
21193
diff
changeset
|
1754 | status = purple_presence_get_active_status(presence); |
|
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
|
1755 | mood = purple_status_get_attr_string(status, "mood"); |
|
b0b23ab674f0
The status type says that mood and moodtext are strings, so we don't
Mark Doliner <markdoliner@pidgin.im>
parents:
23325
diff
changeset
|
1756 | if(mood != NULL) { |
|
b0b23ab674f0
The status type says that mood and moodtext are strings, so we don't
Mark Doliner <markdoliner@pidgin.im>
parents:
23325
diff
changeset
|
1757 | const char *moodtext; |
|
b0b23ab674f0
The status type says that mood and moodtext are strings, so we don't
Mark Doliner <markdoliner@pidgin.im>
parents:
23325
diff
changeset
|
1758 | moodtext = purple_status_get_attr_string(status, "moodtext"); |
|
b0b23ab674f0
The status type says that mood and moodtext are strings, so we don't
Mark Doliner <markdoliner@pidgin.im>
parents:
23325
diff
changeset
|
1759 | if(moodtext != NULL) { |
|
b0b23ab674f0
The status type says that mood and moodtext are strings, so we don't
Mark Doliner <markdoliner@pidgin.im>
parents:
23325
diff
changeset
|
1760 | char *moodplustext = g_strdup_printf("%s (%s)", mood, moodtext); |
|
b0b23ab674f0
The status type says that mood and moodtext are strings, so we don't
Mark Doliner <markdoliner@pidgin.im>
parents:
23325
diff
changeset
|
1761 | |
|
17780
749862fd4a87
Fixed a few small mistakes I discovered while testing user mood in Adium.
Andreas Monitzer <am@adiumx.com>
parents:
17779
diff
changeset
|
1762 | purple_notify_user_info_add_pair(user_info, _("Mood"), moodplustext); |
|
749862fd4a87
Fixed a few small mistakes I discovered while testing user mood in Adium.
Andreas Monitzer <am@adiumx.com>
parents:
17779
diff
changeset
|
1763 | 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
|
1764 | } else |
|
749862fd4a87
Fixed a few small mistakes I discovered while testing user mood in Adium.
Andreas Monitzer <am@adiumx.com>
parents:
17779
diff
changeset
|
1765 | purple_notify_user_info_add_pair(user_info, _("Mood"), mood); |
|
21195
fd63ef5027d7
Music support for Google Talk
Sean Egan <seanegan@pidgin.im>
parents:
21193
diff
changeset
|
1766 | } |
|
22133
6eb22afb9701
Utility functions to set and format song information. Closes #4398.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22111
diff
changeset
|
1767 | 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
|
1768 | PurpleStatus *tune = purple_presence_get_status(presence, "tune"); |
|
fd63ef5027d7
Music support for Google Talk
Sean Egan <seanegan@pidgin.im>
parents:
21193
diff
changeset
|
1769 | 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
|
1770 | 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
|
1771 | 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
|
1772 | 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
|
1773 | if (playing) { |
|
6eb22afb9701
Utility functions to set and format song information. Closes #4398.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22111
diff
changeset
|
1774 | purple_notify_user_info_add_pair(user_info, _("Now Listening"), playing); |
|
6eb22afb9701
Utility functions to set and format song information. Closes #4398.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22111
diff
changeset
|
1775 | g_free(playing); |
|
6eb22afb9701
Utility functions to set and format song information. Closes #4398.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22111
diff
changeset
|
1776 | } |
|
21195
fd63ef5027d7
Music support for Google Talk
Sean Egan <seanegan@pidgin.im>
parents:
21193
diff
changeset
|
1777 | } |
| 8194 | 1778 | } |
| 1779 | ||
| 11609 | 1780 | for(l=jb->resources; l; l = l->next) { |
| 8194 | 1781 | char *text = NULL; |
| 11609 | 1782 | char *res = NULL; |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15198
diff
changeset
|
1783 | char *label, *value; |
|
12944
da8f60d43d88
[gaim-migrate @ 15297]
Richard Laager <rlaager@pidgin.im>
parents:
12943
diff
changeset
|
1784 | const char *state; |
| 11609 | 1785 | |
| 1786 | jbr = l->data; | |
| 1787 | ||
| 8194 | 1788 | if(jbr->status) { |
| 11646 | 1789 | char *tmp; |
| 15884 | 1790 | text = purple_strreplace(jbr->status, "\n", "<br />\n"); |
| 1791 | tmp = purple_markup_strip_html(text); | |
| 11646 | 1792 | g_free(text); |
| 1793 | text = g_markup_escape_text(tmp, -1); | |
| 1794 | g_free(tmp); | |
| 8194 | 1795 | } |
| 1796 | ||
| 11609 | 1797 | if(jbr->name) |
| 11610 | 1798 | res = g_strdup_printf(" (%s)", jbr->name); |
| 11609 | 1799 | |
|
12944
da8f60d43d88
[gaim-migrate @ 15297]
Richard Laager <rlaager@pidgin.im>
parents:
12943
diff
changeset
|
1800 | state = jabber_buddy_state_get_name(jbr->state); |
| 15884 | 1801 | if (text != NULL && !purple_utf8_strcasecmp(state, text)) { |
|
12944
da8f60d43d88
[gaim-migrate @ 15297]
Richard Laager <rlaager@pidgin.im>
parents:
12943
diff
changeset
|
1802 | g_free(text); |
|
da8f60d43d88
[gaim-migrate @ 15297]
Richard Laager <rlaager@pidgin.im>
parents:
12943
diff
changeset
|
1803 | text = NULL; |
|
da8f60d43d88
[gaim-migrate @ 15297]
Richard Laager <rlaager@pidgin.im>
parents:
12943
diff
changeset
|
1804 | } |
|
da8f60d43d88
[gaim-migrate @ 15297]
Richard Laager <rlaager@pidgin.im>
parents:
12943
diff
changeset
|
1805 | |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15198
diff
changeset
|
1806 | label = g_strdup_printf("%s%s", |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15198
diff
changeset
|
1807 | _("Status"), (res ? res : "")); |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15198
diff
changeset
|
1808 | value = g_strdup_printf("%s%s%s", |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15198
diff
changeset
|
1809 | state, |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15198
diff
changeset
|
1810 | (text ? ": " : ""), |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15198
diff
changeset
|
1811 | (text ? text : "")); |
|
12944
da8f60d43d88
[gaim-migrate @ 15297]
Richard Laager <rlaager@pidgin.im>
parents:
12943
diff
changeset
|
1812 | |
| 15884 | 1813 | purple_notify_user_info_add_pair(user_info, label, value); |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15198
diff
changeset
|
1814 | |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15198
diff
changeset
|
1815 | g_free(label); |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15198
diff
changeset
|
1816 | g_free(value); |
|
12944
da8f60d43d88
[gaim-migrate @ 15297]
Richard Laager <rlaager@pidgin.im>
parents:
12943
diff
changeset
|
1817 | g_free(text); |
|
da8f60d43d88
[gaim-migrate @ 15297]
Richard Laager <rlaager@pidgin.im>
parents:
12943
diff
changeset
|
1818 | g_free(res); |
| 11609 | 1819 | } |
| 1820 | ||
| 15884 | 1821 | if(!PURPLE_BUDDY_IS_ONLINE(b) && jb->error_msg) { |
| 1822 | purple_notify_user_info_add_pair(user_info, _("Error"), jb->error_msg); | |
| 8194 | 1823 | } |
| 4745 | 1824 | } |
| 4732 | 1825 | } |
| 1826 | ||
|
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
|
1827 | GList *jabber_status_types(PurpleAccount *account) |
| 7014 | 1828 | { |
| 15884 | 1829 | PurpleStatusType *type; |
| 9954 | 1830 | GList *types = NULL; |
| 15884 | 1831 | PurpleValue *priority_value; |
|
24396
7f2eddefcbf3
Updated support for XEP-0224.
Marcus Lundblad <malu@pidgin.im>
parents:
24254
diff
changeset
|
1832 | PurpleValue *buzz_enabled; |
| 9954 | 1833 | |
| 15884 | 1834 | priority_value = purple_value_new(PURPLE_TYPE_INT); |
| 1835 | purple_value_set_int(priority_value, 1); | |
|
24396
7f2eddefcbf3
Updated support for XEP-0224.
Marcus Lundblad <malu@pidgin.im>
parents:
24254
diff
changeset
|
1836 | buzz_enabled = purple_value_new(PURPLE_TYPE_BOOLEAN); |
|
7f2eddefcbf3
Updated support for XEP-0224.
Marcus Lundblad <malu@pidgin.im>
parents:
24254
diff
changeset
|
1837 | purple_value_set_boolean(buzz_enabled, TRUE); |
| 15884 | 1838 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1839 | jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_ONLINE), |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1840 | NULL, TRUE, TRUE, FALSE, |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1841 | "priority", _("Priority"), priority_value, |
| 15884 | 1842 | "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), |
|
17779
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1843 | "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1844 | "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), |
|
17803
882abe4d932e
Implemented XEP-0172: User Nickname, fixed some potential crashers in the other PEP callbacks.
Andreas Monitzer <am@adiumx.com>
parents:
17800
diff
changeset
|
1845 | "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), |
|
24396
7f2eddefcbf3
Updated support for XEP-0224.
Marcus Lundblad <malu@pidgin.im>
parents:
24254
diff
changeset
|
1846 | "buzz", _("Allow Buzz"), buzz_enabled, |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1847 | NULL); |
| 9980 | 1848 | types = g_list_append(types, type); |
| 1849 | ||
| 15884 | 1850 | priority_value = purple_value_new(PURPLE_TYPE_INT); |
| 1851 | purple_value_set_int(priority_value, 1); | |
|
25956
71e85c4df8ed
Patch from Darkrain42 to avoid a double-free on status values
Marcus Lundblad <malu@pidgin.im>
parents:
25954
diff
changeset
|
1852 | buzz_enabled = purple_value_new(PURPLE_TYPE_BOOLEAN); |
|
71e85c4df8ed
Patch from Darkrain42 to avoid a double-free on status values
Marcus Lundblad <malu@pidgin.im>
parents:
25954
diff
changeset
|
1853 | purple_value_set_boolean(buzz_enabled, TRUE); |
| 15884 | 1854 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1855 | jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_CHAT), |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1856 | _("Chatty"), TRUE, TRUE, FALSE, |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1857 | "priority", _("Priority"), priority_value, |
| 15884 | 1858 | "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), |
|
17779
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1859 | "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1860 | "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), |
|
17803
882abe4d932e
Implemented XEP-0172: User Nickname, fixed some potential crashers in the other PEP callbacks.
Andreas Monitzer <am@adiumx.com>
parents:
17800
diff
changeset
|
1861 | "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), |
|
24396
7f2eddefcbf3
Updated support for XEP-0224.
Marcus Lundblad <malu@pidgin.im>
parents:
24254
diff
changeset
|
1862 | "buzz", _("Allow Buzz"), buzz_enabled, |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1863 | NULL); |
| 9954 | 1864 | types = g_list_append(types, type); |
| 2086 | 1865 | |
| 15884 | 1866 | priority_value = purple_value_new(PURPLE_TYPE_INT); |
| 1867 | purple_value_set_int(priority_value, 0); | |
|
25956
71e85c4df8ed
Patch from Darkrain42 to avoid a double-free on status values
Marcus Lundblad <malu@pidgin.im>
parents:
25954
diff
changeset
|
1868 | buzz_enabled = purple_value_new(PURPLE_TYPE_BOOLEAN); |
|
71e85c4df8ed
Patch from Darkrain42 to avoid a double-free on status values
Marcus Lundblad <malu@pidgin.im>
parents:
25954
diff
changeset
|
1869 | purple_value_set_boolean(buzz_enabled, TRUE); |
| 15884 | 1870 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1871 | jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_AWAY), |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1872 | NULL, TRUE, TRUE, FALSE, |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1873 | "priority", _("Priority"), priority_value, |
| 15884 | 1874 | "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), |
|
17779
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1875 | "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1876 | "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), |
|
17803
882abe4d932e
Implemented XEP-0172: User Nickname, fixed some potential crashers in the other PEP callbacks.
Andreas Monitzer <am@adiumx.com>
parents:
17800
diff
changeset
|
1877 | "nick", _("Nickname"), purple_value_new(PURPLE_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
|
1878 | "buzz", _("Allow Buzz"), buzz_enabled, |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1879 | NULL); |
| 9954 | 1880 | types = g_list_append(types, type); |
| 1881 | ||
| 15884 | 1882 | priority_value = purple_value_new(PURPLE_TYPE_INT); |
| 1883 | purple_value_set_int(priority_value, 0); | |
|
25956
71e85c4df8ed
Patch from Darkrain42 to avoid a double-free on status values
Marcus Lundblad <malu@pidgin.im>
parents:
25954
diff
changeset
|
1884 | buzz_enabled = purple_value_new(PURPLE_TYPE_BOOLEAN); |
|
71e85c4df8ed
Patch from Darkrain42 to avoid a double-free on status values
Marcus Lundblad <malu@pidgin.im>
parents:
25954
diff
changeset
|
1885 | purple_value_set_boolean(buzz_enabled, TRUE); |
| 15884 | 1886 | 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
|
1887 | jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_XA), |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1888 | NULL, TRUE, TRUE, FALSE, |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1889 | "priority", _("Priority"), priority_value, |
| 15884 | 1890 | "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), |
|
17779
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1891 | "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1892 | "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), |
|
17803
882abe4d932e
Implemented XEP-0172: User Nickname, fixed some potential crashers in the other PEP callbacks.
Andreas Monitzer <am@adiumx.com>
parents:
17800
diff
changeset
|
1893 | "nick", _("Nickname"), purple_value_new(PURPLE_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
|
1894 | "buzz", _("Allow Buzz"), buzz_enabled, |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1895 | NULL); |
| 9954 | 1896 | types = g_list_append(types, type); |
| 1897 | ||
| 15884 | 1898 | priority_value = purple_value_new(PURPLE_TYPE_INT); |
| 1899 | purple_value_set_int(priority_value, 0); | |
| 1900 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_UNAVAILABLE, | |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1901 | jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_DND), |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1902 | _("Do Not Disturb"), TRUE, TRUE, FALSE, |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1903 | "priority", _("Priority"), priority_value, |
| 15884 | 1904 | "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), |
|
17779
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1905 | "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1906 | "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), |
|
17803
882abe4d932e
Implemented XEP-0172: User Nickname, fixed some potential crashers in the other PEP callbacks.
Andreas Monitzer <am@adiumx.com>
parents:
17800
diff
changeset
|
1907 | "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1908 | NULL); |
| 9954 | 1909 | types = g_list_append(types, type); |
| 1910 | ||
| 1911 | /* | |
| 8166 | 1912 | if(js->protocol_version == JABBER_PROTO_0_9) |
| 1913 | m = g_list_append(m, _("Invisible")); | |
|
10009
8a4fcc043f47
[gaim-migrate @ 10926]
Mark Doliner <markdoliner@pidgin.im>
parents:
9980
diff
changeset
|
1914 | */ |
| 2086 | 1915 | |
| 15884 | 1916 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_OFFLINE, |
|
12658
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12646
diff
changeset
|
1917 | 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
|
1918 | NULL, TRUE, TRUE, FALSE, |
| 15884 | 1919 | "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), |
|
12658
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12646
diff
changeset
|
1920 | NULL); |
|
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12646
diff
changeset
|
1921 | types = g_list_append(types, type); |
|
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12646
diff
changeset
|
1922 | |
|
21193
e918a1846d03
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20332
diff
changeset
|
1923 | 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
|
1924 | "tune", NULL, FALSE, TRUE, TRUE, |
|
21193
e918a1846d03
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20332
diff
changeset
|
1925 | PURPLE_TUNE_ARTIST, _("Tune Artist"), purple_value_new(PURPLE_TYPE_STRING), |
|
e918a1846d03
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20332
diff
changeset
|
1926 | PURPLE_TUNE_TITLE, _("Tune Title"), purple_value_new(PURPLE_TYPE_STRING), |
|
e918a1846d03
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20332
diff
changeset
|
1927 | PURPLE_TUNE_ALBUM, _("Tune Album"), purple_value_new(PURPLE_TYPE_STRING), |
|
e918a1846d03
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20332
diff
changeset
|
1928 | PURPLE_TUNE_GENRE, _("Tune Genre"), purple_value_new(PURPLE_TYPE_STRING), |
|
e918a1846d03
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20332
diff
changeset
|
1929 | PURPLE_TUNE_COMMENT, _("Tune Comment"), purple_value_new(PURPLE_TYPE_STRING), |
|
e918a1846d03
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20332
diff
changeset
|
1930 | PURPLE_TUNE_TRACK, _("Tune Track"), purple_value_new(PURPLE_TYPE_STRING), |
|
e918a1846d03
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20332
diff
changeset
|
1931 | PURPLE_TUNE_TIME, _("Tune Time"), purple_value_new(PURPLE_TYPE_INT), |
|
e918a1846d03
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20332
diff
changeset
|
1932 | PURPLE_TUNE_YEAR, _("Tune Year"), purple_value_new(PURPLE_TYPE_INT), |
|
e918a1846d03
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20332
diff
changeset
|
1933 | PURPLE_TUNE_URL, _("Tune URL"), purple_value_new(PURPLE_TYPE_STRING), |
|
e918a1846d03
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20332
diff
changeset
|
1934 | NULL); |
|
e918a1846d03
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20332
diff
changeset
|
1935 | types = g_list_append(types, type); |
|
e918a1846d03
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20332
diff
changeset
|
1936 | |
| 9954 | 1937 | return types; |
| 2086 | 1938 | } |
| 1939 | ||
| 7395 | 1940 | static void |
| 1941 | jabber_password_change_result_cb(JabberStream *js, xmlnode *packet, | |
| 1942 | gpointer data) | |
| 7124 | 1943 | { |
| 1944 | const char *type; | |
| 1945 | ||
| 1946 | type = xmlnode_get_attrib(packet, "type"); | |
| 1947 | ||
| 9414 | 1948 | if(type && !strcmp(type, "result")) { |
| 15884 | 1949 | purple_notify_info(js->gc, _("Password Changed"), _("Password Changed"), |
| 7124 | 1950 | _("Your password has been changed.")); |
|
21129
91280f050201
This patch prevents changing the saved account password for XMPP accounts
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21076
diff
changeset
|
1951 | |
|
91280f050201
This patch prevents changing the saved account password for XMPP accounts
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21076
diff
changeset
|
1952 | purple_account_set_password(js->gc->account, (char *)data); |
| 7124 | 1953 | } else { |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
1954 | char *msg = jabber_parse_error(js, packet, NULL); |
| 7124 | 1955 | |
| 15884 | 1956 | purple_notify_error(js->gc, _("Error changing password"), |
| 8401 | 1957 | _("Error changing password"), msg); |
| 1958 | g_free(msg); | |
| 7124 | 1959 | } |
|
21129
91280f050201
This patch prevents changing the saved account password for XMPP accounts
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21076
diff
changeset
|
1960 | |
|
91280f050201
This patch prevents changing the saved account password for XMPP accounts
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21076
diff
changeset
|
1961 | g_free(data); |
| 7124 | 1962 | } |
| 1963 | ||
| 1964 | static void jabber_password_change_cb(JabberStream *js, | |
| 15884 | 1965 | PurpleRequestFields *fields) |
| 7124 | 1966 | { |
| 1967 | const char *p1, *p2; | |
| 1968 | JabberIq *iq; | |
| 1969 | xmlnode *query, *y; | |
| 1970 | ||
| 15884 | 1971 | p1 = purple_request_fields_get_string(fields, "password1"); |
| 1972 | p2 = purple_request_fields_get_string(fields, "password2"); | |
| 7124 | 1973 | |
| 1974 | if(strcmp(p1, p2)) { | |
| 15884 | 1975 | purple_notify_error(js->gc, NULL, _("New passwords do not match."), NULL); |
| 7124 | 1976 | return; |
| 1977 | } | |
| 1978 | ||
| 1979 | iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register"); | |
| 1980 | ||
| 1981 | xmlnode_set_attrib(iq->node, "to", js->user->domain); | |
| 1982 | ||
| 1983 | query = xmlnode_get_child(iq->node, "query"); | |
| 1984 | ||
| 1985 | y = xmlnode_new_child(query, "username"); | |
| 1986 | xmlnode_insert_data(y, js->user->node, -1); | |
| 1987 | y = xmlnode_new_child(query, "password"); | |
| 1988 | xmlnode_insert_data(y, p1, -1); | |
| 1989 | ||
|
21129
91280f050201
This patch prevents changing the saved account password for XMPP accounts
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21076
diff
changeset
|
1990 | jabber_iq_set_callback(iq, jabber_password_change_result_cb, g_strdup(p1)); |
| 7124 | 1991 | |
| 1992 | jabber_iq_send(iq); | |
| 1993 | } | |
| 1994 | ||
| 15884 | 1995 | static void jabber_password_change(PurplePluginAction *action) |
| 7124 | 1996 | { |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
1997 | |
| 15884 | 1998 | PurpleConnection *gc = (PurpleConnection *) action->context; |
| 7124 | 1999 | JabberStream *js = gc->proto_data; |
| 15884 | 2000 | PurpleRequestFields *fields; |
| 2001 | PurpleRequestFieldGroup *group; | |
| 2002 | PurpleRequestField *field; | |
| 7124 | 2003 | |
| 15884 | 2004 | fields = purple_request_fields_new(); |
| 2005 | group = purple_request_field_group_new(NULL); | |
| 2006 | purple_request_fields_add_group(fields, group); | |
| 7124 | 2007 | |
| 15884 | 2008 | field = purple_request_field_string_new("password1", _("Password"), |
| 7124 | 2009 | "", FALSE); |
| 15884 | 2010 | 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
|
2011 | purple_request_field_set_required(field, TRUE); |
| 15884 | 2012 | purple_request_field_group_add_field(group, field); |
| 7124 | 2013 | |
| 15884 | 2014 | field = purple_request_field_string_new("password2", _("Password (again)"), |
| 7124 | 2015 | "", FALSE); |
| 15884 | 2016 | 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
|
2017 | purple_request_field_set_required(field, TRUE); |
| 15884 | 2018 | purple_request_field_group_add_field(group, field); |
| 7124 | 2019 | |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
2020 | 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
|
2021 | _("Change XMPP Password"), _("Please enter your new password"), |
| 7124 | 2022 | 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
|
2023 | _("Cancel"), NULL, |
|
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
|
2024 | purple_connection_get_account(gc), NULL, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
2025 | js); |
| 7124 | 2026 | } |
| 2027 | ||
|
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
|
2028 | GList *jabber_actions(PurplePlugin *plugin, gpointer context) |
| 2956 | 2029 | { |
|
17782
83af68644d0a
Implemented a mood menu action (non-functional right now for some reason)
Andreas Monitzer <am@adiumx.com>
parents:
17780
diff
changeset
|
2030 | PurpleConnection *gc = (PurpleConnection *) context; |
|
83af68644d0a
Implemented a mood menu action (non-functional right now for some reason)
Andreas Monitzer <am@adiumx.com>
parents:
17780
diff
changeset
|
2031 | JabberStream *js = gc->proto_data; |
| 2956 | 2032 | GList *m = NULL; |
| 15884 | 2033 | PurplePluginAction *act; |
|
4333
f4c095774bc2
[gaim-migrate @ 4597]
Mark Doliner <markdoliner@pidgin.im>
parents:
4316
diff
changeset
|
2034 | |
| 15884 | 2035 | act = purple_plugin_action_new(_("Set User Info..."), |
| 12286 | 2036 | jabber_setup_set_info); |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
2037 | m = g_list_append(m, act); |
|
4333
f4c095774bc2
[gaim-migrate @ 4597]
Mark Doliner <markdoliner@pidgin.im>
parents:
4316
diff
changeset
|
2038 | |
| 8296 | 2039 | /* if (js->protocol_options & CHANGE_PASSWORD) { */ |
| 15884 | 2040 | act = purple_plugin_action_new(_("Change Password..."), |
| 12286 | 2041 | jabber_password_change); |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
2042 | m = g_list_append(m, act); |
| 8296 | 2043 | /* } */ |
| 2956 | 2044 | |
| 15884 | 2045 | act = purple_plugin_action_new(_("Search for Users..."), |
| 12286 | 2046 | jabber_user_search_begin); |
| 11675 | 2047 | m = g_list_append(m, act); |
| 2048 | ||
|
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
|
2049 | purple_debug_info("jabber", "jabber_actions: have pep: %s\n", js->pep?"YES":"NO"); |
|
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
|
2050 | |
|
17782
83af68644d0a
Implemented a mood menu action (non-functional right now for some reason)
Andreas Monitzer <am@adiumx.com>
parents:
17780
diff
changeset
|
2051 | 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
|
2052 | 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
|
2053 | |
|
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
|
2054 | 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
|
2055 | jabber_adhoc_init_server_commands(js, &m); |
| 11675 | 2056 | |
| 2956 | 2057 | return m; |
| 2058 | } | |
| 2059 | ||
|
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
|
2060 | PurpleChat *jabber_find_blist_chat(PurpleAccount *account, const char *name) |
| 7999 | 2061 | { |
| 15884 | 2062 | PurpleBlistNode *gnode, *cnode; |
| 7999 | 2063 | JabberID *jid; |
| 2064 | ||
| 2065 | if(!(jid = jabber_id_new(name))) | |
| 2066 | return NULL; | |
| 2067 | ||
|
24945
6678a8c83797
Some more struct hiding.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24571
diff
changeset
|
2068 | for(gnode = purple_blist_get_root(); gnode; |
|
6678a8c83797
Some more struct hiding.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24571
diff
changeset
|
2069 | gnode = purple_blist_node_get_sibling_next(gnode)) { |
|
6678a8c83797
Some more struct hiding.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24571
diff
changeset
|
2070 | for(cnode = purple_blist_node_get_first_child(gnode); |
|
6678a8c83797
Some more struct hiding.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24571
diff
changeset
|
2071 | cnode; |
|
6678a8c83797
Some more struct hiding.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24571
diff
changeset
|
2072 | cnode = purple_blist_node_get_sibling_next(cnode)) { |
| 15884 | 2073 | PurpleChat *chat = (PurpleChat*)cnode; |
| 7999 | 2074 | const char *room, *server; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
2075 | GHashTable *components; |
| 15884 | 2076 | if(!PURPLE_BLIST_NODE_IS_CHAT(cnode)) |
| 7999 | 2077 | continue; |
| 2078 | ||
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
2079 | if (purple_chat_get_account(chat) != account) |
| 8011 | 2080 | continue; |
| 7999 | 2081 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
2082 | components = purple_chat_get_components(chat); |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
2083 | if(!(room = g_hash_table_lookup(components, "room"))) |
| 7999 | 2084 | continue; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24254
diff
changeset
|
2085 | if(!(server = g_hash_table_lookup(components, "server"))) |
| 7999 | 2086 | continue; |
| 2087 | ||
| 8158 | 2088 | if(jid->node && jid->domain && |
| 2089 | !g_utf8_collate(room, jid->node) && !g_utf8_collate(server, jid->domain)) { | |
| 7999 | 2090 | jabber_id_free(jid); |
| 2091 | return chat; | |
| 2092 | } | |
| 2093 | } | |
| 2094 | } | |
| 2095 | jabber_id_free(jid); | |
| 2096 | return NULL; | |
| 2097 | } | |
| 2098 | ||
|
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
|
2099 | void jabber_convo_closed(PurpleConnection *gc, const char *who) |
| 8400 | 2100 | { |
| 2101 | JabberStream *js = gc->proto_data; | |
| 2102 | JabberID *jid; | |
| 2103 | JabberBuddy *jb; | |
| 2104 | JabberBuddyResource *jbr; | |
| 2105 | ||
| 2106 | if(!(jid = jabber_id_new(who))) | |
| 2107 | return; | |
| 2108 | ||
| 2109 | if((jb = jabber_buddy_find(js, who, TRUE)) && | |
| 2110 | (jbr = jabber_buddy_find_resource(jb, jid->resource))) { | |
| 2111 | if(jbr->thread_id) { | |
| 2112 | g_free(jbr->thread_id); | |
| 2113 | jbr->thread_id = NULL; | |
| 2114 | } | |
|
15709
b58646e3ce63
Sending XEP 85 'gone' messages
Sean Egan <seanegan@pidgin.im>
parents:
15668
diff
changeset
|
2115 | if(jbr->chat_states == JABBER_CHAT_STATES_SUPPORTED) |
|
b58646e3ce63
Sending XEP 85 'gone' messages
Sean Egan <seanegan@pidgin.im>
parents:
15668
diff
changeset
|
2116 | jabber_message_conv_closed(js, who); |
| 8400 | 2117 | } |
| 2118 | ||
| 2119 | jabber_id_free(jid); | |
| 2120 | } | |
| 2121 | ||
| 8401 | 2122 | |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
2123 | char *jabber_parse_error(JabberStream *js, |
|
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
2124 | xmlnode *packet, |
| 21279 | 2125 | PurpleConnectionError *reason) |
| 8401 | 2126 | { |
| 2127 | xmlnode *error; | |
| 2128 | const char *code = NULL, *text = NULL; | |
| 13808 | 2129 | const char *xmlns = xmlnode_get_namespace(packet); |
| 8401 | 2130 | char *cdata = NULL; |
| 2131 | ||
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
2132 | #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
|
2133 | 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
|
2134 | |
| 8401 | 2135 | if((error = xmlnode_get_child(packet, "error"))) { |
| 2136 | cdata = xmlnode_get_data(error); | |
| 2137 | code = xmlnode_get_attrib(error, "code"); | |
| 2138 | ||
| 2139 | /* Stanza errors */ | |
| 2140 | if(xmlnode_get_child(error, "bad-request")) { | |
| 2141 | text = _("Bad Request"); | |
| 2142 | } else if(xmlnode_get_child(error, "conflict")) { | |
| 2143 | text = _("Conflict"); | |
| 2144 | } else if(xmlnode_get_child(error, "feature-not-implemented")) { | |
| 2145 | text = _("Feature Not Implemented"); | |
| 2146 | } else if(xmlnode_get_child(error, "forbidden")) { | |
| 2147 | text = _("Forbidden"); | |
| 2148 | } else if(xmlnode_get_child(error, "gone")) { | |
| 2149 | text = _("Gone"); | |
| 2150 | } else if(xmlnode_get_child(error, "internal-server-error")) { | |
| 2151 | text = _("Internal Server Error"); | |
| 2152 | } else if(xmlnode_get_child(error, "item-not-found")) { | |
| 2153 | text = _("Item Not Found"); | |
| 2154 | } else if(xmlnode_get_child(error, "jid-malformed")) { | |
|
16961
b6955f946f8f
s/Jabber/XMPP in user-visible places.
Richard Laager <rlaager@pidgin.im>
parents:
16847
diff
changeset
|
2155 | text = _("Malformed XMPP ID"); |
| 8401 | 2156 | } else if(xmlnode_get_child(error, "not-acceptable")) { |
| 2157 | text = _("Not Acceptable"); | |
| 2158 | } else if(xmlnode_get_child(error, "not-allowed")) { | |
| 2159 | text = _("Not Allowed"); | |
| 2160 | } else if(xmlnode_get_child(error, "not-authorized")) { | |
| 2161 | text = _("Not Authorized"); | |
| 2162 | } else if(xmlnode_get_child(error, "payment-required")) { | |
| 2163 | text = _("Payment Required"); | |
| 2164 | } else if(xmlnode_get_child(error, "recipient-unavailable")) { | |
| 2165 | text = _("Recipient Unavailable"); | |
| 2166 | } else if(xmlnode_get_child(error, "redirect")) { | |
| 2167 | /* XXX */ | |
| 2168 | } else if(xmlnode_get_child(error, "registration-required")) { | |
| 2169 | text = _("Registration Required"); | |
| 2170 | } else if(xmlnode_get_child(error, "remote-server-not-found")) { | |
| 2171 | text = _("Remote Server Not Found"); | |
| 2172 | } else if(xmlnode_get_child(error, "remote-server-timeout")) { | |
| 2173 | text = _("Remote Server Timeout"); | |
| 2174 | } else if(xmlnode_get_child(error, "resource-constraint")) { | |
| 2175 | text = _("Server Overloaded"); | |
| 2176 | } else if(xmlnode_get_child(error, "service-unavailable")) { | |
| 2177 | text = _("Service Unavailable"); | |
| 2178 | } else if(xmlnode_get_child(error, "subscription-required")) { | |
| 2179 | text = _("Subscription Required"); | |
| 2180 | } else if(xmlnode_get_child(error, "unexpected-request")) { | |
| 2181 | text = _("Unexpected Request"); | |
| 2182 | } else if(xmlnode_get_child(error, "undefined-condition")) { | |
| 2183 | text = _("Unknown Error"); | |
| 2184 | } | |
| 2185 | } else if(xmlns && !strcmp(xmlns, "urn:ietf:params:xml: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
|
2186 | /* 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
|
2187 | SET_REASON(PURPLE_CONNECTION_ERROR_NETWORK_ERROR); |
| 8401 | 2188 | if(xmlnode_get_child(packet, "aborted")) { |
| 2189 | text = _("Authorization Aborted"); | |
| 13806 | 2190 | } else if(xmlnode_get_child(packet, "incorrect-encoding")) { |
| 8401 | 2191 | text = _("Incorrect encoding in authorization"); |
| 13806 | 2192 | } else if(xmlnode_get_child(packet, "invalid-authzid")) { |
| 8401 | 2193 | text = _("Invalid authzid"); |
| 13806 | 2194 | } else if(xmlnode_get_child(packet, "invalid-mechanism")) { |
| 8401 | 2195 | text = _("Invalid Authorization Mechanism"); |
| 13806 | 2196 | } else if(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
|
2197 | SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE); |
| 8401 | 2198 | text = _("Authorization mechanism too weak"); |
| 13806 | 2199 | } else if(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
|
2200 | 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
|
2201 | /* Clear the pasword if it isn't being saved */ |
|
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
|
2202 | if (!purple_account_get_remember_password(js->gc->account)) |
|
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
|
2203 | purple_account_set_password(js->gc->account, NULL); |
| 8401 | 2204 | text = _("Not Authorized"); |
| 13806 | 2205 | } else if(xmlnode_get_child(packet, "temporary-auth-failure")) { |
| 8401 | 2206 | text = _("Temporary Authentication Failure"); |
| 2207 | } else { | |
|
21284
69472e4a5458
Having read the XMPP SASL specification, these errors seem more accurate.
Will Thompson <resiak@pidgin.im>
parents:
21281
diff
changeset
|
2208 | SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED); |
| 8401 | 2209 | text = _("Authentication Failure"); |
| 2210 | } | |
|
15979
acfbd09bc217
Correctly handle the Jabber disconnection error for signing onto the
Mark Doliner <markdoliner@pidgin.im>
parents:
15977
diff
changeset
|
2211 | } else if(!strcmp(packet->name, "stream:error") || |
|
20929
8e72c1d47fbd
Make sure that the xmlns isn't null before dereferencing it to fix CID 320.
Daniel Atallah <datallah@pidgin.im>
parents:
20404
diff
changeset
|
2212 | (!strcmp(packet->name, "error") && xmlns && |
| 15980 | 2213 | !strcmp(xmlns, "http://etherx.jabber.org/streams"))) { |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
2214 | /* Most common reason as default: */ |
| 21279 | 2215 | SET_REASON(PURPLE_CONNECTION_ERROR_NETWORK_ERROR); |
| 8402 | 2216 | if(xmlnode_get_child(packet, "bad-format")) { |
| 2217 | text = _("Bad Format"); | |
| 2218 | } else if(xmlnode_get_child(packet, "bad-namespace-prefix")) { | |
| 2219 | text = _("Bad Namespace Prefix"); | |
| 2220 | } else if(xmlnode_get_child(packet, "conflict")) { | |
| 21279 | 2221 | SET_REASON(PURPLE_CONNECTION_ERROR_NAME_IN_USE); |
| 8402 | 2222 | text = _("Resource Conflict"); |
| 2223 | } else if(xmlnode_get_child(packet, "connection-timeout")) { | |
| 2224 | text = _("Connection Timeout"); | |
| 2225 | } else if(xmlnode_get_child(packet, "host-gone")) { | |
| 2226 | text = _("Host Gone"); | |
| 2227 | } else if(xmlnode_get_child(packet, "host-unknown")) { | |
| 2228 | text = _("Host Unknown"); | |
| 2229 | } else if(xmlnode_get_child(packet, "improper-addressing")) { | |
| 2230 | text = _("Improper Addressing"); | |
| 2231 | } else if(xmlnode_get_child(packet, "internal-server-error")) { | |
| 2232 | text = _("Internal Server Error"); | |
| 2233 | } else if(xmlnode_get_child(packet, "invalid-id")) { | |
| 2234 | text = _("Invalid ID"); | |
| 2235 | } else if(xmlnode_get_child(packet, "invalid-namespace")) { | |
| 2236 | text = _("Invalid Namespace"); | |
| 2237 | } else if(xmlnode_get_child(packet, "invalid-xml")) { | |
| 2238 | text = _("Invalid XML"); | |
| 2239 | } else if(xmlnode_get_child(packet, "nonmatching-hosts")) { | |
| 2240 | text = _("Non-matching Hosts"); | |
| 2241 | } else if(xmlnode_get_child(packet, "not-authorized")) { | |
| 2242 | text = _("Not Authorized"); | |
| 2243 | } else if(xmlnode_get_child(packet, "policy-violation")) { | |
| 2244 | text = _("Policy Violation"); | |
| 2245 | } else if(xmlnode_get_child(packet, "remote-connection-failed")) { | |
| 2246 | text = _("Remote Connection Failed"); | |
| 2247 | } else if(xmlnode_get_child(packet, "resource-constraint")) { | |
| 2248 | text = _("Resource Constraint"); | |
| 2249 | } else if(xmlnode_get_child(packet, "restricted-xml")) { | |
| 2250 | text = _("Restricted XML"); | |
| 2251 | } else if(xmlnode_get_child(packet, "see-other-host")) { | |
| 2252 | text = _("See Other Host"); | |
| 2253 | } else if(xmlnode_get_child(packet, "system-shutdown")) { | |
| 2254 | text = _("System Shutdown"); | |
| 2255 | } else if(xmlnode_get_child(packet, "undefined-condition")) { | |
| 2256 | text = _("Undefined Condition"); | |
| 2257 | } else if(xmlnode_get_child(packet, "unsupported-encoding")) { | |
| 2258 | text = _("Unsupported Encoding"); | |
| 2259 | } else if(xmlnode_get_child(packet, "unsupported-stanza-type")) { | |
| 2260 | text = _("Unsupported Stanza Type"); | |
| 2261 | } else if(xmlnode_get_child(packet, "unsupported-version")) { | |
| 2262 | text = _("Unsupported Version"); | |
| 2263 | } else if(xmlnode_get_child(packet, "xml-not-well-formed")) { | |
| 2264 | text = _("XML Not Well Formed"); | |
| 2265 | } else { | |
| 2266 | text = _("Stream Error"); | |
| 2267 | } | |
| 8401 | 2268 | } |
| 2269 | ||
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
2270 | #undef SET_REASON |
|
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
2271 | |
| 8401 | 2272 | if(text || cdata) { |
| 2273 | char *ret = g_strdup_printf("%s%s%s", code ? code : "", | |
| 2274 | code ? ": " : "", text ? text : cdata); | |
| 2275 | g_free(cdata); | |
| 2276 | return ret; | |
| 2277 | } else { | |
| 2278 | return NULL; | |
| 2279 | } | |
| 2280 | } | |
| 2281 | ||
| 15884 | 2282 | static PurpleCmdRet jabber_cmd_chat_config(PurpleConversation *conv, |
| 9597 | 2283 | const char *cmd, char **args, char **error, void *data) |
| 9130 | 2284 | { |
| 2285 | JabberChat *chat = jabber_chat_find_by_conv(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
|
2286 | |
|
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2287 | 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
|
2288 | 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
|
2289 | |
| 9130 | 2290 | jabber_chat_request_room_configure(chat); |
| 15884 | 2291 | return PURPLE_CMD_RET_OK; |
| 9130 | 2292 | } |
| 2293 | ||
| 15884 | 2294 | static PurpleCmdRet jabber_cmd_chat_register(PurpleConversation *conv, |
| 9597 | 2295 | const char *cmd, char **args, char **error, void *data) |
| 9130 | 2296 | { |
| 2297 | JabberChat *chat = jabber_chat_find_by_conv(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
|
2298 | |
|
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2299 | 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
|
2300 | 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
|
2301 | |
| 9130 | 2302 | jabber_chat_register(chat); |
| 15884 | 2303 | return PURPLE_CMD_RET_OK; |
| 9130 | 2304 | } |
| 2305 | ||
| 15884 | 2306 | static PurpleCmdRet jabber_cmd_chat_topic(PurpleConversation *conv, |
| 9597 | 2307 | const char *cmd, char **args, char **error, void *data) |
| 9130 | 2308 | { |
| 2309 | JabberChat *chat = jabber_chat_find_by_conv(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
|
2310 | |
|
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2311 | 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
|
2312 | 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
|
2313 | |
| 9130 | 2314 | jabber_chat_change_topic(chat, args ? args[0] : NULL); |
| 15884 | 2315 | return PURPLE_CMD_RET_OK; |
| 9130 | 2316 | } |
| 2317 | ||
| 15884 | 2318 | static PurpleCmdRet jabber_cmd_chat_nick(PurpleConversation *conv, |
| 9597 | 2319 | const char *cmd, char **args, char **error, void *data) |
| 9130 | 2320 | { |
| 2321 | JabberChat *chat = jabber_chat_find_by_conv(conv); | |
| 2322 | ||
|
18986
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2323 | if(!chat || !args || !args[0]) |
| 15884 | 2324 | return PURPLE_CMD_RET_FAILED; |
| 9130 | 2325 | |
| 2326 | jabber_chat_change_nick(chat, args[0]); | |
| 15884 | 2327 | return PURPLE_CMD_RET_OK; |
| 9130 | 2328 | } |
| 2329 | ||
| 15884 | 2330 | static PurpleCmdRet jabber_cmd_chat_part(PurpleConversation *conv, |
| 9597 | 2331 | const char *cmd, char **args, char **error, void *data) |
| 9130 | 2332 | { |
| 2333 | JabberChat *chat = jabber_chat_find_by_conv(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
|
2334 | |
|
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2335 | 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
|
2336 | 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
|
2337 | |
| 9130 | 2338 | jabber_chat_part(chat, args ? args[0] : NULL); |
| 15884 | 2339 | return PURPLE_CMD_RET_OK; |
| 9130 | 2340 | } |
| 2341 | ||
| 15884 | 2342 | static PurpleCmdRet jabber_cmd_chat_ban(PurpleConversation *conv, |
| 9597 | 2343 | const char *cmd, char **args, char **error, void *data) |
| 9152 | 2344 | { |
| 2345 | JabberChat *chat = jabber_chat_find_by_conv(conv); | |
| 2346 | ||
|
18986
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2347 | if(!chat || !args || !args[0]) |
| 15884 | 2348 | return PURPLE_CMD_RET_FAILED; |
| 9152 | 2349 | |
| 2350 | if(!jabber_chat_ban_user(chat, args[0], args[1])) { | |
| 2351 | *error = g_strdup_printf(_("Unable to ban user %s"), args[0]); | |
| 15884 | 2352 | return PURPLE_CMD_RET_FAILED; |
| 9152 | 2353 | } |
| 2354 | ||
| 15884 | 2355 | return PURPLE_CMD_RET_OK; |
| 9152 | 2356 | } |
| 2357 | ||
| 15884 | 2358 | static PurpleCmdRet jabber_cmd_chat_affiliate(PurpleConversation *conv, |
| 11393 | 2359 | const char *cmd, char **args, char **error, void *data) |
| 2360 | { | |
| 2361 | JabberChat *chat = jabber_chat_find_by_conv(conv); | |
| 2362 | ||
|
18986
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2363 | if (!chat || !args || !args[0] || !args[1]) |
| 15884 | 2364 | return PURPLE_CMD_RET_FAILED; |
| 11393 | 2365 | |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
2366 | if (strcmp(args[1], "owner") != 0 && |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2367 | strcmp(args[1], "admin") != 0 && |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2368 | strcmp(args[1], "member") != 0 && |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2369 | strcmp(args[1], "outcast") != 0 && |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2370 | strcmp(args[1], "none") != 0) { |
| 11393 | 2371 | *error = g_strdup_printf(_("Unknown affiliation: \"%s\""), args[1]); |
| 15884 | 2372 | return PURPLE_CMD_RET_FAILED; |
| 11393 | 2373 | } |
| 2374 | ||
| 2375 | if (!jabber_chat_affiliate_user(chat, args[0], args[1])) { | |
| 2376 | *error = g_strdup_printf(_("Unable to affiliate user %s as \"%s\""), args[0], args[1]); | |
| 15884 | 2377 | return PURPLE_CMD_RET_FAILED; |
| 11393 | 2378 | } |
| 2379 | ||
| 15884 | 2380 | return PURPLE_CMD_RET_OK; |
| 11393 | 2381 | } |
| 2382 | ||
| 15884 | 2383 | static PurpleCmdRet jabber_cmd_chat_role(PurpleConversation *conv, |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2384 | const char *cmd, char **args, char **error, void *data) |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2385 | { |
|
19217
ee1aa7e4c462
Fix uninitialized variable access.
Daniel Atallah <datallah@pidgin.im>
parents:
18986
diff
changeset
|
2386 | JabberChat *chat = jabber_chat_find_by_conv(conv); |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2387 | |
|
18986
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2388 | if (!chat || !args || !args[0] || !args[1]) |
| 15884 | 2389 | return PURPLE_CMD_RET_FAILED; |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2390 | |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2391 | if (strcmp(args[1], "moderator") != 0 && |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2392 | strcmp(args[1], "participant") != 0 && |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2393 | strcmp(args[1], "visitor") != 0 && |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2394 | strcmp(args[1], "none") != 0) { |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2395 | *error = g_strdup_printf(_("Unknown role: \"%s\""), args[1]); |
| 15884 | 2396 | return PURPLE_CMD_RET_FAILED; |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2397 | } |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2398 | |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2399 | if (!jabber_chat_role_user(chat, args[0], args[1])) { |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2400 | *error = g_strdup_printf(_("Unable to set role \"%s\" for user: %s"), |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2401 | args[1], args[0]); |
| 15884 | 2402 | return PURPLE_CMD_RET_FAILED; |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2403 | } |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2404 | |
| 15884 | 2405 | return PURPLE_CMD_RET_OK; |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2406 | } |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2407 | |
| 15884 | 2408 | static PurpleCmdRet jabber_cmd_chat_invite(PurpleConversation *conv, |
| 9597 | 2409 | const char *cmd, char **args, char **error, void *data) |
| 9152 | 2410 | { |
| 2411 | if(!args || !args[0]) | |
| 15884 | 2412 | return PURPLE_CMD_RET_FAILED; |
| 9152 | 2413 | |
| 15884 | 2414 | jabber_chat_invite(purple_conversation_get_gc(conv), |
| 2415 | purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), args[1] ? args[1] : "", | |
| 9152 | 2416 | args[0]); |
| 2417 | ||
| 15884 | 2418 | return PURPLE_CMD_RET_OK; |
| 9152 | 2419 | } |
| 2420 | ||
| 15884 | 2421 | static PurpleCmdRet jabber_cmd_chat_join(PurpleConversation *conv, |
| 9597 | 2422 | const char *cmd, char **args, char **error, void *data) |
| 9152 | 2423 | { |
| 2424 | JabberChat *chat = jabber_chat_find_by_conv(conv); | |
| 2425 | GHashTable *components; | |
| 2426 | ||
|
18986
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2427 | if(!chat || !args || !args[0]) |
| 15884 | 2428 | return PURPLE_CMD_RET_FAILED; |
| 9152 | 2429 | |
| 2430 | components = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); | |
| 2431 | ||
| 2432 | g_hash_table_replace(components, "room", args[0]); | |
| 2433 | g_hash_table_replace(components, "server", chat->server); | |
| 2434 | g_hash_table_replace(components, "handle", chat->handle); | |
| 2435 | if(args[1]) | |
| 2436 | g_hash_table_replace(components, "password", args[1]); | |
| 2437 | ||
| 15884 | 2438 | jabber_chat_join(purple_conversation_get_gc(conv), components); |
| 9152 | 2439 | |
| 2440 | g_hash_table_destroy(components); | |
| 15884 | 2441 | return PURPLE_CMD_RET_OK; |
| 9152 | 2442 | } |
| 2443 | ||
| 15884 | 2444 | static PurpleCmdRet jabber_cmd_chat_kick(PurpleConversation *conv, |
| 9597 | 2445 | const char *cmd, char **args, char **error, void *data) |
| 9152 | 2446 | { |
| 2447 | JabberChat *chat = jabber_chat_find_by_conv(conv); | |
| 2448 | ||
|
18986
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2449 | if(!chat || !args || !args[0]) |
| 15884 | 2450 | return PURPLE_CMD_RET_FAILED; |
| 9152 | 2451 | |
| 2452 | if(!jabber_chat_kick_user(chat, args[0], args[1])) { | |
| 2453 | *error = g_strdup_printf(_("Unable to kick user %s"), args[0]); | |
| 15884 | 2454 | return PURPLE_CMD_RET_FAILED; |
| 9152 | 2455 | } |
| 2456 | ||
| 15884 | 2457 | return PURPLE_CMD_RET_OK; |
| 9152 | 2458 | } |
| 2459 | ||
| 15884 | 2460 | static PurpleCmdRet jabber_cmd_chat_msg(PurpleConversation *conv, |
| 9597 | 2461 | const char *cmd, char **args, char **error, void *data) |
| 9152 | 2462 | { |
| 2463 | JabberChat *chat = jabber_chat_find_by_conv(conv); | |
| 2464 | char *who; | |
| 2465 | ||
|
18986
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2466 | 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
|
2467 | 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
|
2468 | |
| 9152 | 2469 | who = g_strdup_printf("%s@%s/%s", chat->room, chat->server, args[0]); |
| 2470 | ||
| 15884 | 2471 | jabber_message_send_im(purple_conversation_get_gc(conv), who, args[1], 0); |
| 9152 | 2472 | |
| 2473 | g_free(who); | |
| 15884 | 2474 | return PURPLE_CMD_RET_OK; |
| 9152 | 2475 | } |
| 2476 | ||
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
2477 | 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
|
2478 | 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
|
2479 | { |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
2480 | if(!args || !args[0]) |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
2481 | return PURPLE_CMD_RET_FAILED; |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
2482 | |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
2483 | if(!jabber_ping_jid(conv, args[0])) { |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
2484 | *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
|
2485 | return PURPLE_CMD_RET_FAILED; |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
2486 | } |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
2487 | |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
2488 | return PURPLE_CMD_RET_OK; |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
2489 | } |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
2490 | |
|
20930
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2491 | 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
|
2492 | |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2493 | JabberBuddy *jb; |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2494 | 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
|
2495 | 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
|
2496 | PurpleBuddy *buddy = |
|
25975
fcd84c6c9909
Print alias (if known) in some error/info messages when failing to buzz
Marcus Lundblad <malu@pidgin.im>
parents:
25973
diff
changeset
|
2497 | purple_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
|
2498 | 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
|
2499 | 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
|
2500 | |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2501 | if(!username) |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2502 | return FALSE; |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2503 | |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2504 | 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
|
2505 | 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
|
2506 | *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
|
2507 | "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
|
2508 | return FALSE; |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2509 | } |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2510 | |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2511 | 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
|
2512 | 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
|
2513 | *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
|
2514 | alias); |
|
20930
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2515 | return FALSE; |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2516 | } |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2517 | |
|
24428
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
2518 | if (jabber_resource_has_capability(jbr, XEP_0224_NAMESPACE)) { |
|
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
2519 | xmlnode *buzz, *msg = xmlnode_new("message"); |
|
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
2520 | 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
|
2521 | |
|
24428
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
2522 | to = g_strdup_printf("%s/%s", username, jbr->name); |
|
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
2523 | xmlnode_set_attrib(msg, "to", to); |
|
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
2524 | g_free(to); |
|
20930
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2525 | |
|
24428
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
2526 | /* avoid offline storage */ |
|
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
2527 | xmlnode_set_attrib(msg, "type", "headline"); |
|
20930
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2528 | |
|
24428
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
2529 | buzz = xmlnode_new_child(msg, "attention"); |
|
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
2530 | xmlnode_set_namespace(buzz, XEP_0224_NAMESPACE); |
|
20930
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2531 | |
|
24428
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
2532 | jabber_send(js, msg); |
|
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
2533 | xmlnode_free(msg); |
|
20930
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2534 | |
|
24428
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
2535 | 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
|
2536 | } 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
|
2537 | *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
|
2538 | "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
|
2539 | return FALSE; |
|
20930
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2540 | } |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2541 | } |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2542 | |
|
17822
1a183f3fa9d7
disapproval of revision 'd52c12703a8e67c41c7f95a2cae7f16ab426ad76'
Andreas Monitzer <am@adiumx.com>
parents:
17821
diff
changeset
|
2543 | static PurpleCmdRet jabber_cmd_buzz(PurpleConversation *conv, |
|
1a183f3fa9d7
disapproval of revision 'd52c12703a8e67c41c7f95a2cae7f16ab426ad76'
Andreas Monitzer <am@adiumx.com>
parents:
17821
diff
changeset
|
2544 | const char *cmd, char **args, char **error, void *data) |
|
1a183f3fa9d7
disapproval of revision 'd52c12703a8e67c41c7f95a2cae7f16ab426ad76'
Andreas Monitzer <am@adiumx.com>
parents:
17821
diff
changeset
|
2545 | { |
|
1a183f3fa9d7
disapproval of revision 'd52c12703a8e67c41c7f95a2cae7f16ab426ad76'
Andreas Monitzer <am@adiumx.com>
parents:
17821
diff
changeset
|
2546 | JabberStream *js = conv->account->gc->proto_data; |
|
24428
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
2547 | const gchar *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
|
2548 | |
|
24428
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
2549 | 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
|
2550 | /* use the buddy from conversation, if it's a one-to-one conversation */ |
|
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
2551 | if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { |
|
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
2552 | 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
|
2553 | } else { |
|
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
2554 | 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
|
2555 | } |
|
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
2556 | } else { |
|
002e089bfb28
Allow the /buzz command without argument (sends attention to the JID of the
Marcus Lundblad <malu@pidgin.im>
parents:
24397
diff
changeset
|
2557 | 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
|
2558 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
2559 | |
|
25973
ee95dc6c4a55
Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <malu@pidgin.im>
parents:
25972
diff
changeset
|
2560 | if (_jabber_send_buzz(js, who, error)) { |
|
ee95dc6c4a55
Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <malu@pidgin.im>
parents:
25972
diff
changeset
|
2561 | 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
|
2562 | gchar *str; |
|
25973
ee95dc6c4a55
Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <malu@pidgin.im>
parents:
25972
diff
changeset
|
2563 | PurpleBuddy *buddy = |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
2564 | purple_find_buddy(purple_connection_get_account(conv->account->gc), |
|
25973
ee95dc6c4a55
Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <malu@pidgin.im>
parents:
25972
diff
changeset
|
2565 | 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
|
2566 | |
|
25973
ee95dc6c4a55
Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <malu@pidgin.im>
parents:
25972
diff
changeset
|
2567 | if (buddy != NULL) |
|
ee95dc6c4a55
Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <malu@pidgin.im>
parents:
25972
diff
changeset
|
2568 | alias = purple_buddy_get_contact_alias(buddy); |
|
ee95dc6c4a55
Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <malu@pidgin.im>
parents:
25972
diff
changeset
|
2569 | else |
|
ee95dc6c4a55
Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <malu@pidgin.im>
parents:
25972
diff
changeset
|
2570 | alias = 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
|
2571 | |
|
25973
ee95dc6c4a55
Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <malu@pidgin.im>
parents:
25972
diff
changeset
|
2572 | str = g_strdup_printf(_("Buzzing %s..."), alias); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
2573 | purple_conversation_write(conv, NULL, str, |
|
25973
ee95dc6c4a55
Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <malu@pidgin.im>
parents:
25972
diff
changeset
|
2574 | PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, time(NULL)); |
|
ee95dc6c4a55
Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <malu@pidgin.im>
parents:
25972
diff
changeset
|
2575 | g_free(str); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
2576 | |
|
25973
ee95dc6c4a55
Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <malu@pidgin.im>
parents:
25972
diff
changeset
|
2577 | return PURPLE_CMD_RET_OK; |
|
ee95dc6c4a55
Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <malu@pidgin.im>
parents:
25972
diff
changeset
|
2578 | } else { |
|
17822
1a183f3fa9d7
disapproval of revision 'd52c12703a8e67c41c7f95a2cae7f16ab426ad76'
Andreas Monitzer <am@adiumx.com>
parents:
17821
diff
changeset
|
2579 | return PURPLE_CMD_RET_FAILED; |
|
25973
ee95dc6c4a55
Print to conversation from jabber_cmd_buzz, this prevents printing two info
Marcus Lundblad <malu@pidgin.im>
parents:
25972
diff
changeset
|
2580 | } |
|
17822
1a183f3fa9d7
disapproval of revision 'd52c12703a8e67c41c7f95a2cae7f16ab426ad76'
Andreas Monitzer <am@adiumx.com>
parents:
17821
diff
changeset
|
2581 | } |
|
1a183f3fa9d7
disapproval of revision 'd52c12703a8e67c41c7f95a2cae7f16ab426ad76'
Andreas Monitzer <am@adiumx.com>
parents:
17821
diff
changeset
|
2582 | |
|
20401
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2583 | 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
|
2584 | { |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2585 | 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
|
2586 | |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2587 | if (!types) { |
|
22225
6cd802a8c5ad
This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22155
diff
changeset
|
2588 | 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
|
2589 | _("%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
|
2590 | } |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2591 | |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2592 | return types; |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2593 | } |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2594 | |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2595 | 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
|
2596 | { |
|
20930
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2597 | JabberStream *js = gc->proto_data; |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2598 | 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
|
2599 | |
|
20930
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2600 | if (!_jabber_send_buzz(js, username, &error)) { |
|
20401
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2601 | purple_debug_error("jabber", "jabber_send_attention: jabber_cmd_buzz failed with error: %s\n", error ? error : "(NULL)"); |
|
20930
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2602 | 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
|
2603 | return FALSE; |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2604 | } |
|
20930
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2605 | |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2606 | return TRUE; |
|
20401
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2607 | } |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2608 | |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2609 | |
|
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
|
2610 | gboolean jabber_offline_message(const PurpleBuddy *buddy) |
|
12645
a907ba243930
[gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12600
diff
changeset
|
2611 | { |
|
a907ba243930
[gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12600
diff
changeset
|
2612 | return TRUE; |
|
a907ba243930
[gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12600
diff
changeset
|
2613 | } |
|
22648
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22646
diff
changeset
|
2614 | |
|
26495
52846ebe1c7d
Don't assume a PurpleMedia instance will be created immediately.
Michael Ruprecht <maiku@pidgin.im>
parents:
26455
diff
changeset
|
2615 | gboolean |
|
23697
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
23696
diff
changeset
|
2616 | jabber_initiate_media(PurpleConnection *gc, const char *who, |
|
26108
8d0fd2f195aa
Changed PurpleMediaStreamType to PurpleMediaSessionType.
Michael Ruprecht <maiku@pidgin.im>
parents:
26106
diff
changeset
|
2617 | 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
|
2618 | { |
|
26454
94130b583e0b
Clean up usage of USE_VV in the XMPP protocol.
Michael Ruprecht <maiku@pidgin.im>
parents:
26399
diff
changeset
|
2619 | #ifdef USE_VV |
|
26205
f20bb7e9e311
Support initiating voice calls to GTalk and Gmail.
Michael Ruprecht <maiku@pidgin.im>
parents:
26186
diff
changeset
|
2620 | JabberStream *js = (JabberStream *) gc->proto_data; |
|
f20bb7e9e311
Support initiating voice calls to GTalk and Gmail.
Michael Ruprecht <maiku@pidgin.im>
parents:
26186
diff
changeset
|
2621 | JabberBuddy *jb; |
|
f20bb7e9e311
Support initiating voice calls to GTalk and Gmail.
Michael Ruprecht <maiku@pidgin.im>
parents:
26186
diff
changeset
|
2622 | |
|
f20bb7e9e311
Support initiating voice calls to GTalk and Gmail.
Michael Ruprecht <maiku@pidgin.im>
parents:
26186
diff
changeset
|
2623 | if (!js) { |
|
f20bb7e9e311
Support initiating voice calls to GTalk and Gmail.
Michael Ruprecht <maiku@pidgin.im>
parents:
26186
diff
changeset
|
2624 | purple_debug_error("jabber", |
|
f20bb7e9e311
Support initiating voice calls to GTalk and Gmail.
Michael Ruprecht <maiku@pidgin.im>
parents:
26186
diff
changeset
|
2625 | "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
|
2626 | return FALSE; |
|
26205
f20bb7e9e311
Support initiating voice calls to GTalk and Gmail.
Michael Ruprecht <maiku@pidgin.im>
parents:
26186
diff
changeset
|
2627 | } |
|
f20bb7e9e311
Support initiating voice calls to GTalk and Gmail.
Michael Ruprecht <maiku@pidgin.im>
parents:
26186
diff
changeset
|
2628 | |
|
f20bb7e9e311
Support initiating voice calls to GTalk and Gmail.
Michael Ruprecht <maiku@pidgin.im>
parents:
26186
diff
changeset
|
2629 | jb = jabber_buddy_find(js, who, FALSE); |
|
f20bb7e9e311
Support initiating voice calls to GTalk and Gmail.
Michael Ruprecht <maiku@pidgin.im>
parents:
26186
diff
changeset
|
2630 | |
|
f20bb7e9e311
Support initiating voice calls to GTalk and Gmail.
Michael Ruprecht <maiku@pidgin.im>
parents:
26186
diff
changeset
|
2631 | if (!jb) { |
|
f20bb7e9e311
Support initiating voice calls to GTalk and Gmail.
Michael Ruprecht <maiku@pidgin.im>
parents:
26186
diff
changeset
|
2632 | purple_debug_error("jabber", "Could not find buddy\n"); |
|
26495
52846ebe1c7d
Don't assume a PurpleMedia instance will be created immediately.
Michael Ruprecht <maiku@pidgin.im>
parents:
26455
diff
changeset
|
2633 | return FALSE; |
|
26205
f20bb7e9e311
Support initiating voice calls to GTalk and Gmail.
Michael Ruprecht <maiku@pidgin.im>
parents:
26186
diff
changeset
|
2634 | } |
|
f20bb7e9e311
Support initiating voice calls to GTalk and Gmail.
Michael Ruprecht <maiku@pidgin.im>
parents:
26186
diff
changeset
|
2635 | |
|
f20bb7e9e311
Support initiating voice calls to GTalk and Gmail.
Michael Ruprecht <maiku@pidgin.im>
parents:
26186
diff
changeset
|
2636 | if (type & PURPLE_MEDIA_AUDIO && |
|
f20bb7e9e311
Support initiating voice calls to GTalk and Gmail.
Michael Ruprecht <maiku@pidgin.im>
parents:
26186
diff
changeset
|
2637 | !jabber_buddy_has_capability(jb, |
|
f20bb7e9e311
Support initiating voice calls to GTalk and Gmail.
Michael Ruprecht <maiku@pidgin.im>
parents:
26186
diff
changeset
|
2638 | JINGLE_APP_RTP_SUPPORT_AUDIO) && |
|
26455
65d138da0c83
Move and rename GTALK_CAP to GOOGLE_VOICE_CAP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26454
diff
changeset
|
2639 | jabber_buddy_has_capability(jb, GOOGLE_VOICE_CAP)) |
|
26205
f20bb7e9e311
Support initiating voice calls to GTalk and Gmail.
Michael Ruprecht <maiku@pidgin.im>
parents:
26186
diff
changeset
|
2640 | return jabber_google_session_initiate(gc->proto_data, who, type); |
|
f20bb7e9e311
Support initiating voice calls to GTalk and Gmail.
Michael Ruprecht <maiku@pidgin.im>
parents:
26186
diff
changeset
|
2641 | else |
|
f20bb7e9e311
Support initiating voice calls to GTalk and Gmail.
Michael Ruprecht <maiku@pidgin.im>
parents:
26186
diff
changeset
|
2642 | return jingle_rtp_initiate_media(gc->proto_data, who, type); |
|
26454
94130b583e0b
Clean up usage of USE_VV in the XMPP protocol.
Michael Ruprecht <maiku@pidgin.im>
parents:
26399
diff
changeset
|
2643 | #else |
|
26495
52846ebe1c7d
Don't assume a PurpleMedia instance will be created immediately.
Michael Ruprecht <maiku@pidgin.im>
parents:
26455
diff
changeset
|
2644 | return FALSE; |
|
26454
94130b583e0b
Clean up usage of USE_VV in the XMPP protocol.
Michael Ruprecht <maiku@pidgin.im>
parents:
26399
diff
changeset
|
2645 | #endif |
|
22648
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22646
diff
changeset
|
2646 | } |
|
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22646
diff
changeset
|
2647 | |
|
26316
950c0d491c0d
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26292
diff
changeset
|
2648 | PurpleMediaCaps jabber_get_media_caps(PurpleConnection *gc, 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
|
2649 | { |
|
26454
94130b583e0b
Clean up usage of USE_VV in the XMPP protocol.
Michael Ruprecht <maiku@pidgin.im>
parents:
26399
diff
changeset
|
2650 | #ifdef USE_VV |
|
23714
a08cf0090382
Check remote JID's capabilities for audio and video XEP support.
Michael Ruprecht <maiku@pidgin.im>
parents:
23712
diff
changeset
|
2651 | JabberStream *js = (JabberStream *) gc->proto_data; |
|
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
|
2652 | JabberBuddy *jb; |
|
26316
950c0d491c0d
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26292
diff
changeset
|
2653 | PurpleMediaCaps caps = PURPLE_MEDIA_CAPS_NONE; |
|
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
|
2654 | |
|
0844f5e9ac8e
Fix crash bug when checking if a contact can do media when logging out.
Michael Ruprecht <maiku@pidgin.im>
parents:
23714
diff
changeset
|
2655 | if (!js) { |
|
0844f5e9ac8e
Fix crash bug when checking if a contact can do media when logging out.
Michael Ruprecht <maiku@pidgin.im>
parents:
23714
diff
changeset
|
2656 | purple_debug_error("jabber", "jabber_can_do_media: NULL stream\n"); |
|
0844f5e9ac8e
Fix crash bug when checking if a contact can do media when logging out.
Michael Ruprecht <maiku@pidgin.im>
parents:
23714
diff
changeset
|
2657 | 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
|
2658 | } |
|
0844f5e9ac8e
Fix crash bug when checking if a contact can do media when logging out.
Michael Ruprecht <maiku@pidgin.im>
parents:
23714
diff
changeset
|
2659 | |
|
0844f5e9ac8e
Fix crash bug when checking if a contact can do media when logging out.
Michael Ruprecht <maiku@pidgin.im>
parents:
23714
diff
changeset
|
2660 | jb = jabber_buddy_find(js, who, 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
|
2661 | |
|
23714
a08cf0090382
Check remote JID's capabilities for audio and video XEP support.
Michael Ruprecht <maiku@pidgin.im>
parents:
23712
diff
changeset
|
2662 | if (!jb) { |
|
a08cf0090382
Check remote JID's capabilities for audio and video XEP support.
Michael Ruprecht <maiku@pidgin.im>
parents:
23712
diff
changeset
|
2663 | purple_debug_error("jabber", "Could not find buddy\n"); |
|
23712
a775dab7e038
Create a proper media menu with options for audio, video, and
Michael Ruprecht <maiku@pidgin.im>
parents:
23710
diff
changeset
|
2664 | return FALSE; |
|
23714
a08cf0090382
Check remote JID's capabilities for audio and video XEP support.
Michael Ruprecht <maiku@pidgin.im>
parents:
23712
diff
changeset
|
2665 | } |
|
26170
829055c78478
Choose the transport type according to the responder's caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26167
diff
changeset
|
2666 | |
|
26316
950c0d491c0d
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26292
diff
changeset
|
2667 | if (jabber_buddy_has_capability(jb, JINGLE_APP_RTP_SUPPORT_AUDIO)) |
|
950c0d491c0d
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26292
diff
changeset
|
2668 | caps |= PURPLE_MEDIA_CAPS_AUDIO | |
|
950c0d491c0d
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26292
diff
changeset
|
2669 | PURPLE_MEDIA_CAPS_AUDIO_SINGLE_DIRECTION; |
|
950c0d491c0d
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26292
diff
changeset
|
2670 | if (jabber_buddy_has_capability(jb, JINGLE_APP_RTP_SUPPORT_VIDEO)) |
|
950c0d491c0d
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26292
diff
changeset
|
2671 | caps |= PURPLE_MEDIA_CAPS_VIDEO | |
|
950c0d491c0d
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26292
diff
changeset
|
2672 | PURPLE_MEDIA_CAPS_VIDEO_SINGLE_DIRECTION; |
|
950c0d491c0d
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26292
diff
changeset
|
2673 | if (caps & PURPLE_MEDIA_CAPS_AUDIO && caps & PURPLE_MEDIA_CAPS_VIDEO) |
|
950c0d491c0d
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26292
diff
changeset
|
2674 | caps |= PURPLE_MEDIA_CAPS_AUDIO_VIDEO; |
|
950c0d491c0d
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26292
diff
changeset
|
2675 | if (caps != PURPLE_MEDIA_CAPS_NONE) { |
|
950c0d491c0d
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26292
diff
changeset
|
2676 | if (!jabber_buddy_has_capability(jb, |
|
950c0d491c0d
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26292
diff
changeset
|
2677 | JINGLE_TRANSPORT_ICEUDP) && |
|
950c0d491c0d
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26292
diff
changeset
|
2678 | !jabber_buddy_has_capability(jb, |
|
950c0d491c0d
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26292
diff
changeset
|
2679 | JINGLE_TRANSPORT_RAWUDP)) { |
|
950c0d491c0d
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26292
diff
changeset
|
2680 | purple_debug_info("jingle-rtp", "Buddy doesn't " |
|
950c0d491c0d
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26292
diff
changeset
|
2681 | "support the same transport types\n"); |
|
950c0d491c0d
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26292
diff
changeset
|
2682 | caps = PURPLE_MEDIA_CAPS_NONE; |
|
950c0d491c0d
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26292
diff
changeset
|
2683 | } else |
|
950c0d491c0d
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26292
diff
changeset
|
2684 | caps |= PURPLE_MEDIA_CAPS_MODIFY_SESSION | |
|
950c0d491c0d
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26292
diff
changeset
|
2685 | PURPLE_MEDIA_CAPS_CHANGE_DIRECTION; |
|
26170
829055c78478
Choose the transport type according to the responder's caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26167
diff
changeset
|
2686 | } |
|
26455
65d138da0c83
Move and rename GTALK_CAP to GOOGLE_VOICE_CAP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26454
diff
changeset
|
2687 | if (jabber_buddy_has_capability(jb, GOOGLE_VOICE_CAP)) |
|
26316
950c0d491c0d
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26292
diff
changeset
|
2688 | caps |= PURPLE_MEDIA_CAPS_AUDIO; |
|
950c0d491c0d
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26292
diff
changeset
|
2689 | |
|
950c0d491c0d
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26292
diff
changeset
|
2690 | return caps; |
|
26454
94130b583e0b
Clean up usage of USE_VV in the XMPP protocol.
Michael Ruprecht <maiku@pidgin.im>
parents:
26399
diff
changeset
|
2691 | #else |
|
94130b583e0b
Clean up usage of USE_VV in the XMPP protocol.
Michael Ruprecht <maiku@pidgin.im>
parents:
26399
diff
changeset
|
2692 | 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
|
2693 | #endif |
|
22648
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22646
diff
changeset
|
2694 | } |
|
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22646
diff
changeset
|
2695 | |
|
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
|
2696 | void jabber_register_commands(void) |
| 9130 | 2697 | { |
| 15884 | 2698 | purple_cmd_register("config", "", PURPLE_CMD_P_PRPL, |
| 2699 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 9597 | 2700 | "prpl-jabber", jabber_cmd_chat_config, |
| 2701 | _("config: Configure a chat room."), NULL); | |
| 15884 | 2702 | purple_cmd_register("configure", "", PURPLE_CMD_P_PRPL, |
| 2703 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 9597 | 2704 | "prpl-jabber", jabber_cmd_chat_config, |
| 2705 | _("configure: Configure a chat room."), NULL); | |
| 15884 | 2706 | purple_cmd_register("nick", "s", PURPLE_CMD_P_PRPL, |
| 2707 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 9597 | 2708 | "prpl-jabber", jabber_cmd_chat_nick, |
| 2709 | _("nick <new nickname>: Change your nickname."), | |
| 2710 | NULL); | |
| 15884 | 2711 | purple_cmd_register("part", "s", PURPLE_CMD_P_PRPL, |
| 2712 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 2713 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", | |
| 9597 | 2714 | jabber_cmd_chat_part, _("part [room]: Leave the room."), |
| 2715 | NULL); | |
| 15884 | 2716 | purple_cmd_register("register", "", PURPLE_CMD_P_PRPL, |
| 2717 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 9597 | 2718 | "prpl-jabber", jabber_cmd_chat_register, |
| 2719 | _("register: Register with a chat room."), NULL); | |
| 9130 | 2720 | /* XXX: there needs to be a core /topic cmd, methinks */ |
| 15884 | 2721 | purple_cmd_register("topic", "s", PURPLE_CMD_P_PRPL, |
| 2722 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 2723 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", | |
| 9597 | 2724 | jabber_cmd_chat_topic, |
| 2725 | _("topic [new topic]: View or change the topic."), | |
| 2726 | NULL); | |
| 15884 | 2727 | purple_cmd_register("ban", "ws", PURPLE_CMD_P_PRPL, |
| 2728 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 2729 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", | |
| 9597 | 2730 | jabber_cmd_chat_ban, |
|
22759
1ab25e736b3d
Correct some help strings for Jabber slash commands
Mark Doliner <markdoliner@pidgin.im>
parents:
22587
diff
changeset
|
2731 | _("ban <user> [reason]: Ban a user from the room."), |
| 9597 | 2732 | NULL); |
| 15884 | 2733 | purple_cmd_register("affiliate", "ws", PURPLE_CMD_P_PRPL, |
| 2734 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 2735 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", | |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2736 | jabber_cmd_chat_affiliate, |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2737 | _("affiliate <user> <owner|admin|member|outcast|none>: Set a user's affiliation with the room."), |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2738 | NULL); |
| 15884 | 2739 | purple_cmd_register("role", "ws", PURPLE_CMD_P_PRPL, |
| 2740 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 2741 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", | |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2742 | jabber_cmd_chat_role, |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2743 | _("role <user> <moderator|participant|visitor|none>: Set a user's role in the room."), |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2744 | NULL); |
| 15884 | 2745 | purple_cmd_register("invite", "ws", PURPLE_CMD_P_PRPL, |
| 2746 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 2747 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", | |
| 9597 | 2748 | jabber_cmd_chat_invite, |
| 11158 | 2749 | _("invite <user> [message]: Invite a user to the room."), |
| 9597 | 2750 | NULL); |
| 15884 | 2751 | purple_cmd_register("join", "ws", PURPLE_CMD_P_PRPL, |
| 2752 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 2753 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", | |
| 9597 | 2754 | jabber_cmd_chat_join, |
|
22759
1ab25e736b3d
Correct some help strings for Jabber slash commands
Mark Doliner <markdoliner@pidgin.im>
parents:
22587
diff
changeset
|
2755 | _("join: <room> [password]: Join a chat on this server."), |
| 9597 | 2756 | NULL); |
| 15884 | 2757 | purple_cmd_register("kick", "ws", PURPLE_CMD_P_PRPL, |
| 2758 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 2759 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", | |
| 9597 | 2760 | jabber_cmd_chat_kick, |
|
22759
1ab25e736b3d
Correct some help strings for Jabber slash commands
Mark Doliner <markdoliner@pidgin.im>
parents:
22587
diff
changeset
|
2761 | _("kick <user> [reason]: Kick a user from the room."), |
| 9597 | 2762 | NULL); |
| 15884 | 2763 | purple_cmd_register("msg", "ws", PURPLE_CMD_P_PRPL, |
| 2764 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 9597 | 2765 | "prpl-jabber", jabber_cmd_chat_msg, |
| 2766 | _("msg <user> <message>: Send a private message to another user."), | |
| 2767 | NULL); | |
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
2768 | purple_cmd_register("ping", "w", PURPLE_CMD_P_PRPL, |
|
17779
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
2769 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM | |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
2770 | PURPLE_CMD_FLAG_PRPL_ONLY, |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
2771 | "prpl-jabber", jabber_cmd_ping, |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
2772 | _("ping <jid>: Ping a user/component/server."), |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
2773 | NULL); |
|
24429
31217eabccee
Register the /buzz command using PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS.
Marcus Lundblad <malu@pidgin.im>
parents:
24428
diff
changeset
|
2774 | purple_cmd_register("buzz", "w", PURPLE_CMD_P_PRPL, |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
2775 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY | |
|
24429
31217eabccee
Register the /buzz command using PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS.
Marcus Lundblad <malu@pidgin.im>
parents:
24428
diff
changeset
|
2776 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, |
|
17822
1a183f3fa9d7
disapproval of revision 'd52c12703a8e67c41c7f95a2cae7f16ab426ad76'
Andreas Monitzer <am@adiumx.com>
parents:
17821
diff
changeset
|
2777 | "prpl-jabber", jabber_cmd_buzz, |
|
1a183f3fa9d7
disapproval of revision 'd52c12703a8e67c41c7f95a2cae7f16ab426ad76'
Andreas Monitzer <am@adiumx.com>
parents:
17821
diff
changeset
|
2778 | _("buzz: Buzz a user to get their attention"), NULL); |
| 9130 | 2779 | } |
| 2780 | ||
|
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
|
2781 | void |
|
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
|
2782 | jabber_init_plugin(PurplePlugin *plugin) |
| 14358 | 2783 | { |
|
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
|
2784 | my_protocol = plugin; |
| 14358 | 2785 | } |