Sun, 14 Oct 2007 21:08:42 +0000
Rename:
* PurpleDisconnectReason to PurpleConnectionError;
* elements of that enum from PURPLE_REASON_* to PURPLE_CONNECTION_ERROR_*;
* purple_connection_reason_is_fatal to purple_connection_error_is_fatal.
| 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" |
|
14175
2bc5a80c5071
[gaim-migrate @ 16747]
Mark Doliner <markdoliner@pidgin.im>
parents:
14170
diff
changeset
|
34 | #include "proxy.h" |
| 7014 | 35 | #include "prpl.h" |
| 7072 | 36 | #include "request.h" |
| 7014 | 37 | #include "server.h" |
|
7095
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7072
diff
changeset
|
38 | #include "util.h" |
| 9943 | 39 | #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
|
40 | #include "xmlnode.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
41 | |
| 7014 | 42 | #include "auth.h" |
| 43 | #include "buddy.h" | |
| 44 | #include "chat.h" | |
| 8312 | 45 | #include "disco.h" |
| 15265 | 46 | #include "google.h" |
| 7014 | 47 | #include "iq.h" |
| 48 | #include "jutil.h" | |
| 49 | #include "message.h" | |
| 50 | #include "parser.h" | |
| 51 | #include "presence.h" | |
| 52 | #include "jabber.h" | |
| 53 | #include "roster.h" | |
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
54 | #include "ping.h" |
|
9466
b6425eab60ca
[gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents:
9414
diff
changeset
|
55 | #include "si.h" |
| 7923 | 56 | #include "xdata.h" |
|
17768
7be011945a1b
added preliminary frame for pep-support
Andreas Monitzer <am@adiumx.com>
parents:
17767
diff
changeset
|
57 | #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
|
58 | #include "adhoccommands.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
59 | |
|
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
|
60 | #define JABBER_CONNECT_STEPS (js->gsc ? 9 : 5) |
| 2086 | 61 | |
| 15884 | 62 | static PurplePlugin *my_protocol = NULL; |
|
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
|
63 | GList *jabber_features; |
|
4249
62583b5d3663
[gaim-migrate @ 4499]
Robert McQueen <robot101@debian.org>
parents:
4245
diff
changeset
|
64 | |
|
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
|
65 | static void jabber_unregister_account_cb(JabberStream *js); |
|
4249
62583b5d3663
[gaim-migrate @ 4499]
Robert McQueen <robot101@debian.org>
parents:
4245
diff
changeset
|
66 | |
| 7014 | 67 | static void jabber_stream_init(JabberStream *js) |
| 68 | { | |
| 69 | char *open_stream; | |
|
3340
7e59a209931d
[gaim-migrate @ 3359]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3337
diff
changeset
|
70 | |
| 7014 | 71 | open_stream = g_strdup_printf("<stream:stream to='%s' " |
| 72 | "xmlns='jabber:client' " | |
| 7395 | 73 | "xmlns:stream='http://etherx.jabber.org/streams' " |
| 74 | "version='1.0'>", | |
| 7291 | 75 | js->user->domain); |
| 13808 | 76 | /* setup the parser fresh for each stream */ |
| 77 | jabber_parser_setup(js); | |
| 7642 | 78 | jabber_send_raw(js, open_stream, -1); |
| 14062 | 79 | js->reinit = FALSE; |
| 7014 | 80 | g_free(open_stream); |
| 2086 | 81 | } |
| 82 | ||
| 7395 | 83 | static void |
| 84 | jabber_session_initialized_cb(JabberStream *js, xmlnode *packet, gpointer data) | |
| 3311 | 85 | { |
| 7014 | 86 | const char *type = xmlnode_get_attrib(packet, "type"); |
| 87 | if(type && !strcmp(type, "result")) { | |
| 88 | 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
|
89 | 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
|
90 | jabber_unregister_account_cb(js); |
| 7014 | 91 | } else { |
| 21279 | 92 | purple_connection_error_reason (js->gc, |
| 93 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
94 | ("Error initializing session")); |
| 3311 | 95 | } |
| 96 | } | |
| 97 | ||
| 7014 | 98 | static void jabber_session_init(JabberStream *js) |
| 3311 | 99 | { |
| 7014 | 100 | JabberIq *iq = jabber_iq_new(js, JABBER_IQ_SET); |
| 101 | xmlnode *session; | |
| 3311 | 102 | |
| 7395 | 103 | jabber_iq_set_callback(iq, jabber_session_initialized_cb, NULL); |
| 3311 | 104 | |
| 7014 | 105 | session = xmlnode_new_child(iq->node, "session"); |
| 13808 | 106 | xmlnode_set_namespace(session, "urn:ietf:params:xml:ns:xmpp-session"); |
| 3311 | 107 | |
| 7014 | 108 | jabber_iq_send(iq); |
| 3311 | 109 | } |
| 110 | ||
| 7395 | 111 | static void jabber_bind_result_cb(JabberStream *js, xmlnode *packet, |
| 112 | gpointer data) | |
| 113 | { | |
| 8401 | 114 | const char *type = xmlnode_get_attrib(packet, "type"); |
| 115 | xmlnode *bind; | |
| 116 | ||
| 117 | if(type && !strcmp(type, "result") && | |
| 118 | (bind = xmlnode_get_child_with_namespace(packet, "bind", "urn:ietf:params:xml:ns:xmpp-bind"))) { | |
| 119 | xmlnode *jid; | |
| 120 | char *full_jid; | |
| 121 | if((jid = xmlnode_get_child(bind, "jid")) && (full_jid = xmlnode_get_data(jid))) { | |
| 10289 | 122 | JabberBuddy *my_jb = NULL; |
| 8401 | 123 | jabber_id_free(js->user); |
| 124 | if(!(js->user = jabber_id_new(full_jid))) { | |
| 21279 | 125 | purple_connection_error_reason (js->gc, |
| 126 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
127 | _("Invalid response from server.")); |
| 8401 | 128 | } |
| 10289 | 129 | if((my_jb = jabber_buddy_find(js, full_jid, TRUE))) |
| 130 | my_jb->subscription |= JABBER_SUB_BOTH; | |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10490
diff
changeset
|
131 | g_free(full_jid); |
| 8401 | 132 | } |
| 133 | } else { | |
| 21279 | 134 | 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
|
135 | 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
|
136 | purple_connection_error_reason (js->gc, reason, msg); |
| 8401 | 137 | g_free(msg); |
| 138 | } | |
| 7395 | 139 | |
| 140 | jabber_session_init(js); | |
| 141 | } | |
| 142 | ||
| 143 | static void jabber_stream_features_parse(JabberStream *js, xmlnode *packet) | |
| 144 | { | |
| 8296 | 145 | if(xmlnode_get_child(packet, "starttls")) { |
| 146 | if(jabber_process_starttls(js, packet)) | |
| 147 | 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
|
148 | } else if(purple_account_get_bool(js->gc->account, "require_tls", FALSE) && !js->gsc) { |
| 21279 | 149 | purple_connection_error_reason (js->gc, |
| 150 | PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, | |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
151 | _("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
|
152 | return; |
| 8296 | 153 | } |
| 154 | ||
| 10988 | 155 | if(js->registration) { |
| 156 | jabber_register_start(js); | |
| 157 | } else if(xmlnode_get_child(packet, "mechanisms")) { | |
| 7395 | 158 | jabber_auth_start(js, packet); |
| 159 | } else if(xmlnode_get_child(packet, "bind")) { | |
| 160 | xmlnode *bind, *resource; | |
| 161 | JabberIq *iq = jabber_iq_new(js, JABBER_IQ_SET); | |
| 162 | bind = xmlnode_new_child(iq->node, "bind"); | |
| 13808 | 163 | xmlnode_set_namespace(bind, "urn:ietf:params:xml:ns:xmpp-bind"); |
| 7395 | 164 | resource = xmlnode_new_child(bind, "resource"); |
| 165 | xmlnode_insert_data(resource, js->user->resource, -1); | |
| 166 | ||
| 167 | jabber_iq_set_callback(iq, jabber_bind_result_cb, NULL); | |
| 168 | ||
| 169 | jabber_iq_send(iq); | |
| 8296 | 170 | } else /* if(xmlnode_get_child_with_namespace(packet, "auth")) */ { |
| 171 | /* If we get an empty stream:features packet, or we explicitly get | |
| 172 | * an auth feature with namespace http://jabber.org/features/iq-auth | |
| 173 | * we should revert back to iq:auth authentication, even though we're | |
| 174 | * connecting to an XMPP server. */ | |
| 175 | js->auth_type = JABBER_AUTH_IQ_AUTH; | |
| 176 | jabber_stream_set_state(js, JABBER_STREAM_AUTHENTICATING); | |
| 7395 | 177 | } |
| 178 | } | |
| 179 | ||
| 7014 | 180 | static void jabber_stream_handle_error(JabberStream *js, xmlnode *packet) |
| 3311 | 181 | { |
| 21279 | 182 | 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
|
183 | char *msg = jabber_parse_error(js, packet, &reason); |
| 3311 | 184 | |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
185 | 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
|
186 | |
| 8401 | 187 | g_free(msg); |
| 2086 | 188 | } |
| 189 | ||
| 7014 | 190 | static void tls_init(JabberStream *js); |
| 2086 | 191 | |
|
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
|
192 | void jabber_process_packet(JabberStream *js, xmlnode **packet) |
| 2086 | 193 | { |
| 15980 | 194 | const char *xmlns; |
| 195 | ||
|
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
|
196 | purple_signal_emit(my_protocol, "jabber-receiving-xmlnode", js->gc, packet); |
| 14358 | 197 | |
| 198 | /* 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
|
199 | if(NULL == *packet) |
| 14358 | 200 | return; |
| 201 | ||
|
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
|
202 | xmlns = xmlnode_get_namespace(*packet); |
| 15980 | 203 | |
|
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
|
204 | 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
|
205 | 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
|
206 | } 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
|
207 | 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
|
208 | } 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
|
209 | 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
|
210 | } 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
|
211 | 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
|
212 | } else if (!strcmp((*packet)->name, "features") && |
| 15980 | 213 | !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
|
214 | 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
|
215 | } else if(!strcmp((*packet)->name, "stream:error") || |
|
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
|
216 | (!strcmp((*packet)->name, "error") && |
| 15980 | 217 | !strcmp(xmlns, "http://etherx.jabber.org/streams"))) |
| 218 | { | |
|
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
|
219 | 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
|
220 | } else if(!strcmp((*packet)->name, "challenge")) { |
| 7014 | 221 | 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
|
222 | 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
|
223 | } else if(!strcmp((*packet)->name, "success")) { |
| 7014 | 224 | 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
|
225 | 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
|
226 | } else if(!strcmp((*packet)->name, "failure")) { |
| 7014 | 227 | 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
|
228 | 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
|
229 | } else if(!strcmp((*packet)->name, "proceed")) { |
| 7014 | 230 | if(js->state == JABBER_STREAM_AUTHENTICATING && !js->gsc) |
| 231 | tls_init(js); | |
| 232 | } else { | |
| 15884 | 233 | 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
|
234 | (*packet)->name); |
| 2086 | 235 | } |
| 236 | } | |
| 237 | ||
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
238 | 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
|
239 | { |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
240 | int ret; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
241 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
242 | if (js->gsc) |
| 15884 | 243 | ret = purple_ssl_write(js->gsc, data, len); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
244 | else |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
245 | ret = write(js->fd, data, len); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
246 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
247 | return ret; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
248 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
249 | |
| 15884 | 250 | 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
|
251 | { |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
252 | JabberStream *js = data; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
253 | int ret, writelen; |
| 15884 | 254 | writelen = purple_circ_buffer_get_max_read(js->write_buffer); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
255 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
256 | if (writelen == 0) { |
| 15884 | 257 | purple_input_remove(js->writeh); |
|
13746
790924f38349
[gaim-migrate @ 16155]
Mark Doliner <markdoliner@pidgin.im>
parents:
13546
diff
changeset
|
258 | js->writeh = 0; |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
259 | return; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
260 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
261 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
262 | ret = jabber_do_send(js, js->write_buffer->outptr, writelen); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
263 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
264 | if (ret < 0 && errno == EAGAIN) |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
265 | return; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
266 | else if (ret <= 0) { |
| 21279 | 267 | purple_connection_error_reason (js->gc, |
| 268 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
269 | _("Write error")); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
270 | return; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
271 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
272 | |
| 15884 | 273 | purple_circ_buffer_mark_read(js->write_buffer, ret); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
274 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
275 | |
| 7642 | 276 | void jabber_send_raw(JabberStream *js, const char *data, int len) |
| 2086 | 277 | { |
| 7014 | 278 | int ret; |
| 2086 | 279 | |
| 7014 | 280 | /* because printing a tab to debug every minute gets old */ |
| 281 | if(strcmp(data, "\t")) | |
| 15884 | 282 | purple_debug(PURPLE_DEBUG_MISC, "jabber", "Sending%s: %s\n", |
| 7014 | 283 | js->gsc ? " (ssl)" : "", data); |
| 2086 | 284 | |
| 12508 | 285 | /* If we've got a security layer, we need to encode the data, |
| 286 | * splitting it on the maximum buffer length negotiated */ | |
| 14668 | 287 | |
| 15884 | 288 | purple_signal_emit(my_protocol, "jabber-sending-text", js->gc, &data); |
| 15412 | 289 | if (data == NULL) |
| 290 | return; | |
| 14668 | 291 | |
| 12508 | 292 | #ifdef HAVE_CYRUS_SASL |
| 293 | if (js->sasl_maxbuf>0) { | |
| 294 | int pos; | |
| 295 | ||
| 296 | if (!js->gsc && js->fd<0) | |
| 297 | return; | |
| 298 | pos = 0; | |
| 299 | if (len == -1) | |
| 300 | len = strlen(data); | |
| 301 | while (pos < len) { | |
| 302 | int towrite; | |
| 303 | const char *out; | |
| 304 | unsigned olen; | |
| 305 | ||
| 306 | if ((len - pos) < js->sasl_maxbuf) | |
| 307 | towrite = len - pos; | |
| 308 | else | |
| 309 | towrite = js->sasl_maxbuf; | |
| 310 | ||
| 311 | sasl_encode(js->sasl, &data[pos], towrite, &out, &olen); | |
| 312 | pos += towrite; | |
| 313 | ||
|
15783
e2f6e431f5a6
Simon Wilkinson noticed that this check was invalid and caused authentications to hang.
Daniel Atallah <datallah@pidgin.im>
parents:
15709
diff
changeset
|
314 | if (js->writeh == 0) |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
315 | ret = jabber_do_send(js, out, olen); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
316 | else { |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
317 | ret = -1; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
318 | errno = EAGAIN; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
319 | } |
|
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 | if (ret < 0 && errno != EAGAIN) |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
322 | purple_connection_error_reason (js->gc, |
| 21279 | 323 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
324 | _("Write error")); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
325 | else if (ret < olen) { |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
326 | if (ret < 0) |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
327 | ret = 0; |
|
13746
790924f38349
[gaim-migrate @ 16155]
Mark Doliner <markdoliner@pidgin.im>
parents:
13546
diff
changeset
|
328 | if (js->writeh == 0) |
| 15884 | 329 | js->writeh = purple_input_add( |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
330 | js->gsc ? js->gsc->fd : js->fd, |
| 15884 | 331 | PURPLE_INPUT_WRITE, |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
332 | jabber_send_cb, js); |
| 15884 | 333 | purple_circ_buffer_append(js->write_buffer, |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
334 | out + ret, olen - ret); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
335 | } |
| 12508 | 336 | } |
| 337 | return; | |
| 338 | } | |
| 339 | #endif | |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
340 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
341 | if (len == -1) |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
342 | len = strlen(data); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
343 | |
|
13746
790924f38349
[gaim-migrate @ 16155]
Mark Doliner <markdoliner@pidgin.im>
parents:
13546
diff
changeset
|
344 | if (js->writeh == 0) |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
345 | ret = jabber_do_send(js, data, len); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
346 | else { |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
347 | ret = -1; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
348 | errno = EAGAIN; |
|
2814
91cc1a0cdee0
[gaim-migrate @ 2827]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2800
diff
changeset
|
349 | } |
|
91cc1a0cdee0
[gaim-migrate @ 2827]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2800
diff
changeset
|
350 | |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
351 | if (ret < 0 && errno != EAGAIN) |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
352 | purple_connection_error_reason (js->gc, |
| 21279 | 353 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
354 | _("Write error")); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
355 | else if (ret < len) { |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
356 | if (ret < 0) |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
357 | ret = 0; |
|
13746
790924f38349
[gaim-migrate @ 16155]
Mark Doliner <markdoliner@pidgin.im>
parents:
13546
diff
changeset
|
358 | if (js->writeh == 0) |
| 15884 | 359 | js->writeh = purple_input_add( |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
360 | js->gsc ? js->gsc->fd : js->fd, |
| 15884 | 361 | PURPLE_INPUT_WRITE, jabber_send_cb, js); |
| 362 | purple_circ_buffer_append(js->write_buffer, | |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
363 | data + ret, len - ret); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
364 | } |
| 14604 | 365 | return; |
| 366 | } | |
| 7014 | 367 | |
|
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
|
368 | int jabber_prpl_send_raw(PurpleConnection *gc, const char *buf, int len) |
| 14604 | 369 | { |
| 370 | JabberStream *js = (JabberStream*)gc->proto_data; | |
| 371 | jabber_send_raw(js, buf, len); | |
| 372 | return len; | |
|
2814
91cc1a0cdee0
[gaim-migrate @ 2827]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2800
diff
changeset
|
373 | } |
|
91cc1a0cdee0
[gaim-migrate @ 2827]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2800
diff
changeset
|
374 | |
| 7014 | 375 | void jabber_send(JabberStream *js, xmlnode *packet) |
| 2086 | 376 | { |
| 7014 | 377 | char *txt; |
| 7642 | 378 | int len; |
| 2086 | 379 | |
| 15884 | 380 | purple_signal_emit(my_protocol, "jabber-sending-xmlnode", js->gc, &packet); |
| 14358 | 381 | |
| 382 | /* if we get NULL back, we're done processing */ | |
| 383 | if(NULL == packet) | |
| 384 | return; | |
| 385 | ||
| 7642 | 386 | txt = xmlnode_to_str(packet, &len); |
| 387 | jabber_send_raw(js, txt, len); | |
| 7014 | 388 | g_free(txt); |
| 2086 | 389 | } |
| 390 | ||
|
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
|
391 | void jabber_keepalive(PurpleConnection *gc) |
| 2086 | 392 | { |
| 7642 | 393 | jabber_send_raw(gc->proto_data, "\t", -1); |
| 2086 | 394 | } |
| 395 | ||
| 7014 | 396 | static void |
| 15884 | 397 | jabber_recv_cb_ssl(gpointer data, PurpleSslConnection *gsc, |
| 398 | PurpleInputCondition cond) | |
| 6764 | 399 | { |
| 15884 | 400 | PurpleConnection *gc = data; |
| 7014 | 401 | JabberStream *js = gc->proto_data; |
| 6764 | 402 | int len; |
| 7014 | 403 | static char buf[4096]; |
| 6768 | 404 | |
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
14004
diff
changeset
|
405 | /* TODO: It should be possible to make this check unnecessary */ |
| 15884 | 406 | if(!PURPLE_CONNECTION_IS_VALID(gc)) { |
| 407 | purple_ssl_close(gsc); | |
| 6768 | 408 | return; |
| 409 | } | |
| 410 | ||
| 15884 | 411 | while((len = purple_ssl_read(gsc, buf, sizeof(buf) - 1)) > 0) { |
| 6764 | 412 | buf[len] = '\0'; |
| 15884 | 413 | purple_debug(PURPLE_DEBUG_INFO, "jabber", "Recv (ssl)(%d): %s\n", len, buf); |
| 7014 | 414 | jabber_parser_process(js, buf, len); |
| 14062 | 415 | if(js->reinit) |
| 416 | jabber_stream_init(js); | |
| 13280 | 417 | } |
| 418 | ||
| 419 | if(errno == EAGAIN) | |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
420 | return; |
| 13280 | 421 | else |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
422 | purple_connection_error_reason (js->gc, |
| 21279 | 423 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
424 | _("Read Error")); |
| 2086 | 425 | } |
| 426 | ||
| 7014 | 427 | static void |
| 15884 | 428 | jabber_recv_cb(gpointer data, gint source, PurpleInputCondition condition) |
| 2086 | 429 | { |
| 15884 | 430 | PurpleConnection *gc = data; |
| 7014 | 431 | JabberStream *js = gc->proto_data; |
| 432 | int len; | |
| 433 | static char buf[4096]; | |
| 2086 | 434 | |
| 15884 | 435 | if(!PURPLE_CONNECTION_IS_VALID(gc)) |
| 7014 | 436 | return; |
| 2956 | 437 | |
| 7014 | 438 | if((len = read(js->fd, buf, sizeof(buf) - 1)) > 0) { |
| 12508 | 439 | #ifdef HAVE_CYRUS_SASL |
| 440 | if (js->sasl_maxbuf>0) { | |
| 441 | const char *out; | |
|
14697
518c0fae208e
[gaim-migrate @ 17381]
Daniel Atallah <datallah@pidgin.im>
parents:
14668
diff
changeset
|
442 | unsigned int olen; |
| 12508 | 443 | sasl_decode(js->sasl, buf, len, &out, &olen); |
| 444 | if (olen>0) { | |
| 15884 | 445 | purple_debug(PURPLE_DEBUG_INFO, "jabber", "RecvSASL (%u): %s\n", olen, out); |
| 12508 | 446 | jabber_parser_process(js,out,olen); |
| 14700 | 447 | if(js->reinit) |
| 448 | jabber_stream_init(js); | |
| 12508 | 449 | } |
| 450 | return; | |
| 451 | } | |
| 452 | #endif | |
| 7014 | 453 | buf[len] = '\0'; |
| 15884 | 454 | purple_debug(PURPLE_DEBUG_INFO, "jabber", "Recv (%d): %s\n", len, buf); |
| 7014 | 455 | jabber_parser_process(js, buf, len); |
| 14700 | 456 | if(js->reinit) |
| 457 | jabber_stream_init(js); | |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
458 | } else if(errno == EAGAIN) { |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
459 | return; |
| 7177 | 460 | } else { |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
461 | purple_connection_error_reason (js->gc, |
| 21279 | 462 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
463 | _("Read Error")); |
| 7014 | 464 | } |
| 2086 | 465 | } |
| 466 | ||
| 7014 | 467 | static void |
| 15884 | 468 | jabber_login_callback_ssl(gpointer data, PurpleSslConnection *gsc, |
| 469 | PurpleInputCondition cond) | |
| 6764 | 470 | { |
| 15884 | 471 | PurpleConnection *gc = data; |
|
15023
c38f385a128a
[gaim-migrate @ 17740]
Evan Schoenberg <evands@pidgin.im>
parents:
14899
diff
changeset
|
472 | JabberStream *js; |
|
c38f385a128a
[gaim-migrate @ 17740]
Evan Schoenberg <evands@pidgin.im>
parents:
14899
diff
changeset
|
473 | |
|
c38f385a128a
[gaim-migrate @ 17740]
Evan Schoenberg <evands@pidgin.im>
parents:
14899
diff
changeset
|
474 | /* TODO: It should be possible to make this check unnecessary */ |
| 15884 | 475 | if(!PURPLE_CONNECTION_IS_VALID(gc)) { |
| 476 | purple_ssl_close(gsc); | |
|
15023
c38f385a128a
[gaim-migrate @ 17740]
Evan Schoenberg <evands@pidgin.im>
parents:
14899
diff
changeset
|
477 | 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
|
478 | } |
|
15023
c38f385a128a
[gaim-migrate @ 17740]
Evan Schoenberg <evands@pidgin.im>
parents:
14899
diff
changeset
|
479 | |
|
c38f385a128a
[gaim-migrate @ 17740]
Evan Schoenberg <evands@pidgin.im>
parents:
14899
diff
changeset
|
480 | js = gc->proto_data; |
| 6764 | 481 | |
| 7014 | 482 | if(js->state == JABBER_STREAM_CONNECTING) |
| 7642 | 483 | jabber_send_raw(js, "<?xml version='1.0' ?>", -1); |
| 7014 | 484 | jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING); |
| 15884 | 485 | purple_ssl_input_add(gsc, jabber_recv_cb_ssl, gc); |
|
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
|
486 | |
|
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
|
487 | /* 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
|
488 | jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING_ENCRYPTION); |
| 6764 | 489 | } |
| 490 | ||
| 7014 | 491 | |
| 492 | static void | |
|
14175
2bc5a80c5071
[gaim-migrate @ 16747]
Mark Doliner <markdoliner@pidgin.im>
parents:
14170
diff
changeset
|
493 | jabber_login_callback(gpointer data, gint source, const gchar *error) |
| 6764 | 494 | { |
| 15884 | 495 | PurpleConnection *gc = data; |
| 7014 | 496 | JabberStream *js = gc->proto_data; |
| 2086 | 497 | |
|
8783
7be6da5bc279
[gaim-migrate @ 9545]
Mark Doliner <markdoliner@pidgin.im>
parents:
8778
diff
changeset
|
498 | if (source < 0) { |
|
17643
870d08f93965
Better error message for when a Jabber connection fails
Mark Doliner <markdoliner@pidgin.im>
parents:
17052
diff
changeset
|
499 | gchar *tmp; |
|
870d08f93965
Better error message for when a Jabber connection fails
Mark Doliner <markdoliner@pidgin.im>
parents:
17052
diff
changeset
|
500 | tmp = g_strdup_printf(_("Could not establish a connection with the server:\n%s"), |
|
870d08f93965
Better error message for when a Jabber connection fails
Mark Doliner <markdoliner@pidgin.im>
parents:
17052
diff
changeset
|
501 | error); |
| 21279 | 502 | purple_connection_error_reason (gc, |
| 503 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); | |
|
17643
870d08f93965
Better error message for when a Jabber connection fails
Mark Doliner <markdoliner@pidgin.im>
parents:
17052
diff
changeset
|
504 | g_free(tmp); |
|
8783
7be6da5bc279
[gaim-migrate @ 9545]
Mark Doliner <markdoliner@pidgin.im>
parents:
8778
diff
changeset
|
505 | return; |
|
7be6da5bc279
[gaim-migrate @ 9545]
Mark Doliner <markdoliner@pidgin.im>
parents:
8778
diff
changeset
|
506 | } |
|
7be6da5bc279
[gaim-migrate @ 9545]
Mark Doliner <markdoliner@pidgin.im>
parents:
8778
diff
changeset
|
507 | |
| 7014 | 508 | js->fd = source; |
| 2956 | 509 | |
| 7014 | 510 | if(js->state == JABBER_STREAM_CONNECTING) |
| 7642 | 511 | jabber_send_raw(js, "<?xml version='1.0' ?>", -1); |
|
2300
06a3c10f4918
[gaim-migrate @ 2310]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2289
diff
changeset
|
512 | |
| 7014 | 513 | jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING); |
| 15884 | 514 | gc->inpa = purple_input_add(js->fd, PURPLE_INPUT_READ, jabber_recv_cb, gc); |
| 7014 | 515 | } |
| 2086 | 516 | |
| 7014 | 517 | static void |
| 15884 | 518 | jabber_ssl_connect_failure(PurpleSslConnection *gsc, PurpleSslErrorType error, |
| 7426 | 519 | gpointer data) |
| 520 | { | |
| 15884 | 521 | 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
|
522 | JabberStream *js; |
| 7426 | 523 | |
|
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
|
524 | /* If the connection is already disconnected, we don't need to do anything else */ |
| 15884 | 525 | 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
|
526 | 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
|
527 | |
|
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
|
528 | js = gc->proto_data; |
|
14312
6ce4512aa9a8
[gaim-migrate @ 16932]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
529 | js->gsc = NULL; |
|
6ce4512aa9a8
[gaim-migrate @ 16932]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
530 | |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
531 | purple_connection_ssl_error (gc, error); |
| 7426 | 532 | } |
| 533 | ||
| 7427 | 534 | static void tls_init(JabberStream *js) |
| 535 | { | |
| 15884 | 536 | purple_input_remove(js->gc->inpa); |
| 7427 | 537 | js->gc->inpa = 0; |
|
18449
2d2df64f4303
applied changes from f9186fabb483b56a9d7e8fb7241b2520e9930413
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18235
diff
changeset
|
538 | js->gsc = purple_ssl_connect_with_host_fd(js->gc->account, js->fd, |
|
2d2df64f4303
applied changes from f9186fabb483b56a9d7e8fb7241b2520e9930413
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18235
diff
changeset
|
539 | jabber_login_callback_ssl, jabber_ssl_connect_failure, js->serverFQDN, js->gc); |
| 7427 | 540 | } |
| 541 | ||
| 17052 | 542 | static void jabber_login_connect(JabberStream *js, const char *fqdn, const char *host, int port) |
| 11387 | 543 | { |
| 17052 | 544 | js->serverFQDN = g_strdup(fqdn); |
|
15800
2d0ec4fe2681
pass the correct domain to cyrus sasl (sf patch 1663064)
Nathan Walp <nwalp@pidgin.im>
parents:
15783
diff
changeset
|
545 | |
| 17052 | 546 | if (purple_proxy_connect(js->gc, js->gc->account, host, |
|
14899
c65f0b4fb351
[gaim-migrate @ 17606]
Mark Doliner <markdoliner@pidgin.im>
parents:
14700
diff
changeset
|
547 | port, jabber_login_callback, js->gc) == NULL) |
| 21279 | 548 | purple_connection_error_reason (js->gc, |
| 549 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
550 | _("Unable to create socket")); |
| 11387 | 551 | } |
| 552 | ||
| 15884 | 553 | static void srv_resolved_cb(PurpleSrvResponse *resp, int results, gpointer data) |
| 11387 | 554 | { |
|
13956
c3001d55c88f
[gaim-migrate @ 16377]
Mark Doliner <markdoliner@pidgin.im>
parents:
13808
diff
changeset
|
555 | JabberStream *js; |
|
c3001d55c88f
[gaim-migrate @ 16377]
Mark Doliner <markdoliner@pidgin.im>
parents:
13808
diff
changeset
|
556 | |
|
14370
12ef3d4096ee
[gaim-migrate @ 16998]
Mark Doliner <markdoliner@pidgin.im>
parents:
14358
diff
changeset
|
557 | js = data; |
|
12ef3d4096ee
[gaim-migrate @ 16998]
Mark Doliner <markdoliner@pidgin.im>
parents:
14358
diff
changeset
|
558 | js->srv_query_data = NULL; |
| 11387 | 559 | |
| 560 | if(results) { | |
| 17052 | 561 | jabber_login_connect(js, resp->hostname, resp->hostname, resp->port); |
| 11387 | 562 | g_free(resp); |
| 563 | } else { | |
| 17052 | 564 | jabber_login_connect(js, js->user->domain, js->user->domain, |
| 15884 | 565 | purple_account_get_int(js->gc->account, "port", 5222)); |
| 11387 | 566 | } |
| 567 | } | |
| 568 | ||
|
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
|
569 | void |
| 15884 | 570 | jabber_login(PurpleAccount *account) |
| 2086 | 571 | { |
| 15884 | 572 | PurpleConnection *gc = purple_account_get_connection(account); |
| 573 | const char *connect_server = purple_account_get_string(account, | |
| 7014 | 574 | "connect_server", ""); |
| 575 | JabberStream *js; | |
| 10289 | 576 | JabberBuddy *my_jb = NULL; |
| 2086 | 577 | |
| 15884 | 578 | gc->flags |= PURPLE_CONNECTION_HTML; |
| 7014 | 579 | js = gc->proto_data = g_new0(JabberStream, 1); |
| 580 | js->gc = gc; | |
|
8013
03f5b77cdaf0
[gaim-migrate @ 8693]
Olivier Blin <blino@users.sourceforge.net>
parents:
8011
diff
changeset
|
581 | js->fd = -1; |
| 8312 | 582 | js->iq_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, |
| 583 | g_free, g_free); | |
| 584 | js->disco_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, | |
| 7395 | 585 | g_free, g_free); |
| 7014 | 586 | js->buddies = g_hash_table_new_full(g_str_hash, g_str_equal, |
| 7116 | 587 | g_free, (GDestroyNotify)jabber_buddy_free); |
| 7014 | 588 | js->chats = g_hash_table_new_full(g_str_hash, g_str_equal, |
| 8396 | 589 | g_free, (GDestroyNotify)jabber_chat_free); |
| 15884 | 590 | js->user = jabber_id_new(purple_account_get_username(account)); |
| 7322 | 591 | js->next_id = g_random_int(); |
| 15884 | 592 | js->write_buffer = purple_circ_buffer_new(512); |
|
17800
39a0f9ed0e26
Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents:
17791
diff
changeset
|
593 | js->old_length = -1; |
| 5613 | 594 | |
| 7310 | 595 | if(!js->user) { |
| 21279 | 596 | purple_connection_error_reason (gc, |
| 597 | PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, | |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
598 | _("Invalid XMPP ID")); |
| 7310 | 599 | return; |
| 600 | } | |
|
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
|
601 | |
|
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
|
602 | if (!js->user->domain || *(js->user->domain) == '\0') { |
| 21279 | 603 | purple_connection_error_reason (gc, |
| 604 | PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, | |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
605 | _("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
|
606 | 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
|
607 | } |
|
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
|
608 | |
| 7147 | 609 | if(!js->user->resource) { |
| 610 | char *me; | |
| 11939 | 611 | js->user->resource = g_strdup("Home"); |
| 7147 | 612 | if(!js->user->node) { |
| 613 | js->user->node = js->user->domain; | |
| 614 | js->user->domain = g_strdup("jabber.org"); | |
| 615 | } | |
| 616 | me = g_strdup_printf("%s@%s/%s", js->user->node, js->user->domain, | |
| 617 | js->user->resource); | |
| 15884 | 618 | purple_account_set_username(account, me); |
| 7147 | 619 | g_free(me); |
| 7145 | 620 | } |
| 621 | ||
| 15884 | 622 | if((my_jb = jabber_buddy_find(js, purple_account_get_username(account), TRUE))) |
| 10289 | 623 | my_jb->subscription |= JABBER_SUB_BOTH; |
| 624 | ||
| 7014 | 625 | jabber_stream_set_state(js, JABBER_STREAM_CONNECTING); |
| 2956 | 626 | |
| 11387 | 627 | /* if they've got old-ssl mode going, we probably want to ignore SRV lookups */ |
| 15884 | 628 | if(purple_account_get_bool(js->gc->account, "old_ssl", FALSE)) { |
| 629 | if(purple_ssl_is_supported()) { | |
| 630 | js->gsc = purple_ssl_connect(js->gc->account, | |
| 11387 | 631 | connect_server[0] ? connect_server : js->user->domain, |
| 15884 | 632 | purple_account_get_int(account, "port", 5223), jabber_login_callback_ssl, |
| 11387 | 633 | jabber_ssl_connect_failure, js->gc); |
| 7630 | 634 | } else { |
| 21279 | 635 | purple_connection_error_reason (js->gc, |
| 636 | PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, | |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
637 | _("SSL support unavailable")); |
| 7630 | 638 | } |
| 3311 | 639 | } |
| 3770 | 640 | |
| 11387 | 641 | /* no old-ssl, so if they've specified a connect server, we'll use that, otherwise we'll |
| 642 | * invoke the magic of SRV lookups, to figure out host and port */ | |
| 7014 | 643 | if(!js->gsc) { |
| 11387 | 644 | if(connect_server[0]) { |
| 17052 | 645 | jabber_login_connect(js, js->user->domain, connect_server, purple_account_get_int(account, "port", 5222)); |
| 11387 | 646 | } else { |
| 15884 | 647 | js->srv_query_data = purple_srv_resolve("xmpp-client", |
|
14370
12ef3d4096ee
[gaim-migrate @ 16998]
Mark Doliner <markdoliner@pidgin.im>
parents:
14358
diff
changeset
|
648 | "tcp", js->user->domain, srv_resolved_cb, js); |
| 11387 | 649 | } |
| 2956 | 650 | } |
| 2086 | 651 | } |
| 652 | ||
| 11387 | 653 | |
| 7072 | 654 | static gboolean |
| 655 | conn_close_cb(gpointer data) | |
| 656 | { | |
| 657 | JabberStream *js = data; | |
| 15884 | 658 | PurpleAccount *account = purple_connection_get_account(js->gc); |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10504
diff
changeset
|
659 | |
|
17810
c8d4297080cb
Fixed a leak: The XML parser was never cleaned up on disconnect.
Andreas Monitzer <am@adiumx.com>
parents:
17806
diff
changeset
|
660 | jabber_parser_free(js); |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10504
diff
changeset
|
661 | |
| 15884 | 662 | purple_account_disconnect(account); |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10504
diff
changeset
|
663 | |
| 7072 | 664 | return FALSE; |
| 665 | } | |
| 666 | ||
| 667 | static void | |
| 668 | jabber_connection_schedule_close(JabberStream *js) | |
| 669 | { | |
| 15884 | 670 | purple_timeout_add(0, conn_close_cb, js); |
| 7072 | 671 | } |
| 672 | ||
| 673 | static void | |
| 7395 | 674 | jabber_registration_result_cb(JabberStream *js, xmlnode *packet, gpointer data) |
| 7072 | 675 | { |
|
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
|
676 | PurpleAccount *account = purple_connection_get_account(js->gc); |
| 7072 | 677 | const char *type = xmlnode_get_attrib(packet, "type"); |
| 678 | 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
|
679 | char *to = data; |
| 7072 | 680 | |
| 681 | 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
|
682 | if(js->registration) { |
| 7072 | 683 | buf = g_strdup_printf(_("Registration of %s@%s successful"), |
| 684 | js->user->node, js->user->domain); | |
|
17815
232d57a6b6df
Simplified registration callback per request of Sean.
Andreas Monitzer <am@adiumx.com>
parents:
17814
diff
changeset
|
685 | if(account->registration_cb) |
|
232d57a6b6df
Simplified registration callback per request of Sean.
Andreas Monitzer <am@adiumx.com>
parents:
17814
diff
changeset
|
686 | (account->registration_cb)(account, TRUE, account->registration_cb_user_data); |
|
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
|
687 | } |
|
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
|
688 | else |
|
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
|
689 | 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
|
690 | to); |
| 15884 | 691 | purple_notify_info(NULL, _("Registration Successful"), |
| 7072 | 692 | _("Registration Successful"), buf); |
| 693 | g_free(buf); | |
| 694 | } else { | |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
695 | char *msg = jabber_parse_error(js, packet, NULL); |
| 7072 | 696 | |
| 8401 | 697 | if(!msg) |
| 698 | msg = g_strdup(_("Unknown Error")); | |
| 7072 | 699 | |
| 15884 | 700 | purple_notify_error(NULL, _("Registration Failed"), |
| 8401 | 701 | _("Registration Failed"), msg); |
| 702 | g_free(msg); | |
|
17815
232d57a6b6df
Simplified registration callback per request of Sean.
Andreas Monitzer <am@adiumx.com>
parents:
17814
diff
changeset
|
703 | if(account->registration_cb) |
|
232d57a6b6df
Simplified registration callback per request of Sean.
Andreas Monitzer <am@adiumx.com>
parents:
17814
diff
changeset
|
704 | (account->registration_cb)(account, FALSE, account->registration_cb_user_data); |
| 7072 | 705 | } |
|
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
|
706 | 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
|
707 | if(js->registration) |
| 7072 | 708 | jabber_connection_schedule_close(js); |
| 709 | } | |
| 710 | ||
| 711 | static void | |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
712 | 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
|
713 | { |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
714 | 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
|
715 | char *buf; |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
716 | char *to = data; |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
717 | |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
718 | if(!strcmp(type, "result")) { |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
719 | 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
|
720 | to); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
721 | purple_notify_info(NULL, _("Unregistration Successful"), |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
722 | _("Unregistration Successful"), buf); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
723 | g_free(buf); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
724 | } else { |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
725 | char *msg = jabber_parse_error(js, packet, NULL); |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
726 | |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
727 | if(!msg) |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
728 | msg = g_strdup(_("Unknown Error")); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
729 | |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
730 | purple_notify_error(NULL, _("Unregistration Failed"), |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
731 | _("Unregistration Failed"), msg); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
732 | g_free(msg); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
733 | } |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
734 | g_free(to); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
735 | } |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
736 | |
|
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
|
737 | 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
|
738 | 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
|
739 | 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
|
740 | } 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
|
741 | |
| 7072 | 742 | 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
|
743 | jabber_register_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fields) |
| 7072 | 744 | { |
| 745 | GList *groups, *flds; | |
| 746 | xmlnode *query, *y; | |
| 747 | JabberIq *iq; | |
| 7264 | 748 | char *username; |
| 7072 | 749 | |
|
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
|
750 | iq = jabber_iq_new_query(cbdata->js, JABBER_IQ_SET, "jabber:iq:register"); |
| 7072 | 751 | query = xmlnode_get_child(iq->node, "query"); |
|
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
|
752 | xmlnode_set_attrib(iq->node,"to",cbdata->who); |
| 7072 | 753 | |
| 15884 | 754 | for(groups = purple_request_fields_get_groups(fields); groups; |
| 7072 | 755 | groups = groups->next) { |
| 15884 | 756 | for(flds = purple_request_field_group_get_fields(groups->data); |
| 7072 | 757 | flds; flds = flds->next) { |
| 15884 | 758 | PurpleRequestField *field = flds->data; |
| 759 | 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
|
760 | if(!strcmp(id,"unregister")) { |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
761 | 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
|
762 | if(value) { |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
763 | /* 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
|
764 | (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
|
765 | jabber_iq_free(iq); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
766 | 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
|
767 | query = xmlnode_get_child(iq->node, "query"); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
768 | xmlnode_set_attrib(iq->node,"to",cbdata->who); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
769 | xmlnode_new_child(query, "remove"); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
770 | |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
771 | jabber_iq_set_callback(iq, jabber_unregistration_result_cb, cbdata->who); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
772 | |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
773 | jabber_iq_send(iq); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
774 | g_free(cbdata); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
775 | return; |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
776 | } |
| 7072 | 777 | } else { |
| 15884 | 778 | const char *value = purple_request_field_string_get_value(field); |
| 7072 | 779 | |
| 780 | if(!strcmp(id, "username")) { | |
| 781 | y = xmlnode_new_child(query, "username"); | |
| 782 | } else if(!strcmp(id, "password")) { | |
| 783 | y = xmlnode_new_child(query, "password"); | |
| 784 | } else if(!strcmp(id, "name")) { | |
| 785 | y = xmlnode_new_child(query, "name"); | |
| 786 | } else if(!strcmp(id, "email")) { | |
| 787 | y = xmlnode_new_child(query, "email"); | |
| 788 | } else if(!strcmp(id, "nick")) { | |
| 789 | y = xmlnode_new_child(query, "nick"); | |
| 790 | } else if(!strcmp(id, "first")) { | |
| 791 | y = xmlnode_new_child(query, "first"); | |
| 792 | } else if(!strcmp(id, "last")) { | |
| 793 | y = xmlnode_new_child(query, "last"); | |
| 794 | } else if(!strcmp(id, "address")) { | |
| 795 | y = xmlnode_new_child(query, "address"); | |
| 796 | } else if(!strcmp(id, "city")) { | |
| 797 | y = xmlnode_new_child(query, "city"); | |
| 798 | } else if(!strcmp(id, "state")) { | |
| 799 | y = xmlnode_new_child(query, "state"); | |
| 800 | } else if(!strcmp(id, "zip")) { | |
| 801 | y = xmlnode_new_child(query, "zip"); | |
| 802 | } else if(!strcmp(id, "phone")) { | |
| 803 | y = xmlnode_new_child(query, "phone"); | |
| 804 | } else if(!strcmp(id, "url")) { | |
| 805 | y = xmlnode_new_child(query, "url"); | |
| 806 | } else if(!strcmp(id, "date")) { | |
| 807 | y = xmlnode_new_child(query, "date"); | |
| 808 | } else { | |
| 809 | continue; | |
| 810 | } | |
| 811 | 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
|
812 | if(cbdata->js->registration && !strcmp(id, "username")) { |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
813 | if(cbdata->js->user->node) |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
814 | g_free(cbdata->js->user->node); |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
815 | cbdata->js->user->node = g_strdup(value); |
| 7264 | 816 | } |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
817 | 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
|
818 | purple_account_set_password(cbdata->js->gc->account, value); |
| 7072 | 819 | } |
| 820 | } | |
|
19897
8b5abbdebc87
merge of 'b0586b3697e8044ccd62a369b0c0f9125b2ef732'
Daniel Atallah <datallah@pidgin.im>
diff
changeset
|
821 | } |
| 7072 | 822 | |
|
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
|
823 | 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
|
824 | 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
|
825 | 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
|
826 | purple_account_set_username(cbdata->js->gc->account, username); |
| 7264 | 827 | 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
|
828 | } |
| 7264 | 829 | |
|
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
|
830 | jabber_iq_set_callback(iq, jabber_registration_result_cb, cbdata->who); |
| 7072 | 831 | |
| 832 | 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
|
833 | g_free(cbdata); |
| 7072 | 834 | } |
| 835 | ||
| 836 | 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
|
837 | jabber_register_cancel_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fields) |
| 7072 | 838 | { |
|
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
|
839 | 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
|
840 | 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
|
841 | if(account->registration_cb) |
|
17815
232d57a6b6df
Simplified registration callback per request of Sean.
Andreas Monitzer <am@adiumx.com>
parents:
17814
diff
changeset
|
842 | (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
|
843 | jabber_connection_schedule_close(cbdata->js); |
|
20320
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20316
diff
changeset
|
844 | } |
|
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
|
845 | 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
|
846 | g_free(cbdata); |
| 7072 | 847 | } |
| 848 | ||
| 7923 | 849 | static void jabber_register_x_data_cb(JabberStream *js, xmlnode *result, gpointer data) |
| 850 | { | |
| 851 | xmlnode *query; | |
| 852 | 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
|
853 | char *to = data; |
| 7923 | 854 | |
| 855 | iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register"); | |
| 856 | query = xmlnode_get_child(iq->node, "query"); | |
|
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
|
857 | xmlnode_set_attrib(iq->node,"to",to); |
| 7923 | 858 | |
| 859 | xmlnode_insert_child(query, result); | |
| 860 | ||
|
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
|
861 | jabber_iq_set_callback(iq, jabber_registration_result_cb, to); |
| 7923 | 862 | jabber_iq_send(iq); |
| 863 | } | |
| 864 | ||
| 7072 | 865 | void jabber_register_parse(JabberStream *js, xmlnode *packet) |
| 866 | { | |
|
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
|
867 | PurpleAccount *account = purple_connection_get_account(js->gc); |
| 14356 | 868 | const char *type; |
|
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
|
869 | const char *from = xmlnode_get_attrib(packet, "from"); |
| 15884 | 870 | PurpleRequestFields *fields; |
| 871 | PurpleRequestFieldGroup *group; | |
| 872 | PurpleRequestField *field; | |
| 7923 | 873 | xmlnode *query, *x, *y; |
| 7072 | 874 | 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
|
875 | JabberRegisterCBData *cbdata; |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
876 | gboolean registered = FALSE; |
| 7072 | 877 | |
| 14356 | 878 | if(!(type = xmlnode_get_attrib(packet, "type")) || strcmp(type, "result")) |
| 879 | return; | |
| 880 | ||
|
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
|
881 | if(js->registration) |
| 7072 | 882 | /* get rid of the login thingy */ |
| 15884 | 883 | purple_connection_set_state(js->gc, PURPLE_CONNECTED); |
| 7072 | 884 | |
| 885 | query = xmlnode_get_child(packet, "query"); | |
| 886 | ||
| 887 | 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
|
888 | registered = TRUE; |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
889 | |
|
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
|
890 | if(js->registration) { |
| 15884 | 891 | purple_notify_error(NULL, _("Already Registered"), |
| 7072 | 892 | _("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
|
893 | if(account->registration_cb) |
|
17815
232d57a6b6df
Simplified registration callback per request of Sean.
Andreas Monitzer <am@adiumx.com>
parents:
17814
diff
changeset
|
894 | (account->registration_cb)(account, FALSE, account->registration_cb_user_data); |
| 7072 | 895 | jabber_connection_schedule_close(js); |
| 896 | return; | |
| 897 | } | |
|
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
|
898 | } |
| 7072 | 899 | |
| 8398 | 900 | if((x = xmlnode_get_child_with_namespace(packet, "x", |
| 901 | "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
|
902 | jabber_x_data_request(js, x, jabber_register_x_data_cb, g_strdup(from)); |
| 8398 | 903 | return; |
| 904 | } else if((x = xmlnode_get_child_with_namespace(packet, "x", | |
| 905 | "jabber:x:oob"))) { | |
| 906 | xmlnode *url; | |
| 7923 | 907 | |
| 8398 | 908 | if((url = xmlnode_get_child(x, "url"))) { |
| 909 | char *href; | |
| 910 | if((href = xmlnode_get_data(url))) { | |
| 15884 | 911 | purple_notify_uri(NULL, href); |
| 8398 | 912 | g_free(href); |
|
20320
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20316
diff
changeset
|
913 | if(js->registration) { |
|
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20316
diff
changeset
|
914 | js->gc->wants_to_die = TRUE; |
|
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20316
diff
changeset
|
915 | if(account->registration_cb) /* succeeded, but we have no login info */ |
|
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20316
diff
changeset
|
916 | (account->registration_cb)(account, TRUE, account->registration_cb_user_data); |
|
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20316
diff
changeset
|
917 | jabber_connection_schedule_close(js); |
|
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20316
diff
changeset
|
918 | } |
| 8398 | 919 | return; |
| 920 | } | |
| 7923 | 921 | } |
| 922 | } | |
| 923 | ||
| 924 | /* as a last resort, use the old jabber:iq:register syntax */ | |
| 925 | ||
| 15884 | 926 | fields = purple_request_fields_new(); |
| 927 | group = purple_request_field_group_new(NULL); | |
| 928 | purple_request_fields_add_group(fields, group); | |
| 7072 | 929 | |
|
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
|
930 | if(js->registration) |
| 15884 | 931 | field = purple_request_field_string_new("username", _("Username"), |
| 7072 | 932 | 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
|
933 | else |
|
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
|
934 | field = purple_request_field_string_new("username", _("Username"), |
|
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
|
935 | NULL, FALSE); |
| 7072 | 936 | |
| 15884 | 937 | purple_request_field_group_add_field(group, field); |
| 7072 | 938 | |
|
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
|
939 | if(js->registration) |
| 15884 | 940 | field = purple_request_field_string_new("password", _("Password"), |
| 941 | 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
|
942 | else |
|
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
|
943 | field = purple_request_field_string_new("password", _("Password"), |
|
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
|
944 | NULL, FALSE); |
| 7072 | 945 | |
| 15884 | 946 | purple_request_field_string_set_masked(field, TRUE); |
| 947 | purple_request_field_group_add_field(group, field); | |
| 7072 | 948 | |
| 949 | 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
|
950 | if(js->registration) |
| 15884 | 951 | field = purple_request_field_string_new("name", _("Name"), |
| 952 | 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
|
953 | else |
|
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
|
954 | field = purple_request_field_string_new("name", _("Name"), |
| 7072 | 955 | NULL, FALSE); |
| 15884 | 956 | purple_request_field_group_add_field(group, field); |
| 7072 | 957 | } |
| 958 | if(xmlnode_get_child(query, "email")) { | |
| 15884 | 959 | field = purple_request_field_string_new("email", _("E-mail"), |
| 7072 | 960 | NULL, FALSE); |
| 15884 | 961 | purple_request_field_group_add_field(group, field); |
| 7072 | 962 | } |
| 963 | if(xmlnode_get_child(query, "nick")) { | |
| 15884 | 964 | field = purple_request_field_string_new("nick", _("Nickname"), |
| 7072 | 965 | NULL, FALSE); |
| 15884 | 966 | purple_request_field_group_add_field(group, field); |
| 7072 | 967 | } |
| 968 | if(xmlnode_get_child(query, "first")) { | |
| 15884 | 969 | field = purple_request_field_string_new("first", _("First name"), |
| 7072 | 970 | NULL, FALSE); |
| 15884 | 971 | purple_request_field_group_add_field(group, field); |
| 7072 | 972 | } |
| 973 | if(xmlnode_get_child(query, "last")) { | |
| 15884 | 974 | field = purple_request_field_string_new("last", _("Last name"), |
| 7072 | 975 | NULL, FALSE); |
| 15884 | 976 | purple_request_field_group_add_field(group, field); |
| 7072 | 977 | } |
| 978 | if(xmlnode_get_child(query, "address")) { | |
| 15884 | 979 | field = purple_request_field_string_new("address", _("Address"), |
| 7072 | 980 | NULL, FALSE); |
| 15884 | 981 | purple_request_field_group_add_field(group, field); |
| 7072 | 982 | } |
| 983 | if(xmlnode_get_child(query, "city")) { | |
| 15884 | 984 | field = purple_request_field_string_new("city", _("City"), |
| 7072 | 985 | NULL, FALSE); |
| 15884 | 986 | purple_request_field_group_add_field(group, field); |
| 7072 | 987 | } |
| 988 | if(xmlnode_get_child(query, "state")) { | |
| 15884 | 989 | field = purple_request_field_string_new("state", _("State"), |
| 7072 | 990 | NULL, FALSE); |
| 15884 | 991 | purple_request_field_group_add_field(group, field); |
| 7072 | 992 | } |
| 993 | if(xmlnode_get_child(query, "zip")) { | |
| 15884 | 994 | field = purple_request_field_string_new("zip", _("Postal code"), |
| 7072 | 995 | NULL, FALSE); |
| 15884 | 996 | purple_request_field_group_add_field(group, field); |
| 7072 | 997 | } |
| 998 | if(xmlnode_get_child(query, "phone")) { | |
| 15884 | 999 | field = purple_request_field_string_new("phone", _("Phone"), |
| 7072 | 1000 | NULL, FALSE); |
| 15884 | 1001 | purple_request_field_group_add_field(group, field); |
| 7072 | 1002 | } |
| 1003 | if(xmlnode_get_child(query, "url")) { | |
| 15884 | 1004 | field = purple_request_field_string_new("url", _("URL"), |
| 7072 | 1005 | NULL, FALSE); |
| 15884 | 1006 | purple_request_field_group_add_field(group, field); |
| 7072 | 1007 | } |
| 1008 | if(xmlnode_get_child(query, "date")) { | |
| 15884 | 1009 | field = purple_request_field_string_new("date", _("Date"), |
| 7072 | 1010 | NULL, FALSE); |
| 15884 | 1011 | purple_request_field_group_add_field(group, field); |
| 7072 | 1012 | } |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1013 | if(registered) { |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1014 | 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
|
1015 | 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
|
1016 | } |
| 7072 | 1017 | |
|
20320
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20316
diff
changeset
|
1018 | if((y = xmlnode_get_child(query, "instructions"))) |
|
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20316
diff
changeset
|
1019 | instructions = xmlnode_get_data(y); |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1020 | else if(registered) |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1021 | 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
|
1022 | "to change your account registration.")); |
|
20320
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20316
diff
changeset
|
1023 | else |
|
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20316
diff
changeset
|
1024 | instructions = g_strdup(_("Please fill out the information below " |
|
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20316
diff
changeset
|
1025 | "to register your new account.")); |
| 7072 | 1026 | |
|
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
|
1027 | 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
|
1028 | 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
|
1029 | cbdata->who = g_strdup(from); |
| 7072 | 1030 | |
|
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
|
1031 | if(js->registration) |
|
16961
b6955f946f8f
s/Jabber/XMPP in user-visible places.
Richard Laager <rlaager@pidgin.im>
parents:
16847
diff
changeset
|
1032 | purple_request_fields(js->gc, _("Register New XMPP Account"), |
|
b6955f946f8f
s/Jabber/XMPP in user-visible places.
Richard Laager <rlaager@pidgin.im>
parents:
16847
diff
changeset
|
1033 | _("Register New XMPP Account"), instructions, fields, |
| 7072 | 1034 | _("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
|
1035 | _("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
|
1036 | purple_connection_get_account(js->gc), NULL, 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
|
1037 | cbdata); |
|
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
|
1038 | else { |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1039 | char *title = registered?g_strdup_printf(_("Change Account Registration at %s"), from) |
|
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1040 | :g_strdup_printf(_("Register New Account at %s"), from); |
|
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
|
1041 | purple_request_fields(js->gc, 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
|
1042 | title, instructions, fields, |
|
18755
8c4ddce1fb46
Added the ability to unregister from a gateway.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1043 | 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
|
1044 | _("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
|
1045 | purple_connection_get_account(js->gc), NULL, NULL, |
|
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
|
1046 | cbdata); |
|
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
|
1047 | 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
|
1048 | } |
|
14140
fcb570e0b2db
[gaim-migrate @ 16699]
Daniel Atallah <datallah@pidgin.im>
parents:
14115
diff
changeset
|
1049 | |
|
20320
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20316
diff
changeset
|
1050 | g_free(instructions); |
|
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20316
diff
changeset
|
1051 | } |
| 7072 | 1052 | |
| 8016 | 1053 | void jabber_register_start(JabberStream *js) |
| 7072 | 1054 | { |
| 1055 | JabberIq *iq; | |
| 1056 | ||
| 1057 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:register"); | |
| 1058 | jabber_iq_send(iq); | |
| 1059 | } | |
| 1060 | ||
|
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
|
1061 | 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
|
1062 | JabberIq *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
|
1063 | |
|
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
|
1064 | 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
|
1065 | 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
|
1066 | 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
|
1067 | } |
|
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
|
1068 | |
|
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
|
1069 | void jabber_register_account(PurpleAccount *account) |
| 7072 | 1070 | { |
| 15884 | 1071 | PurpleConnection *gc = purple_account_get_connection(account); |
| 7072 | 1072 | JabberStream *js; |
| 10289 | 1073 | JabberBuddy *my_jb = NULL; |
| 15884 | 1074 | const char *connect_server = purple_account_get_string(account, |
| 7072 | 1075 | "connect_server", ""); |
| 1076 | const char *server; | |
| 1077 | ||
| 1078 | js = gc->proto_data = g_new0(JabberStream, 1); | |
| 1079 | js->gc = gc; | |
| 1080 | js->registration = TRUE; | |
| 8312 | 1081 | js->iq_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, |
| 1082 | g_free, g_free); | |
| 1083 | js->disco_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, | |
| 7395 | 1084 | g_free, g_free); |
| 15884 | 1085 | js->user = jabber_id_new(purple_account_get_username(account)); |
| 7322 | 1086 | js->next_id = g_random_int(); |
|
17800
39a0f9ed0e26
Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents:
17791
diff
changeset
|
1087 | js->old_length = -1; |
| 7072 | 1088 | |
| 7310 | 1089 | if(!js->user) { |
| 21279 | 1090 | purple_connection_error_reason (gc, |
| 1091 | PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, | |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
1092 | _("Invalid XMPP ID")); |
| 7310 | 1093 | return; |
| 1094 | } | |
| 1095 | ||
| 15884 | 1096 | js->write_buffer = purple_circ_buffer_new(512); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
1097 | |
| 7147 | 1098 | if(!js->user->resource) { |
| 1099 | char *me; | |
| 11939 | 1100 | js->user->resource = g_strdup("Home"); |
| 7147 | 1101 | if(!js->user->node) { |
| 1102 | js->user->node = js->user->domain; | |
| 1103 | js->user->domain = g_strdup("jabber.org"); | |
| 1104 | } | |
| 1105 | me = g_strdup_printf("%s@%s/%s", js->user->node, js->user->domain, | |
| 1106 | js->user->resource); | |
| 15884 | 1107 | purple_account_set_username(account, me); |
| 7147 | 1108 | g_free(me); |
| 1109 | } | |
| 1110 | ||
| 15884 | 1111 | if((my_jb = jabber_buddy_find(js, purple_account_get_username(account), TRUE))) |
| 10289 | 1112 | my_jb->subscription |= JABBER_SUB_BOTH; |
| 1113 | ||
| 7072 | 1114 | server = connect_server[0] ? connect_server : js->user->domain; |
| 1115 | ||
| 1116 | jabber_stream_set_state(js, JABBER_STREAM_CONNECTING); | |
| 1117 | ||
| 15884 | 1118 | if(purple_account_get_bool(account, "old_ssl", FALSE)) { |
| 1119 | if(purple_ssl_is_supported()) { | |
| 1120 | js->gsc = purple_ssl_connect(account, server, | |
| 1121 | purple_account_get_int(account, "port", 5222), | |
| 7630 | 1122 | jabber_login_callback_ssl, jabber_ssl_connect_failure, gc); |
| 1123 | } else { | |
| 21279 | 1124 | purple_connection_error_reason (gc, |
| 1125 | PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, | |
|
20445
c900767c024b
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <resiak@pidgin.im>
parents:
20332
diff
changeset
|
1126 | _("SSL support unavailable")); |
| 7630 | 1127 | } |
| 7072 | 1128 | } |
| 1129 | ||
| 1130 | if(!js->gsc) { | |
| 15069 | 1131 | if (connect_server[0]) { |
| 17052 | 1132 | jabber_login_connect(js, js->user->domain, server, |
| 15884 | 1133 | purple_account_get_int(account, |
| 15069 | 1134 | "port", 5222)); |
| 1135 | } else { | |
| 15884 | 1136 | js->srv_query_data = purple_srv_resolve("xmpp-client", |
| 15069 | 1137 | "tcp", |
| 1138 | js->user->domain, | |
| 1139 | srv_resolved_cb, | |
| 1140 | js); | |
| 1141 | } | |
| 7072 | 1142 | } |
| 1143 | } | |
| 1144 | ||
|
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
|
1145 | 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
|
1146 | 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
|
1147 | 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
|
1148 | 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
|
1149 | char *msg = jabber_parse_error(js, packet, 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
|
1150 | |
|
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
|
1151 | 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
|
1152 | _("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
|
1153 | 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
|
1154 | if(js->unregistration_cb) |
|
18995
6ba7743720cb
Mixed up TRUE and FALSE.
Andreas Monitzer <am@adiumx.com>
parents:
18994
diff
changeset
|
1155 | 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
|
1156 | } 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
|
1157 | 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
|
1158 | _("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
|
1159 | if(js->unregistration_cb) |
|
18995
6ba7743720cb
Mixed up TRUE and FALSE.
Andreas Monitzer <am@adiumx.com>
parents:
18994
diff
changeset
|
1160 | 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
|
1161 | } |
|
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
|
1162 | } |
|
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
|
1163 | |
|
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
|
1164 | 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
|
1165 | 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
|
1166 | 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
|
1167 | |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1168 | 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
|
1169 | |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1170 | 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
|
1171 | |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1172 | 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
|
1173 | |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1174 | 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
|
1175 | 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
|
1176 | |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1177 | 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
|
1178 | 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
|
1179 | } |
|
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
|
1180 | |
|
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
|
1181 | 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
|
1182 | 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
|
1183 | 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
|
1184 | |
|
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
|
1185 | 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
|
1186 | 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
|
1187 | 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
|
1188 | 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
|
1189 | 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
|
1190 | 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
|
1191 | 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
|
1192 | 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
|
1193 | } |
|
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
|
1194 | |
|
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
|
1195 | 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
|
1196 | |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1197 | 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
|
1198 | 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
|
1199 | return; |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1200 | } |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1201 | |
|
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
|
1202 | 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
|
1203 | 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
|
1204 | 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
|
1205 | |
|
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
|
1206 | 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
|
1207 | } |
|
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
|
1208 | |
|
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
|
1209 | void jabber_close(PurpleConnection *gc) |
| 2086 | 1210 | { |
| 7014 | 1211 | JabberStream *js = gc->proto_data; |
| 2956 | 1212 | |
| 14004 | 1213 | /* Don't perform any actions on the ssl connection |
| 1214 | * if we were forcibly disconnected because it will crash | |
| 1215 | * on some SSL backends. | |
|
13154
1a93fddf2a9a
[gaim-migrate @ 15516]
Evan Schoenberg <evands@pidgin.im>
parents:
13051
diff
changeset
|
1216 | */ |
|
1a93fddf2a9a
[gaim-migrate @ 15516]
Evan Schoenberg <evands@pidgin.im>
parents:
13051
diff
changeset
|
1217 | if (!gc->disconnect_timeout) |
| 14003 | 1218 | jabber_send_raw(js, "</stream:stream>", -1); |
| 3311 | 1219 | |
|
14370
12ef3d4096ee
[gaim-migrate @ 16998]
Mark Doliner <markdoliner@pidgin.im>
parents:
14358
diff
changeset
|
1220 | if (js->srv_query_data) |
| 15884 | 1221 | purple_srv_cancel(js->srv_query_data); |
|
14370
12ef3d4096ee
[gaim-migrate @ 16998]
Mark Doliner <markdoliner@pidgin.im>
parents:
14358
diff
changeset
|
1222 | |
| 7014 | 1223 | if(js->gsc) { |
|
13243
5a127fc7db90
[gaim-migrate @ 15608]
Evan Schoenberg <evands@pidgin.im>
parents:
13238
diff
changeset
|
1224 | #ifdef HAVE_OPENSSL |
|
5a127fc7db90
[gaim-migrate @ 15608]
Evan Schoenberg <evands@pidgin.im>
parents:
13238
diff
changeset
|
1225 | if (!gc->disconnect_timeout) |
| 13385 | 1226 | #endif |
| 15884 | 1227 | purple_ssl_close(js->gsc); |
| 8360 | 1228 | } else if (js->fd > 0) { |
| 7072 | 1229 | if(js->gc->inpa) |
| 15884 | 1230 | purple_input_remove(js->gc->inpa); |
| 7014 | 1231 | close(js->fd); |
| 1232 | } | |
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
1233 | |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
1234 | jabber_buddy_remove_all_pending_buddy_info_requests(js); |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
1235 | |
|
17810
c8d4297080cb
Fixed a leak: The XML parser was never cleaned up on disconnect.
Andreas Monitzer <am@adiumx.com>
parents:
17806
diff
changeset
|
1236 | 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
|
1237 | |
| 8312 | 1238 | if(js->iq_callbacks) |
| 1239 | g_hash_table_destroy(js->iq_callbacks); | |
| 1240 | if(js->disco_callbacks) | |
| 1241 | g_hash_table_destroy(js->disco_callbacks); | |
| 7072 | 1242 | if(js->buddies) |
| 1243 | g_hash_table_destroy(js->buddies); | |
| 1244 | if(js->chats) | |
| 1245 | g_hash_table_destroy(js->chats); | |
| 8043 | 1246 | while(js->chat_servers) { |
| 1247 | g_free(js->chat_servers->data); | |
| 1248 | js->chat_servers = g_list_delete_link(js->chat_servers, js->chat_servers); | |
| 1249 | } | |
| 11675 | 1250 | while(js->user_directories) { |
| 1251 | g_free(js->user_directories->data); | |
| 1252 | js->user_directories = g_list_delete_link(js->user_directories, js->user_directories); | |
| 1253 | } | |
| 7014 | 1254 | if(js->stream_id) |
| 1255 | g_free(js->stream_id); | |
| 7587 | 1256 | if(js->user) |
| 1257 | jabber_id_free(js->user); | |
| 10189 | 1258 | if(js->avatar_hash) |
| 1259 | g_free(js->avatar_hash); | |
| 15884 | 1260 | purple_circ_buffer_destroy(js->write_buffer); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13154
diff
changeset
|
1261 | if(js->writeh) |
| 15884 | 1262 | purple_input_remove(js->writeh); |
| 12508 | 1263 | #ifdef HAVE_CYRUS_SASL |
| 1264 | if(js->sasl) | |
| 1265 | sasl_dispose(&js->sasl); | |
| 1266 | if(js->sasl_mechs) | |
| 1267 | g_string_free(js->sasl_mechs, TRUE); | |
| 1268 | if(js->sasl_cb) | |
| 1269 | g_free(js->sasl_cb); | |
|
18449
2d2df64f4303
applied changes from f9186fabb483b56a9d7e8fb7241b2520e9930413
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18235
diff
changeset
|
1270 | #endif |
|
15800
2d0ec4fe2681
pass the correct domain to cyrus sasl (sf patch 1663064)
Nathan Walp <nwalp@pidgin.im>
parents:
15783
diff
changeset
|
1271 | if(js->serverFQDN) |
|
2d0ec4fe2681
pass the correct domain to cyrus sasl (sf patch 1663064)
Nathan Walp <nwalp@pidgin.im>
parents:
15783
diff
changeset
|
1272 | 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
|
1273 | 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
|
1274 | 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
|
1275 | 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
|
1276 | g_free(cmd->node); |
| 17827 | 1277 | 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
|
1278 | 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
|
1279 | 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
|
1280 | } |
| 15198 | 1281 | g_free(js->server_name); |
| 15225 | 1282 | g_free(js->gmail_last_time); |
| 1283 | g_free(js->gmail_last_tid); | |
|
17800
39a0f9ed0e26
Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents:
17791
diff
changeset
|
1284 | if(js->old_msg) |
|
39a0f9ed0e26
Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents:
17791
diff
changeset
|
1285 | g_free(js->old_msg); |
|
39a0f9ed0e26
Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents:
17791
diff
changeset
|
1286 | if(js->old_avatarhash) |
|
39a0f9ed0e26
Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents:
17791
diff
changeset
|
1287 | g_free(js->old_avatarhash); |
|
39a0f9ed0e26
Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents:
17791
diff
changeset
|
1288 | if(js->old_artist) |
|
39a0f9ed0e26
Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents:
17791
diff
changeset
|
1289 | g_free(js->old_artist); |
|
39a0f9ed0e26
Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents:
17791
diff
changeset
|
1290 | if(js->old_title) |
|
39a0f9ed0e26
Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents:
17791
diff
changeset
|
1291 | g_free(js->old_title); |
|
39a0f9ed0e26
Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents:
17791
diff
changeset
|
1292 | if(js->old_source) |
|
39a0f9ed0e26
Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents:
17791
diff
changeset
|
1293 | g_free(js->old_source); |
|
39a0f9ed0e26
Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents:
17791
diff
changeset
|
1294 | if(js->old_uri) |
|
39a0f9ed0e26
Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents:
17791
diff
changeset
|
1295 | g_free(js->old_uri); |
|
39a0f9ed0e26
Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents:
17791
diff
changeset
|
1296 | if(js->old_track) |
|
39a0f9ed0e26
Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents:
17791
diff
changeset
|
1297 | g_free(js->old_track); |
|
39a0f9ed0e26
Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents:
17791
diff
changeset
|
1298 | |
| 7014 | 1299 | g_free(js); |
|
11389
c1e05b75b0b0
[gaim-migrate @ 13617]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11387
diff
changeset
|
1300 | |
|
c1e05b75b0b0
[gaim-migrate @ 13617]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11387
diff
changeset
|
1301 | gc->proto_data = NULL; |
| 5093 | 1302 | } |
| 1303 | ||
| 7014 | 1304 | void jabber_stream_set_state(JabberStream *js, JabberStreamState state) |
|
3105
8c23b0ec1036
[gaim-migrate @ 3119]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3074
diff
changeset
|
1305 | { |
| 7014 | 1306 | js->state = state; |
| 1307 | switch(state) { | |
| 1308 | case JABBER_STREAM_OFFLINE: | |
| 1309 | break; | |
| 1310 | case JABBER_STREAM_CONNECTING: | |
| 15884 | 1311 | purple_connection_update_progress(js->gc, _("Connecting"), 1, |
| 7014 | 1312 | JABBER_CONNECT_STEPS); |
| 1313 | break; | |
| 1314 | case JABBER_STREAM_INITIALIZING: | |
| 15884 | 1315 | purple_connection_update_progress(js->gc, _("Initializing Stream"), |
| 7014 | 1316 | js->gsc ? 5 : 2, JABBER_CONNECT_STEPS); |
| 1317 | jabber_stream_init(js); | |
| 1318 | 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
|
1319 | 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
|
1320 | 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
|
1321 | 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
|
1322 | break; |
| 7014 | 1323 | case JABBER_STREAM_AUTHENTICATING: |
| 15884 | 1324 | 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
|
1325 | js->gsc ? 7 : 3, JABBER_CONNECT_STEPS); |
| 8296 | 1326 | if(js->protocol_version == JABBER_PROTO_0_9 && js->registration) { |
| 1327 | jabber_register_start(js); | |
| 1328 | } else if(js->auth_type == JABBER_AUTH_IQ_AUTH) { | |
| 1329 | jabber_auth_start_old(js); | |
| 8016 | 1330 | } |
| 7014 | 1331 | break; |
| 1332 | case JABBER_STREAM_REINITIALIZING: | |
| 15884 | 1333 | 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
|
1334 | (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
|
1335 | |
| 14700 | 1336 | /* The stream will be reinitialized later, in jabber_recv_cb_ssl() */ |
| 1337 | 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
|
1338 | |
| 7014 | 1339 | break; |
| 1340 | 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
|
1341 | /* now we can alert the core that we're ready to send status */ |
| 15884 | 1342 | purple_connection_set_state(js->gc, PURPLE_CONNECTED); |
| 8312 | 1343 | jabber_disco_items_server(js); |
| 7014 | 1344 | break; |
|
3105
8c23b0ec1036
[gaim-migrate @ 3119]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3074
diff
changeset
|
1345 | } |
|
8c23b0ec1036
[gaim-migrate @ 3119]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3074
diff
changeset
|
1346 | } |
|
8c23b0ec1036
[gaim-migrate @ 3119]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3074
diff
changeset
|
1347 | |
| 7014 | 1348 | char *jabber_get_next_id(JabberStream *js) |
| 2086 | 1349 | { |
| 15884 | 1350 | return g_strdup_printf("purple%x", js->next_id++); |
| 2086 | 1351 | } |
| 1352 | ||
|
14453
1cc75906700c
[gaim-migrate @ 17098]
Mark Doliner <markdoliner@pidgin.im>
parents:
14375
diff
changeset
|
1353 | |
|
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
|
1354 | void jabber_idle_set(PurpleConnection *gc, int idle) |
|
3340
7e59a209931d
[gaim-migrate @ 3359]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3337
diff
changeset
|
1355 | { |
| 7014 | 1356 | JabberStream *js = gc->proto_data; |
|
3340
7e59a209931d
[gaim-migrate @ 3359]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3337
diff
changeset
|
1357 | |
| 7014 | 1358 | js->idle = idle ? time(NULL) - idle : idle; |
|
3314
12fa45677717
[gaim-migrate @ 3332]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3311
diff
changeset
|
1359 | } |
|
12fa45677717
[gaim-migrate @ 3332]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3311
diff
changeset
|
1360 | |
|
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
|
1361 | 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
|
1362 | 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
|
1363 | |
|
854d2a4c99b6
There shouldn't be assert()s in pretty much any libpurple code.
Daniel Atallah <datallah@pidgin.im>
parents:
19993
diff
changeset
|
1364 | 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
|
1365 | 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
|
1366 | |
|
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
|
1367 | 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
|
1368 | 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
|
1369 | 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
|
1370 | feat->is_enabled = cb; |
|
17779
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1371 | |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1372 | /* 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
|
1373 | jabber_remove_feature(shortname); |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1374 | |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1375 | 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
|
1376 | } |
|
e67998927a3c
Added the ability to define extensions to caps
Andreas Monitzer <am@adiumx.com>
parents:
17769
diff
changeset
|
1377 | |
|
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
|
1378 | 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
|
1379 | GList *feature; |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1380 | 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
|
1381 | 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
|
1382 | 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
|
1383 | g_free(feat->shortname); |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1384 | g_free(feat->namespace); |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1385 | |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1386 | g_free(feature->data); |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1387 | feature = g_list_delete_link(feature, feature); |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1388 | break; |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1389 | } |
|
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17775
diff
changeset
|
1390 | } |
|
17770
e67998927a3c
Added the ability to define extensions to caps
Andreas Monitzer <am@adiumx.com>
parents:
17769
diff
changeset
|
1391 | } |
|
e67998927a3c
Added the ability to define extensions to caps
Andreas Monitzer <am@adiumx.com>
parents:
17769
diff
changeset
|
1392 | |
|
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
|
1393 | const char *jabber_list_icon(PurpleAccount *a, PurpleBuddy *b) |
| 2086 | 1394 | { |
| 4687 | 1395 | return "jabber"; |
| 1396 | } | |
| 4916 | 1397 | |
|
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
|
1398 | const char* jabber_list_emblem(PurpleBuddy *b) |
| 4916 | 1399 | { |
| 7014 | 1400 | JabberStream *js; |
|
13486
4ea1a712aaa3
[gaim-migrate @ 15861]
Daniel Atallah <datallah@pidgin.im>
parents:
13385
diff
changeset
|
1401 | JabberBuddy *jb = NULL; |
| 7014 | 1402 | |
| 1403 | if(!b->account->gc) | |
|
15558
6fb7a0ad8a0b
clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents:
15524
diff
changeset
|
1404 | return NULL; |
|
6fb7a0ad8a0b
clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents:
15524
diff
changeset
|
1405 | |
| 7014 | 1406 | js = b->account->gc->proto_data; |
|
13486
4ea1a712aaa3
[gaim-migrate @ 15861]
Daniel Atallah <datallah@pidgin.im>
parents:
13385
diff
changeset
|
1407 | if(js) |
|
4ea1a712aaa3
[gaim-migrate @ 15861]
Daniel Atallah <datallah@pidgin.im>
parents:
13385
diff
changeset
|
1408 | jb = jabber_buddy_find(js, b->name, FALSE); |
| 5135 | 1409 | |
| 15884 | 1410 | if(!PURPLE_BUDDY_IS_ONLINE(b)) { |
| 7014 | 1411 | if(jb && (jb->subscription & JABBER_SUB_PENDING || |
| 1412 | !(jb->subscription & JABBER_SUB_TO))) | |
| 15524 | 1413 | return "not-authorized"; |
| 2086 | 1414 | } |
| 15524 | 1415 | return NULL; |
| 4916 | 1416 | } |
| 2086 | 1417 | |
|
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
|
1418 | char *jabber_status_text(PurpleBuddy *b) |
|
2205
68c42ce8eba6
[gaim-migrate @ 2215]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2170
diff
changeset
|
1419 | { |
| 7014 | 1420 | 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
|
1421 | JabberBuddy *jb = NULL; |
|
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
|
1422 | |
|
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
|
1423 | if (b->account->gc && b->account->gc->proto_data) |
|
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
|
1424 | jb = jabber_buddy_find(b->account->gc->proto_data, b->name, FALSE); |
| 5234 | 1425 | |
| 15884 | 1426 | if(jb && !PURPLE_BUDDY_IS_ONLINE(b) && (jb->subscription & JABBER_SUB_PENDING || !(jb->subscription & JABBER_SUB_TO))) { |
| 7014 | 1427 | ret = g_strdup(_("Not Authorized")); |
| 15884 | 1428 | } else if(jb && !PURPLE_BUDDY_IS_ONLINE(b) && jb->error_msg) { |
| 7014 | 1429 | ret = g_strdup(jb->error_msg); |
| 2956 | 1430 | } else { |
|
7095
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7072
diff
changeset
|
1431 | char *stripped; |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7072
diff
changeset
|
1432 | |
| 15884 | 1433 | 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
|
1434 | PurplePresence *presence = purple_buddy_get_presence(b); |
|
fd63ef5027d7
Music support for Google Talk
Sean Egan <seanegan@pidgin.im>
parents:
21193
diff
changeset
|
1435 | 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
|
1436 | PurpleStatus *status = purple_presence_get_status(presence, "tune"); |
|
fd63ef5027d7
Music support for Google Talk
Sean Egan <seanegan@pidgin.im>
parents:
21193
diff
changeset
|
1437 | 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
|
1438 | } |
| 9954 | 1439 | } |
| 2086 | 1440 | |
| 7014 | 1441 | if(stripped) { |
| 1442 | ret = g_markup_escape_text(stripped, -1); | |
| 1443 | g_free(stripped); | |
| 1444 | } | |
| 2086 | 1445 | } |
| 1446 | ||
| 7014 | 1447 | return ret; |
| 2956 | 1448 | } |
| 1449 | ||
|
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
|
1450 | void jabber_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) |
| 4744 | 1451 | { |
| 11609 | 1452 | JabberBuddy *jb; |
| 1453 | ||
|
12970
c2f3b4dcf711
[gaim-migrate @ 15323]
Richard Laager <rlaager@pidgin.im>
parents:
12948
diff
changeset
|
1454 | g_return_if_fail(b != NULL); |
|
c2f3b4dcf711
[gaim-migrate @ 15323]
Richard Laager <rlaager@pidgin.im>
parents:
12948
diff
changeset
|
1455 | g_return_if_fail(b->account != NULL); |
|
c2f3b4dcf711
[gaim-migrate @ 15323]
Richard Laager <rlaager@pidgin.im>
parents:
12948
diff
changeset
|
1456 | g_return_if_fail(b->account->gc != NULL); |
|
c2f3b4dcf711
[gaim-migrate @ 15323]
Richard Laager <rlaager@pidgin.im>
parents:
12948
diff
changeset
|
1457 | g_return_if_fail(b->account->gc->proto_data != NULL); |
| 11609 | 1458 | |
| 1459 | jb = jabber_buddy_find(b->account->gc->proto_data, b->name, | |
| 7014 | 1460 | FALSE); |
| 1461 | ||
| 8194 | 1462 | if(jb) { |
| 11609 | 1463 | JabberBuddyResource *jbr = NULL; |
|
21195
fd63ef5027d7
Music support for Google Talk
Sean Egan <seanegan@pidgin.im>
parents:
21193
diff
changeset
|
1464 | PurplePresence *presence = purple_buddy_get_presence(b); |
| 8194 | 1465 | const char *sub; |
| 11609 | 1466 | GList *l; |
|
19920
7b0d20da73d0
Don't put "Mood: \(null\) \(null\)" on XMPP buddies
Sean Egan <seanegan@pidgin.im>
parents:
19897
diff
changeset
|
1467 | const char *mood; |
| 11609 | 1468 | |
|
12948
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1469 | 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
|
1470 | PurpleStatus *status; |
|
749862fd4a87
Fixed a few small mistakes I discovered while testing user mood in Adium.
Andreas Monitzer <am@adiumx.com>
parents:
17779
diff
changeset
|
1471 | PurpleValue *value; |
|
749862fd4a87
Fixed a few small mistakes I discovered while testing user mood in Adium.
Andreas Monitzer <am@adiumx.com>
parents:
17779
diff
changeset
|
1472 | |
|
12948
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1473 | if(jb->subscription & JABBER_SUB_FROM) { |
|
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1474 | if(jb->subscription & JABBER_SUB_TO) |
|
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1475 | sub = _("Both"); |
|
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1476 | else if(jb->subscription & JABBER_SUB_PENDING) |
|
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1477 | sub = _("From (To pending)"); |
|
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1478 | else |
|
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1479 | sub = _("From"); |
|
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1480 | } else { |
|
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1481 | if(jb->subscription & JABBER_SUB_TO) |
|
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1482 | sub = _("To"); |
|
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1483 | else if(jb->subscription & JABBER_SUB_PENDING) |
|
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1484 | sub = _("None (To pending)"); |
|
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1485 | else |
|
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1486 | sub = _("None"); |
|
0867a553ed26
[gaim-migrate @ 15301]
Richard Laager <rlaager@pidgin.im>
parents:
12944
diff
changeset
|
1487 | } |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15198
diff
changeset
|
1488 | |
| 15884 | 1489 | purple_notify_user_info_add_pair(user_info, _("Subscription"), sub); |
|
17780
749862fd4a87
Fixed a few small mistakes I discovered while testing user mood in Adium.
Andreas Monitzer <am@adiumx.com>
parents:
17779
diff
changeset
|
1490 | |
|
21195
fd63ef5027d7
Music support for Google Talk
Sean Egan <seanegan@pidgin.im>
parents:
21193
diff
changeset
|
1491 | status = purple_presence_get_active_status(presence); |
|
17780
749862fd4a87
Fixed a few small mistakes I discovered while testing user mood in Adium.
Andreas Monitzer <am@adiumx.com>
parents:
17779
diff
changeset
|
1492 | value = purple_status_get_attr_value(status, "mood"); |
|
19920
7b0d20da73d0
Don't put "Mood: \(null\) \(null\)" on XMPP buddies
Sean Egan <seanegan@pidgin.im>
parents:
19897
diff
changeset
|
1493 | if (value && purple_value_get_type(value) == PURPLE_TYPE_STRING && (mood = purple_value_get_string(value))) { |
|
17780
749862fd4a87
Fixed a few small mistakes I discovered while testing user mood in Adium.
Andreas Monitzer <am@adiumx.com>
parents:
17779
diff
changeset
|
1494 | |
|
749862fd4a87
Fixed a few small mistakes I discovered while testing user mood in Adium.
Andreas Monitzer <am@adiumx.com>
parents:
17779
diff
changeset
|
1495 | value = purple_status_get_attr_value(status, "moodtext"); |
|
749862fd4a87
Fixed a few small mistakes I discovered while testing user mood in Adium.
Andreas Monitzer <am@adiumx.com>
parents:
17779
diff
changeset
|
1496 | if(value && purple_value_get_type(value) == PURPLE_TYPE_STRING) { |
|
749862fd4a87
Fixed a few small mistakes I discovered while testing user mood in Adium.
Andreas Monitzer <am@adiumx.com>
parents:
17779
diff
changeset
|
1497 | char *moodplustext = g_strdup_printf("%s (%s)",mood,purple_value_get_string(value)); |
|
749862fd4a87
Fixed a few small mistakes I discovered while testing user mood in Adium.
Andreas Monitzer <am@adiumx.com>
parents:
17779
diff
changeset
|
1498 | |
|
749862fd4a87
Fixed a few small mistakes I discovered while testing user mood in Adium.
Andreas Monitzer <am@adiumx.com>
parents:
17779
diff
changeset
|
1499 | 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
|
1500 | 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
|
1501 | } else |
|
749862fd4a87
Fixed a few small mistakes I discovered while testing user mood in Adium.
Andreas Monitzer <am@adiumx.com>
parents:
17779
diff
changeset
|
1502 | 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
|
1503 | } |
|
fd63ef5027d7
Music support for Google Talk
Sean Egan <seanegan@pidgin.im>
parents:
21193
diff
changeset
|
1504 | 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
|
1505 | PurpleStatus *tune = purple_presence_get_status(presence, "tune"); |
|
fd63ef5027d7
Music support for Google Talk
Sean Egan <seanegan@pidgin.im>
parents:
21193
diff
changeset
|
1506 | const char *title = purple_status_get_attr_string(tune, PURPLE_TUNE_TITLE); |
|
fd63ef5027d7
Music support for Google Talk
Sean Egan <seanegan@pidgin.im>
parents:
21193
diff
changeset
|
1507 | purple_notify_user_info_add_pair(user_info, _("Current media"), title); |
|
fd63ef5027d7
Music support for Google Talk
Sean Egan <seanegan@pidgin.im>
parents:
21193
diff
changeset
|
1508 | } |
| 8194 | 1509 | } |
| 1510 | ||
| 11609 | 1511 | for(l=jb->resources; l; l = l->next) { |
| 8194 | 1512 | char *text = NULL; |
| 11609 | 1513 | char *res = NULL; |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15198
diff
changeset
|
1514 | char *label, *value; |
|
12944
da8f60d43d88
[gaim-migrate @ 15297]
Richard Laager <rlaager@pidgin.im>
parents:
12943
diff
changeset
|
1515 | const char *state; |
| 11609 | 1516 | |
| 1517 | jbr = l->data; | |
| 1518 | ||
| 8194 | 1519 | if(jbr->status) { |
| 11646 | 1520 | char *tmp; |
| 15884 | 1521 | text = purple_strreplace(jbr->status, "\n", "<br />\n"); |
| 1522 | tmp = purple_markup_strip_html(text); | |
| 11646 | 1523 | g_free(text); |
| 1524 | text = g_markup_escape_text(tmp, -1); | |
| 1525 | g_free(tmp); | |
| 8194 | 1526 | } |
| 1527 | ||
| 11609 | 1528 | if(jbr->name) |
| 11610 | 1529 | res = g_strdup_printf(" (%s)", jbr->name); |
| 11609 | 1530 | |
|
12944
da8f60d43d88
[gaim-migrate @ 15297]
Richard Laager <rlaager@pidgin.im>
parents:
12943
diff
changeset
|
1531 | state = jabber_buddy_state_get_name(jbr->state); |
| 15884 | 1532 | if (text != NULL && !purple_utf8_strcasecmp(state, text)) { |
|
12944
da8f60d43d88
[gaim-migrate @ 15297]
Richard Laager <rlaager@pidgin.im>
parents:
12943
diff
changeset
|
1533 | g_free(text); |
|
da8f60d43d88
[gaim-migrate @ 15297]
Richard Laager <rlaager@pidgin.im>
parents:
12943
diff
changeset
|
1534 | text = NULL; |
|
da8f60d43d88
[gaim-migrate @ 15297]
Richard Laager <rlaager@pidgin.im>
parents:
12943
diff
changeset
|
1535 | } |
|
da8f60d43d88
[gaim-migrate @ 15297]
Richard Laager <rlaager@pidgin.im>
parents:
12943
diff
changeset
|
1536 | |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15198
diff
changeset
|
1537 | label = g_strdup_printf("%s%s", |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15198
diff
changeset
|
1538 | _("Status"), (res ? res : "")); |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15198
diff
changeset
|
1539 | value = g_strdup_printf("%s%s%s", |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15198
diff
changeset
|
1540 | state, |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15198
diff
changeset
|
1541 | (text ? ": " : ""), |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15198
diff
changeset
|
1542 | (text ? text : "")); |
|
12944
da8f60d43d88
[gaim-migrate @ 15297]
Richard Laager <rlaager@pidgin.im>
parents:
12943
diff
changeset
|
1543 | |
| 15884 | 1544 | purple_notify_user_info_add_pair(user_info, label, value); |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15198
diff
changeset
|
1545 | |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15198
diff
changeset
|
1546 | g_free(label); |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15198
diff
changeset
|
1547 | g_free(value); |
|
12944
da8f60d43d88
[gaim-migrate @ 15297]
Richard Laager <rlaager@pidgin.im>
parents:
12943
diff
changeset
|
1548 | g_free(text); |
|
da8f60d43d88
[gaim-migrate @ 15297]
Richard Laager <rlaager@pidgin.im>
parents:
12943
diff
changeset
|
1549 | g_free(res); |
| 11609 | 1550 | } |
| 1551 | ||
| 15884 | 1552 | if(!PURPLE_BUDDY_IS_ONLINE(b) && jb->error_msg) { |
| 1553 | purple_notify_user_info_add_pair(user_info, _("Error"), jb->error_msg); | |
| 8194 | 1554 | } |
| 4745 | 1555 | } |
| 4732 | 1556 | } |
| 1557 | ||
|
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
|
1558 | GList *jabber_status_types(PurpleAccount *account) |
| 7014 | 1559 | { |
| 15884 | 1560 | PurpleStatusType *type; |
| 9954 | 1561 | GList *types = NULL; |
| 15884 | 1562 | PurpleValue *priority_value; |
| 9954 | 1563 | |
| 15884 | 1564 | priority_value = purple_value_new(PURPLE_TYPE_INT); |
| 1565 | purple_value_set_int(priority_value, 1); | |
| 1566 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, | |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1567 | jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_ONLINE), |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1568 | NULL, TRUE, TRUE, FALSE, |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1569 | "priority", _("Priority"), priority_value, |
| 15884 | 1570 | "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
|
1571 | "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
|
1572 | "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
|
1573 | "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), |
|
17824
52683dfc1f7d
Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <am@adiumx.com>
parents:
17823
diff
changeset
|
1574 | "buzz", _("Allow Buzz"), purple_value_new(PURPLE_TYPE_BOOLEAN), |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1575 | NULL); |
| 9980 | 1576 | types = g_list_append(types, type); |
| 1577 | ||
| 15884 | 1578 | priority_value = purple_value_new(PURPLE_TYPE_INT); |
| 1579 | purple_value_set_int(priority_value, 1); | |
| 1580 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, | |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1581 | jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_CHAT), |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1582 | _("Chatty"), TRUE, TRUE, FALSE, |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1583 | "priority", _("Priority"), priority_value, |
| 15884 | 1584 | "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
|
1585 | "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
|
1586 | "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
|
1587 | "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), |
|
17824
52683dfc1f7d
Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <am@adiumx.com>
parents:
17823
diff
changeset
|
1588 | "buzz", _("Allow Buzz"), purple_value_new(PURPLE_TYPE_BOOLEAN), |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1589 | NULL); |
| 9954 | 1590 | types = g_list_append(types, type); |
| 2086 | 1591 | |
| 15884 | 1592 | priority_value = purple_value_new(PURPLE_TYPE_INT); |
| 1593 | purple_value_set_int(priority_value, 0); | |
| 1594 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, | |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1595 | jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_AWAY), |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1596 | NULL, TRUE, TRUE, FALSE, |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1597 | "priority", _("Priority"), priority_value, |
| 15884 | 1598 | "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
|
1599 | "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
|
1600 | "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
|
1601 | "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), |
|
17824
52683dfc1f7d
Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <am@adiumx.com>
parents:
17823
diff
changeset
|
1602 | "buzz", _("Allow Buzz"), purple_value_new(PURPLE_TYPE_BOOLEAN), |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1603 | NULL); |
| 9954 | 1604 | types = g_list_append(types, type); |
| 1605 | ||
| 15884 | 1606 | priority_value = purple_value_new(PURPLE_TYPE_INT); |
| 1607 | purple_value_set_int(priority_value, 0); | |
| 1608 | 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
|
1609 | jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_XA), |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1610 | NULL, TRUE, TRUE, FALSE, |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1611 | "priority", _("Priority"), priority_value, |
| 15884 | 1612 | "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
|
1613 | "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
|
1614 | "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
|
1615 | "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), |
|
17824
52683dfc1f7d
Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <am@adiumx.com>
parents:
17823
diff
changeset
|
1616 | "buzz", _("Allow Buzz"), purple_value_new(PURPLE_TYPE_BOOLEAN), |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1617 | NULL); |
| 9954 | 1618 | types = g_list_append(types, type); |
| 1619 | ||
| 15884 | 1620 | priority_value = purple_value_new(PURPLE_TYPE_INT); |
| 1621 | purple_value_set_int(priority_value, 0); | |
| 1622 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_UNAVAILABLE, | |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1623 | jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_DND), |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1624 | _("Do Not Disturb"), TRUE, TRUE, FALSE, |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1625 | "priority", _("Priority"), priority_value, |
| 15884 | 1626 | "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
|
1627 | "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
|
1628 | "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
|
1629 | "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), |
|
17824
52683dfc1f7d
Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <am@adiumx.com>
parents:
17823
diff
changeset
|
1630 | "buzz", _("Allow Buzz"), purple_value_new(PURPLE_TYPE_BOOLEAN), |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12554
diff
changeset
|
1631 | NULL); |
| 9954 | 1632 | types = g_list_append(types, type); |
| 1633 | ||
| 1634 | /* | |
| 8166 | 1635 | if(js->protocol_version == JABBER_PROTO_0_9) |
| 1636 | m = g_list_append(m, _("Invisible")); | |
|
10009
8a4fcc043f47
[gaim-migrate @ 10926]
Mark Doliner <markdoliner@pidgin.im>
parents:
9980
diff
changeset
|
1637 | */ |
| 2086 | 1638 | |
| 15884 | 1639 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_OFFLINE, |
|
12658
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12646
diff
changeset
|
1640 | jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_UNAVAILABLE), |
|
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12646
diff
changeset
|
1641 | NULL, FALSE, TRUE, FALSE, |
| 15884 | 1642 | "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), |
|
12658
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12646
diff
changeset
|
1643 | NULL); |
|
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12646
diff
changeset
|
1644 | types = g_list_append(types, type); |
|
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12646
diff
changeset
|
1645 | |
|
21193
e918a1846d03
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20332
diff
changeset
|
1646 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_TUNE, |
|
21199
346f83590d69
Is there any reason these statuses were set to not saveable and
Mark Doliner <markdoliner@pidgin.im>
parents:
21195
diff
changeset
|
1647 | "tune", NULL, TRUE, 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
|
1648 | 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
|
1649 | 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
|
1650 | 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
|
1651 | 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
|
1652 | 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
|
1653 | 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
|
1654 | 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
|
1655 | 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
|
1656 | 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
|
1657 | NULL); |
|
e918a1846d03
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20332
diff
changeset
|
1658 | 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
|
1659 | |
| 9954 | 1660 | return types; |
| 2086 | 1661 | } |
| 1662 | ||
| 7395 | 1663 | static void |
| 1664 | jabber_password_change_result_cb(JabberStream *js, xmlnode *packet, | |
| 1665 | gpointer data) | |
| 7124 | 1666 | { |
| 1667 | const char *type; | |
| 1668 | ||
| 1669 | type = xmlnode_get_attrib(packet, "type"); | |
| 1670 | ||
| 9414 | 1671 | if(type && !strcmp(type, "result")) { |
| 15884 | 1672 | purple_notify_info(js->gc, _("Password Changed"), _("Password Changed"), |
| 7124 | 1673 | _("Your password has been changed.")); |
| 1674 | } else { | |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
1675 | char *msg = jabber_parse_error(js, packet, NULL); |
| 7124 | 1676 | |
| 15884 | 1677 | purple_notify_error(js->gc, _("Error changing password"), |
| 8401 | 1678 | _("Error changing password"), msg); |
| 1679 | g_free(msg); | |
| 7124 | 1680 | } |
| 1681 | } | |
| 1682 | ||
| 1683 | static void jabber_password_change_cb(JabberStream *js, | |
| 15884 | 1684 | PurpleRequestFields *fields) |
| 7124 | 1685 | { |
| 1686 | const char *p1, *p2; | |
| 1687 | JabberIq *iq; | |
| 1688 | xmlnode *query, *y; | |
| 1689 | ||
| 15884 | 1690 | p1 = purple_request_fields_get_string(fields, "password1"); |
| 1691 | p2 = purple_request_fields_get_string(fields, "password2"); | |
| 7124 | 1692 | |
| 1693 | if(strcmp(p1, p2)) { | |
| 15884 | 1694 | purple_notify_error(js->gc, NULL, _("New passwords do not match."), NULL); |
| 7124 | 1695 | return; |
| 1696 | } | |
| 1697 | ||
| 1698 | iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register"); | |
| 1699 | ||
| 1700 | xmlnode_set_attrib(iq->node, "to", js->user->domain); | |
| 1701 | ||
| 1702 | query = xmlnode_get_child(iq->node, "query"); | |
| 1703 | ||
| 1704 | y = xmlnode_new_child(query, "username"); | |
| 1705 | xmlnode_insert_data(y, js->user->node, -1); | |
| 1706 | y = xmlnode_new_child(query, "password"); | |
| 1707 | xmlnode_insert_data(y, p1, -1); | |
| 1708 | ||
| 7395 | 1709 | jabber_iq_set_callback(iq, jabber_password_change_result_cb, NULL); |
| 7124 | 1710 | |
| 1711 | jabber_iq_send(iq); | |
| 1712 | ||
| 15884 | 1713 | purple_account_set_password(js->gc->account, p1); |
| 7124 | 1714 | } |
| 1715 | ||
| 15884 | 1716 | static void jabber_password_change(PurplePluginAction *action) |
| 7124 | 1717 | { |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
1718 | |
| 15884 | 1719 | PurpleConnection *gc = (PurpleConnection *) action->context; |
| 7124 | 1720 | JabberStream *js = gc->proto_data; |
| 15884 | 1721 | PurpleRequestFields *fields; |
| 1722 | PurpleRequestFieldGroup *group; | |
| 1723 | PurpleRequestField *field; | |
| 7124 | 1724 | |
| 15884 | 1725 | fields = purple_request_fields_new(); |
| 1726 | group = purple_request_field_group_new(NULL); | |
| 1727 | purple_request_fields_add_group(fields, group); | |
| 7124 | 1728 | |
| 15884 | 1729 | field = purple_request_field_string_new("password1", _("Password"), |
| 7124 | 1730 | "", FALSE); |
| 15884 | 1731 | 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
|
1732 | purple_request_field_set_required(field, TRUE); |
| 15884 | 1733 | purple_request_field_group_add_field(group, field); |
| 7124 | 1734 | |
| 15884 | 1735 | field = purple_request_field_string_new("password2", _("Password (again)"), |
| 7124 | 1736 | "", FALSE); |
| 15884 | 1737 | 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
|
1738 | purple_request_field_set_required(field, TRUE); |
| 15884 | 1739 | purple_request_field_group_add_field(group, field); |
| 7124 | 1740 | |
|
16961
b6955f946f8f
s/Jabber/XMPP in user-visible places.
Richard Laager <rlaager@pidgin.im>
parents:
16847
diff
changeset
|
1741 | purple_request_fields(js->gc, _("Change XMPP Password"), |
|
b6955f946f8f
s/Jabber/XMPP in user-visible places.
Richard Laager <rlaager@pidgin.im>
parents:
16847
diff
changeset
|
1742 | _("Change XMPP Password"), _("Please enter your new password"), |
| 7124 | 1743 | 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
|
1744 | _("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
|
1745 | purple_connection_get_account(gc), NULL, NULL, |
|
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
|
1746 | js); |
| 7124 | 1747 | } |
| 1748 | ||
|
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
|
1749 | GList *jabber_actions(PurplePlugin *plugin, gpointer context) |
| 2956 | 1750 | { |
|
17782
83af68644d0a
Implemented a mood menu action (non-functional right now for some reason)
Andreas Monitzer <am@adiumx.com>
parents:
17780
diff
changeset
|
1751 | 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
|
1752 | JabberStream *js = gc->proto_data; |
| 2956 | 1753 | GList *m = NULL; |
| 15884 | 1754 | PurplePluginAction *act; |
|
4333
f4c095774bc2
[gaim-migrate @ 4597]
Mark Doliner <markdoliner@pidgin.im>
parents:
4316
diff
changeset
|
1755 | |
| 15884 | 1756 | act = purple_plugin_action_new(_("Set User Info..."), |
| 12286 | 1757 | jabber_setup_set_info); |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
1758 | m = g_list_append(m, act); |
|
4333
f4c095774bc2
[gaim-migrate @ 4597]
Mark Doliner <markdoliner@pidgin.im>
parents:
4316
diff
changeset
|
1759 | |
| 8296 | 1760 | /* if (js->protocol_options & CHANGE_PASSWORD) { */ |
| 15884 | 1761 | act = purple_plugin_action_new(_("Change Password..."), |
| 12286 | 1762 | jabber_password_change); |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
1763 | m = g_list_append(m, act); |
| 8296 | 1764 | /* } */ |
| 2956 | 1765 | |
| 15884 | 1766 | act = purple_plugin_action_new(_("Search for Users..."), |
| 12286 | 1767 | jabber_user_search_begin); |
| 11675 | 1768 | m = g_list_append(m, act); |
| 1769 | ||
|
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
|
1770 | 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
|
1771 | |
|
17782
83af68644d0a
Implemented a mood menu action (non-functional right now for some reason)
Andreas Monitzer <am@adiumx.com>
parents:
17780
diff
changeset
|
1772 | 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
|
1773 | jabber_pep_init_actions(&m); |
|
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
|
1774 | |
|
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
|
1775 | 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
|
1776 | jabber_adhoc_init_server_commands(js, &m); |
| 11675 | 1777 | |
| 2956 | 1778 | return m; |
| 1779 | } | |
| 1780 | ||
|
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
|
1781 | PurpleChat *jabber_find_blist_chat(PurpleAccount *account, const char *name) |
| 7999 | 1782 | { |
| 15884 | 1783 | PurpleBlistNode *gnode, *cnode; |
| 7999 | 1784 | JabberID *jid; |
| 1785 | ||
| 1786 | if(!(jid = jabber_id_new(name))) | |
| 1787 | return NULL; | |
| 1788 | ||
| 15884 | 1789 | for(gnode = purple_get_blist()->root; gnode; gnode = gnode->next) { |
| 7999 | 1790 | for(cnode = gnode->child; cnode; cnode = cnode->next) { |
| 15884 | 1791 | PurpleChat *chat = (PurpleChat*)cnode; |
| 7999 | 1792 | const char *room, *server; |
| 15884 | 1793 | if(!PURPLE_BLIST_NODE_IS_CHAT(cnode)) |
| 7999 | 1794 | continue; |
| 1795 | ||
| 1796 | if(chat->account != account) | |
| 8011 | 1797 | continue; |
| 7999 | 1798 | |
| 1799 | if(!(room = g_hash_table_lookup(chat->components, "room"))) | |
| 1800 | continue; | |
| 1801 | if(!(server = g_hash_table_lookup(chat->components, "server"))) | |
| 1802 | continue; | |
| 1803 | ||
| 8158 | 1804 | if(jid->node && jid->domain && |
| 1805 | !g_utf8_collate(room, jid->node) && !g_utf8_collate(server, jid->domain)) { | |
| 7999 | 1806 | jabber_id_free(jid); |
| 1807 | return chat; | |
| 1808 | } | |
| 1809 | } | |
| 1810 | } | |
| 1811 | jabber_id_free(jid); | |
| 1812 | return NULL; | |
| 1813 | } | |
| 1814 | ||
|
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
|
1815 | void jabber_convo_closed(PurpleConnection *gc, const char *who) |
| 8400 | 1816 | { |
| 1817 | JabberStream *js = gc->proto_data; | |
| 1818 | JabberID *jid; | |
| 1819 | JabberBuddy *jb; | |
| 1820 | JabberBuddyResource *jbr; | |
| 1821 | ||
| 1822 | if(!(jid = jabber_id_new(who))) | |
| 1823 | return; | |
| 1824 | ||
| 1825 | if((jb = jabber_buddy_find(js, who, TRUE)) && | |
| 1826 | (jbr = jabber_buddy_find_resource(jb, jid->resource))) { | |
| 1827 | if(jbr->thread_id) { | |
| 1828 | g_free(jbr->thread_id); | |
| 1829 | jbr->thread_id = NULL; | |
| 1830 | } | |
|
15709
b58646e3ce63
Sending XEP 85 'gone' messages
Sean Egan <seanegan@pidgin.im>
parents:
15668
diff
changeset
|
1831 | if(jbr->chat_states == JABBER_CHAT_STATES_SUPPORTED) |
|
b58646e3ce63
Sending XEP 85 'gone' messages
Sean Egan <seanegan@pidgin.im>
parents:
15668
diff
changeset
|
1832 | jabber_message_conv_closed(js, who); |
| 8400 | 1833 | } |
| 1834 | ||
| 1835 | jabber_id_free(jid); | |
| 1836 | } | |
| 1837 | ||
| 8401 | 1838 | |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
1839 | 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
|
1840 | xmlnode *packet, |
| 21279 | 1841 | PurpleConnectionError *reason) |
| 8401 | 1842 | { |
| 1843 | xmlnode *error; | |
| 1844 | const char *code = NULL, *text = NULL; | |
| 13808 | 1845 | const char *xmlns = xmlnode_get_namespace(packet); |
| 8401 | 1846 | char *cdata = NULL; |
| 1847 | ||
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
1848 | #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
|
1849 | 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
|
1850 | |
| 8401 | 1851 | if((error = xmlnode_get_child(packet, "error"))) { |
| 1852 | cdata = xmlnode_get_data(error); | |
| 1853 | code = xmlnode_get_attrib(error, "code"); | |
| 1854 | ||
| 1855 | /* Stanza errors */ | |
| 1856 | if(xmlnode_get_child(error, "bad-request")) { | |
| 1857 | text = _("Bad Request"); | |
| 1858 | } else if(xmlnode_get_child(error, "conflict")) { | |
| 1859 | text = _("Conflict"); | |
| 1860 | } else if(xmlnode_get_child(error, "feature-not-implemented")) { | |
| 1861 | text = _("Feature Not Implemented"); | |
| 1862 | } else if(xmlnode_get_child(error, "forbidden")) { | |
| 1863 | text = _("Forbidden"); | |
| 1864 | } else if(xmlnode_get_child(error, "gone")) { | |
| 1865 | text = _("Gone"); | |
| 1866 | } else if(xmlnode_get_child(error, "internal-server-error")) { | |
| 1867 | text = _("Internal Server Error"); | |
| 1868 | } else if(xmlnode_get_child(error, "item-not-found")) { | |
| 1869 | text = _("Item Not Found"); | |
| 1870 | } 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
|
1871 | text = _("Malformed XMPP ID"); |
| 8401 | 1872 | } else if(xmlnode_get_child(error, "not-acceptable")) { |
| 1873 | text = _("Not Acceptable"); | |
| 1874 | } else if(xmlnode_get_child(error, "not-allowed")) { | |
| 1875 | text = _("Not Allowed"); | |
| 1876 | } else if(xmlnode_get_child(error, "not-authorized")) { | |
| 1877 | text = _("Not Authorized"); | |
| 1878 | } else if(xmlnode_get_child(error, "payment-required")) { | |
| 1879 | text = _("Payment Required"); | |
| 1880 | } else if(xmlnode_get_child(error, "recipient-unavailable")) { | |
| 1881 | text = _("Recipient Unavailable"); | |
| 1882 | } else if(xmlnode_get_child(error, "redirect")) { | |
| 1883 | /* XXX */ | |
| 1884 | } else if(xmlnode_get_child(error, "registration-required")) { | |
| 1885 | text = _("Registration Required"); | |
| 1886 | } else if(xmlnode_get_child(error, "remote-server-not-found")) { | |
| 1887 | text = _("Remote Server Not Found"); | |
| 1888 | } else if(xmlnode_get_child(error, "remote-server-timeout")) { | |
| 1889 | text = _("Remote Server Timeout"); | |
| 1890 | } else if(xmlnode_get_child(error, "resource-constraint")) { | |
| 1891 | text = _("Server Overloaded"); | |
| 1892 | } else if(xmlnode_get_child(error, "service-unavailable")) { | |
| 1893 | text = _("Service Unavailable"); | |
| 1894 | } else if(xmlnode_get_child(error, "subscription-required")) { | |
| 1895 | text = _("Subscription Required"); | |
| 1896 | } else if(xmlnode_get_child(error, "unexpected-request")) { | |
| 1897 | text = _("Unexpected Request"); | |
| 1898 | } else if(xmlnode_get_child(error, "undefined-condition")) { | |
| 1899 | text = _("Unknown Error"); | |
| 1900 | } | |
| 1901 | } 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
|
1902 | /* Most common reason can be the default */ |
| 21279 | 1903 | SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED); |
| 8401 | 1904 | if(xmlnode_get_child(packet, "aborted")) { |
| 1905 | text = _("Authorization Aborted"); | |
| 13806 | 1906 | } else if(xmlnode_get_child(packet, "incorrect-encoding")) { |
| 21279 | 1907 | SET_REASON(PURPLE_CONNECTION_ERROR_NETWORK_ERROR); |
| 8401 | 1908 | text = _("Incorrect encoding in authorization"); |
| 13806 | 1909 | } else if(xmlnode_get_child(packet, "invalid-authzid")) { |
| 8401 | 1910 | text = _("Invalid authzid"); |
| 13806 | 1911 | } else if(xmlnode_get_child(packet, "invalid-mechanism")) { |
| 8401 | 1912 | text = _("Invalid Authorization Mechanism"); |
| 13806 | 1913 | } else if(xmlnode_get_child(packet, "mechanism-too-weak")) { |
| 8401 | 1914 | text = _("Authorization mechanism too weak"); |
| 13806 | 1915 | } else if(xmlnode_get_child(packet, "not-authorized")) { |
|
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
|
1916 | /* 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
|
1917 | 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
|
1918 | purple_account_set_password(js->gc->account, NULL); |
| 8401 | 1919 | text = _("Not Authorized"); |
| 13806 | 1920 | } else if(xmlnode_get_child(packet, "temporary-auth-failure")) { |
| 21279 | 1921 | SET_REASON(PURPLE_CONNECTION_ERROR_NETWORK_ERROR); |
| 8401 | 1922 | text = _("Temporary Authentication Failure"); |
| 1923 | } else { | |
| 1924 | text = _("Authentication Failure"); | |
| 1925 | } | |
|
15979
acfbd09bc217
Correctly handle the Jabber disconnection error for signing onto the
Mark Doliner <markdoliner@pidgin.im>
parents:
15977
diff
changeset
|
1926 | } 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
|
1927 | (!strcmp(packet->name, "error") && xmlns && |
| 15980 | 1928 | !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
|
1929 | /* Most common reason as default: */ |
| 21279 | 1930 | SET_REASON(PURPLE_CONNECTION_ERROR_NETWORK_ERROR); |
| 8402 | 1931 | if(xmlnode_get_child(packet, "bad-format")) { |
| 1932 | text = _("Bad Format"); | |
| 1933 | } else if(xmlnode_get_child(packet, "bad-namespace-prefix")) { | |
| 1934 | text = _("Bad Namespace Prefix"); | |
| 1935 | } else if(xmlnode_get_child(packet, "conflict")) { | |
| 21279 | 1936 | SET_REASON(PURPLE_CONNECTION_ERROR_NAME_IN_USE); |
| 8402 | 1937 | text = _("Resource Conflict"); |
| 1938 | } else if(xmlnode_get_child(packet, "connection-timeout")) { | |
| 1939 | text = _("Connection Timeout"); | |
| 1940 | } else if(xmlnode_get_child(packet, "host-gone")) { | |
| 1941 | text = _("Host Gone"); | |
| 1942 | } else if(xmlnode_get_child(packet, "host-unknown")) { | |
| 1943 | text = _("Host Unknown"); | |
| 1944 | } else if(xmlnode_get_child(packet, "improper-addressing")) { | |
| 1945 | text = _("Improper Addressing"); | |
| 1946 | } else if(xmlnode_get_child(packet, "internal-server-error")) { | |
| 1947 | text = _("Internal Server Error"); | |
| 1948 | } else if(xmlnode_get_child(packet, "invalid-id")) { | |
| 1949 | text = _("Invalid ID"); | |
| 1950 | } else if(xmlnode_get_child(packet, "invalid-namespace")) { | |
| 1951 | text = _("Invalid Namespace"); | |
| 1952 | } else if(xmlnode_get_child(packet, "invalid-xml")) { | |
| 1953 | text = _("Invalid XML"); | |
| 1954 | } else if(xmlnode_get_child(packet, "nonmatching-hosts")) { | |
| 1955 | text = _("Non-matching Hosts"); | |
| 1956 | } else if(xmlnode_get_child(packet, "not-authorized")) { | |
| 1957 | text = _("Not Authorized"); | |
| 1958 | } else if(xmlnode_get_child(packet, "policy-violation")) { | |
| 1959 | text = _("Policy Violation"); | |
| 1960 | } else if(xmlnode_get_child(packet, "remote-connection-failed")) { | |
| 1961 | text = _("Remote Connection Failed"); | |
| 1962 | } else if(xmlnode_get_child(packet, "resource-constraint")) { | |
| 1963 | text = _("Resource Constraint"); | |
| 1964 | } else if(xmlnode_get_child(packet, "restricted-xml")) { | |
| 1965 | text = _("Restricted XML"); | |
| 1966 | } else if(xmlnode_get_child(packet, "see-other-host")) { | |
| 1967 | text = _("See Other Host"); | |
| 1968 | } else if(xmlnode_get_child(packet, "system-shutdown")) { | |
| 1969 | text = _("System Shutdown"); | |
| 1970 | } else if(xmlnode_get_child(packet, "undefined-condition")) { | |
| 1971 | text = _("Undefined Condition"); | |
| 1972 | } else if(xmlnode_get_child(packet, "unsupported-encoding")) { | |
| 1973 | text = _("Unsupported Encoding"); | |
| 1974 | } else if(xmlnode_get_child(packet, "unsupported-stanza-type")) { | |
| 1975 | text = _("Unsupported Stanza Type"); | |
| 1976 | } else if(xmlnode_get_child(packet, "unsupported-version")) { | |
| 1977 | text = _("Unsupported Version"); | |
| 1978 | } else if(xmlnode_get_child(packet, "xml-not-well-formed")) { | |
| 1979 | text = _("XML Not Well Formed"); | |
| 1980 | } else { | |
| 1981 | text = _("Stream Error"); | |
| 1982 | } | |
| 8401 | 1983 | } |
| 1984 | ||
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
1985 | #undef SET_REASON |
|
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
1986 | |
| 8401 | 1987 | if(text || cdata) { |
| 1988 | char *ret = g_strdup_printf("%s%s%s", code ? code : "", | |
| 1989 | code ? ": " : "", text ? text : cdata); | |
| 1990 | g_free(cdata); | |
| 1991 | return ret; | |
| 1992 | } else { | |
| 1993 | return NULL; | |
| 1994 | } | |
| 1995 | } | |
| 1996 | ||
| 15884 | 1997 | static PurpleCmdRet jabber_cmd_chat_config(PurpleConversation *conv, |
| 9597 | 1998 | const char *cmd, char **args, char **error, void *data) |
| 9130 | 1999 | { |
| 2000 | 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
|
2001 | |
|
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2002 | 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
|
2003 | 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
|
2004 | |
| 9130 | 2005 | jabber_chat_request_room_configure(chat); |
| 15884 | 2006 | return PURPLE_CMD_RET_OK; |
| 9130 | 2007 | } |
| 2008 | ||
| 15884 | 2009 | static PurpleCmdRet jabber_cmd_chat_register(PurpleConversation *conv, |
| 9597 | 2010 | const char *cmd, char **args, char **error, void *data) |
| 9130 | 2011 | { |
| 2012 | 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
|
2013 | |
|
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2014 | 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
|
2015 | 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
|
2016 | |
| 9130 | 2017 | jabber_chat_register(chat); |
| 15884 | 2018 | return PURPLE_CMD_RET_OK; |
| 9130 | 2019 | } |
| 2020 | ||
| 15884 | 2021 | static PurpleCmdRet jabber_cmd_chat_topic(PurpleConversation *conv, |
| 9597 | 2022 | const char *cmd, char **args, char **error, void *data) |
| 9130 | 2023 | { |
| 2024 | 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
|
2025 | |
|
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2026 | 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
|
2027 | 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
|
2028 | |
| 9130 | 2029 | jabber_chat_change_topic(chat, args ? args[0] : NULL); |
| 15884 | 2030 | return PURPLE_CMD_RET_OK; |
| 9130 | 2031 | } |
| 2032 | ||
| 15884 | 2033 | static PurpleCmdRet jabber_cmd_chat_nick(PurpleConversation *conv, |
| 9597 | 2034 | const char *cmd, char **args, char **error, void *data) |
| 9130 | 2035 | { |
| 2036 | JabberChat *chat = jabber_chat_find_by_conv(conv); | |
| 2037 | ||
|
18986
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2038 | if(!chat || !args || !args[0]) |
| 15884 | 2039 | return PURPLE_CMD_RET_FAILED; |
| 9130 | 2040 | |
| 2041 | jabber_chat_change_nick(chat, args[0]); | |
| 15884 | 2042 | return PURPLE_CMD_RET_OK; |
| 9130 | 2043 | } |
| 2044 | ||
| 15884 | 2045 | static PurpleCmdRet jabber_cmd_chat_part(PurpleConversation *conv, |
| 9597 | 2046 | const char *cmd, char **args, char **error, void *data) |
| 9130 | 2047 | { |
| 2048 | 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
|
2049 | |
|
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2050 | 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
|
2051 | 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
|
2052 | |
| 9130 | 2053 | jabber_chat_part(chat, args ? args[0] : NULL); |
| 15884 | 2054 | return PURPLE_CMD_RET_OK; |
| 9130 | 2055 | } |
| 2056 | ||
| 15884 | 2057 | static PurpleCmdRet jabber_cmd_chat_ban(PurpleConversation *conv, |
| 9597 | 2058 | const char *cmd, char **args, char **error, void *data) |
| 9152 | 2059 | { |
| 2060 | JabberChat *chat = jabber_chat_find_by_conv(conv); | |
| 2061 | ||
|
18986
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2062 | if(!chat || !args || !args[0]) |
| 15884 | 2063 | return PURPLE_CMD_RET_FAILED; |
| 9152 | 2064 | |
| 2065 | if(!jabber_chat_ban_user(chat, args[0], args[1])) { | |
| 2066 | *error = g_strdup_printf(_("Unable to ban user %s"), args[0]); | |
| 15884 | 2067 | return PURPLE_CMD_RET_FAILED; |
| 9152 | 2068 | } |
| 2069 | ||
| 15884 | 2070 | return PURPLE_CMD_RET_OK; |
| 9152 | 2071 | } |
| 2072 | ||
| 15884 | 2073 | static PurpleCmdRet jabber_cmd_chat_affiliate(PurpleConversation *conv, |
| 11393 | 2074 | const char *cmd, char **args, char **error, void *data) |
| 2075 | { | |
| 2076 | JabberChat *chat = jabber_chat_find_by_conv(conv); | |
| 2077 | ||
|
18986
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2078 | if (!chat || !args || !args[0] || !args[1]) |
| 15884 | 2079 | return PURPLE_CMD_RET_FAILED; |
| 11393 | 2080 | |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2081 | if (strcmp(args[1], "owner") != 0 && |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2082 | strcmp(args[1], "admin") != 0 && |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2083 | strcmp(args[1], "member") != 0 && |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2084 | strcmp(args[1], "outcast") != 0 && |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2085 | strcmp(args[1], "none") != 0) { |
| 11393 | 2086 | *error = g_strdup_printf(_("Unknown affiliation: \"%s\""), args[1]); |
| 15884 | 2087 | return PURPLE_CMD_RET_FAILED; |
| 11393 | 2088 | } |
| 2089 | ||
| 2090 | if (!jabber_chat_affiliate_user(chat, args[0], args[1])) { | |
| 2091 | *error = g_strdup_printf(_("Unable to affiliate user %s as \"%s\""), args[0], args[1]); | |
| 15884 | 2092 | return PURPLE_CMD_RET_FAILED; |
| 11393 | 2093 | } |
| 2094 | ||
| 15884 | 2095 | return PURPLE_CMD_RET_OK; |
| 11393 | 2096 | } |
| 2097 | ||
| 15884 | 2098 | static PurpleCmdRet jabber_cmd_chat_role(PurpleConversation *conv, |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2099 | const char *cmd, char **args, char **error, void *data) |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2100 | { |
|
19217
ee1aa7e4c462
Fix uninitialized variable access.
Daniel Atallah <datallah@pidgin.im>
parents:
18986
diff
changeset
|
2101 | JabberChat *chat = jabber_chat_find_by_conv(conv); |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2102 | |
|
18986
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2103 | if (!chat || !args || !args[0] || !args[1]) |
| 15884 | 2104 | return PURPLE_CMD_RET_FAILED; |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2105 | |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2106 | if (strcmp(args[1], "moderator") != 0 && |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2107 | strcmp(args[1], "participant") != 0 && |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2108 | strcmp(args[1], "visitor") != 0 && |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2109 | strcmp(args[1], "none") != 0) { |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2110 | *error = g_strdup_printf(_("Unknown role: \"%s\""), args[1]); |
| 15884 | 2111 | return PURPLE_CMD_RET_FAILED; |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2112 | } |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2113 | |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2114 | 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
|
2115 | *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
|
2116 | args[1], args[0]); |
| 15884 | 2117 | return PURPLE_CMD_RET_FAILED; |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2118 | } |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2119 | |
| 15884 | 2120 | return PURPLE_CMD_RET_OK; |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2121 | } |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2122 | |
| 15884 | 2123 | static PurpleCmdRet jabber_cmd_chat_invite(PurpleConversation *conv, |
| 9597 | 2124 | const char *cmd, char **args, char **error, void *data) |
| 9152 | 2125 | { |
| 2126 | if(!args || !args[0]) | |
| 15884 | 2127 | return PURPLE_CMD_RET_FAILED; |
| 9152 | 2128 | |
| 15884 | 2129 | jabber_chat_invite(purple_conversation_get_gc(conv), |
| 2130 | purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), args[1] ? args[1] : "", | |
| 9152 | 2131 | args[0]); |
| 2132 | ||
| 15884 | 2133 | return PURPLE_CMD_RET_OK; |
| 9152 | 2134 | } |
| 2135 | ||
| 15884 | 2136 | static PurpleCmdRet jabber_cmd_chat_join(PurpleConversation *conv, |
| 9597 | 2137 | const char *cmd, char **args, char **error, void *data) |
| 9152 | 2138 | { |
| 2139 | JabberChat *chat = jabber_chat_find_by_conv(conv); | |
| 2140 | GHashTable *components; | |
| 2141 | ||
|
18986
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2142 | if(!chat || !args || !args[0]) |
| 15884 | 2143 | return PURPLE_CMD_RET_FAILED; |
| 9152 | 2144 | |
| 2145 | components = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); | |
| 2146 | ||
| 2147 | g_hash_table_replace(components, "room", args[0]); | |
| 2148 | g_hash_table_replace(components, "server", chat->server); | |
| 2149 | g_hash_table_replace(components, "handle", chat->handle); | |
| 2150 | if(args[1]) | |
| 2151 | g_hash_table_replace(components, "password", args[1]); | |
| 2152 | ||
| 15884 | 2153 | jabber_chat_join(purple_conversation_get_gc(conv), components); |
| 9152 | 2154 | |
| 2155 | g_hash_table_destroy(components); | |
| 15884 | 2156 | return PURPLE_CMD_RET_OK; |
| 9152 | 2157 | } |
| 2158 | ||
| 15884 | 2159 | static PurpleCmdRet jabber_cmd_chat_kick(PurpleConversation *conv, |
| 9597 | 2160 | const char *cmd, char **args, char **error, void *data) |
| 9152 | 2161 | { |
| 2162 | JabberChat *chat = jabber_chat_find_by_conv(conv); | |
| 2163 | ||
|
18986
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2164 | if(!chat || !args || !args[0]) |
| 15884 | 2165 | return PURPLE_CMD_RET_FAILED; |
| 9152 | 2166 | |
| 2167 | if(!jabber_chat_kick_user(chat, args[0], args[1])) { | |
| 2168 | *error = g_strdup_printf(_("Unable to kick user %s"), args[0]); | |
| 15884 | 2169 | return PURPLE_CMD_RET_FAILED; |
| 9152 | 2170 | } |
| 2171 | ||
| 15884 | 2172 | return PURPLE_CMD_RET_OK; |
| 9152 | 2173 | } |
| 2174 | ||
| 15884 | 2175 | static PurpleCmdRet jabber_cmd_chat_msg(PurpleConversation *conv, |
| 9597 | 2176 | const char *cmd, char **args, char **error, void *data) |
| 9152 | 2177 | { |
| 2178 | JabberChat *chat = jabber_chat_find_by_conv(conv); | |
| 2179 | char *who; | |
| 2180 | ||
|
18986
5542a465de12
Fix a bunch of possible crashes in jabber when using slash commands in
Mark Doliner <markdoliner@pidgin.im>
parents:
18381
diff
changeset
|
2181 | 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
|
2182 | 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
|
2183 | |
| 9152 | 2184 | who = g_strdup_printf("%s@%s/%s", chat->room, chat->server, args[0]); |
| 2185 | ||
| 15884 | 2186 | jabber_message_send_im(purple_conversation_get_gc(conv), who, args[1], 0); |
| 9152 | 2187 | |
| 2188 | g_free(who); | |
| 15884 | 2189 | return PURPLE_CMD_RET_OK; |
| 9152 | 2190 | } |
| 2191 | ||
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
2192 | 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
|
2193 | 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
|
2194 | { |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
2195 | if(!args || !args[0]) |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
2196 | return PURPLE_CMD_RET_FAILED; |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
2197 | |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
2198 | 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
|
2199 | *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
|
2200 | return PURPLE_CMD_RET_FAILED; |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
2201 | } |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
2202 | |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
2203 | return PURPLE_CMD_RET_OK; |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
2204 | } |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
2205 | |
|
20930
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2206 | 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
|
2207 | |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2208 | JabberBuddy *jb; |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2209 | JabberBuddyResource *jbr; |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2210 | GList *iter; |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2211 | |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2212 | if(!username) |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2213 | return FALSE; |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2214 | |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2215 | 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
|
2216 | if(!jb) { |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2217 | *error = g_strdup_printf(_("Unable to buzz, because there is nothing known about user %s."), username); |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2218 | return FALSE; |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2219 | } |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2220 | |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2221 | jbr = jabber_buddy_find_resource(jb, NULL); |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2222 | if(!jbr) { |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2223 | *error = g_strdup_printf(_("Unable to buzz, because user %s might be offline."), username); |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2224 | return FALSE; |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2225 | } |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2226 | |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2227 | if(!jbr->caps) { |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2228 | *error = g_strdup_printf(_("Unable to buzz, because there is nothing known about user %s."), username); |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2229 | return FALSE; |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2230 | } |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2231 | |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2232 | for(iter = jbr->caps->features; iter; iter = g_list_next(iter)) { |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2233 | if(!strcmp(iter->data, "http://www.xmpp.org/extensions/xep-0224.html#ns")) { |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2234 | xmlnode *buzz, *msg = xmlnode_new("message"); |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2235 | gchar *to; |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2236 | |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2237 | to = g_strdup_printf("%s/%s", username, jbr->name); |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2238 | xmlnode_set_attrib(msg, "to", to); |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2239 | g_free(to); |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2240 | |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2241 | /* avoid offline storage */ |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2242 | xmlnode_set_attrib(msg, "type", "headline"); |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2243 | |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2244 | buzz = xmlnode_new_child(msg, "attention"); |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2245 | xmlnode_set_namespace(buzz, "http://www.xmpp.org/extensions/xep-0224.html#ns"); |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2246 | |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2247 | jabber_send(js, msg); |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2248 | xmlnode_free(msg); |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2249 | |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2250 | return TRUE; |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2251 | } |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2252 | } |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2253 | |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2254 | *error = g_strdup_printf(_("Unable to buzz, because the user %s does not support it."), username); |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2255 | return FALSE; |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2256 | } |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2257 | |
|
17822
1a183f3fa9d7
disapproval of revision 'd52c12703a8e67c41c7f95a2cae7f16ab426ad76'
Andreas Monitzer <am@adiumx.com>
parents:
17821
diff
changeset
|
2258 | static PurpleCmdRet jabber_cmd_buzz(PurpleConversation *conv, |
|
1a183f3fa9d7
disapproval of revision 'd52c12703a8e67c41c7f95a2cae7f16ab426ad76'
Andreas Monitzer <am@adiumx.com>
parents:
17821
diff
changeset
|
2259 | const char *cmd, char **args, char **error, void *data) |
|
1a183f3fa9d7
disapproval of revision 'd52c12703a8e67c41c7f95a2cae7f16ab426ad76'
Andreas Monitzer <am@adiumx.com>
parents:
17821
diff
changeset
|
2260 | { |
|
1a183f3fa9d7
disapproval of revision 'd52c12703a8e67c41c7f95a2cae7f16ab426ad76'
Andreas Monitzer <am@adiumx.com>
parents:
17821
diff
changeset
|
2261 | JabberStream *js = conv->account->gc->proto_data; |
|
1a183f3fa9d7
disapproval of revision 'd52c12703a8e67c41c7f95a2cae7f16ab426ad76'
Andreas Monitzer <am@adiumx.com>
parents:
17821
diff
changeset
|
2262 | |
|
1a183f3fa9d7
disapproval of revision 'd52c12703a8e67c41c7f95a2cae7f16ab426ad76'
Andreas Monitzer <am@adiumx.com>
parents:
17821
diff
changeset
|
2263 | if(!args || !args[0]) |
|
1a183f3fa9d7
disapproval of revision 'd52c12703a8e67c41c7f95a2cae7f16ab426ad76'
Andreas Monitzer <am@adiumx.com>
parents:
17821
diff
changeset
|
2264 | return PURPLE_CMD_RET_FAILED; |
|
20930
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2265 | |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2266 | return _jabber_send_buzz(js, args[0], error) ? PURPLE_CMD_RET_OK : PURPLE_CMD_RET_FAILED; |
|
17822
1a183f3fa9d7
disapproval of revision 'd52c12703a8e67c41c7f95a2cae7f16ab426ad76'
Andreas Monitzer <am@adiumx.com>
parents:
17821
diff
changeset
|
2267 | } |
|
1a183f3fa9d7
disapproval of revision 'd52c12703a8e67c41c7f95a2cae7f16ab426ad76'
Andreas Monitzer <am@adiumx.com>
parents:
17821
diff
changeset
|
2268 | |
|
20401
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2269 | 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
|
2270 | { |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2271 | 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
|
2272 | PurpleAttentionType *attn; |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2273 | |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2274 | if (!types) { |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2275 | attn = g_new0(PurpleAttentionType, 1); |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2276 | attn->name = _("Buzz"); |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2277 | attn->incoming_description = _("%s has buzzed you!"); |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2278 | attn->outgoing_description = _("Buzzing %s..."); |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2279 | types = g_list_append(types, attn); |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2280 | } |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2281 | |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2282 | return types; |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2283 | } |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2284 | |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2285 | 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
|
2286 | { |
|
20930
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2287 | 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
|
2288 | 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
|
2289 | |
|
20930
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2290 | 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
|
2291 | 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
|
2292 | 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
|
2293 | return FALSE; |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2294 | } |
|
20930
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2295 | |
|
bb8c78265f58
Fix CID 337, null pointer deref. Also plug a leak.
Daniel Atallah <datallah@pidgin.im>
parents:
20929
diff
changeset
|
2296 | return TRUE; |
|
20401
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2297 | } |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2298 | |
|
8aaa593a6269
Comment a partial implementation of the libpurple attention API for
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
20332
diff
changeset
|
2299 | |
|
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
|
2300 | gboolean jabber_offline_message(const PurpleBuddy *buddy) |
|
12645
a907ba243930
[gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12600
diff
changeset
|
2301 | { |
|
a907ba243930
[gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12600
diff
changeset
|
2302 | return TRUE; |
|
a907ba243930
[gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12600
diff
changeset
|
2303 | } |
|
a907ba243930
[gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12600
diff
changeset
|
2304 | |
|
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
|
2305 | void jabber_register_commands(void) |
| 9130 | 2306 | { |
| 15884 | 2307 | purple_cmd_register("config", "", PURPLE_CMD_P_PRPL, |
| 2308 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 9597 | 2309 | "prpl-jabber", jabber_cmd_chat_config, |
| 2310 | _("config: Configure a chat room."), NULL); | |
| 15884 | 2311 | purple_cmd_register("configure", "", PURPLE_CMD_P_PRPL, |
| 2312 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 9597 | 2313 | "prpl-jabber", jabber_cmd_chat_config, |
| 2314 | _("configure: Configure a chat room."), NULL); | |
| 15884 | 2315 | purple_cmd_register("nick", "s", PURPLE_CMD_P_PRPL, |
| 2316 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 9597 | 2317 | "prpl-jabber", jabber_cmd_chat_nick, |
| 2318 | _("nick <new nickname>: Change your nickname."), | |
| 2319 | NULL); | |
| 15884 | 2320 | purple_cmd_register("part", "s", PURPLE_CMD_P_PRPL, |
| 2321 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 2322 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", | |
| 9597 | 2323 | jabber_cmd_chat_part, _("part [room]: Leave the room."), |
| 2324 | NULL); | |
| 15884 | 2325 | purple_cmd_register("register", "", PURPLE_CMD_P_PRPL, |
| 2326 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 9597 | 2327 | "prpl-jabber", jabber_cmd_chat_register, |
| 2328 | _("register: Register with a chat room."), NULL); | |
| 9130 | 2329 | /* XXX: there needs to be a core /topic cmd, methinks */ |
| 15884 | 2330 | purple_cmd_register("topic", "s", PURPLE_CMD_P_PRPL, |
| 2331 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 2332 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", | |
| 9597 | 2333 | jabber_cmd_chat_topic, |
| 2334 | _("topic [new topic]: View or change the topic."), | |
| 2335 | NULL); | |
| 15884 | 2336 | purple_cmd_register("ban", "ws", PURPLE_CMD_P_PRPL, |
| 2337 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 2338 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", | |
| 9597 | 2339 | jabber_cmd_chat_ban, |
| 2340 | _("ban <user> [room]: Ban a user from the room."), | |
| 2341 | NULL); | |
| 15884 | 2342 | purple_cmd_register("affiliate", "ws", PURPLE_CMD_P_PRPL, |
| 2343 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 2344 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", | |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2345 | jabber_cmd_chat_affiliate, |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2346 | _("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
|
2347 | NULL); |
| 15884 | 2348 | purple_cmd_register("role", "ws", PURPLE_CMD_P_PRPL, |
| 2349 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 2350 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", | |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2351 | jabber_cmd_chat_role, |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
13201
diff
changeset
|
2352 | _("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
|
2353 | NULL); |
| 15884 | 2354 | purple_cmd_register("invite", "ws", PURPLE_CMD_P_PRPL, |
| 2355 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 2356 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", | |
| 9597 | 2357 | jabber_cmd_chat_invite, |
| 11158 | 2358 | _("invite <user> [message]: Invite a user to the room."), |
| 9597 | 2359 | NULL); |
| 15884 | 2360 | purple_cmd_register("join", "ws", PURPLE_CMD_P_PRPL, |
| 2361 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 2362 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", | |
| 9597 | 2363 | jabber_cmd_chat_join, |
| 2364 | _("join: <room> [server]: Join a chat on this server."), | |
| 2365 | NULL); | |
| 15884 | 2366 | purple_cmd_register("kick", "ws", PURPLE_CMD_P_PRPL, |
| 2367 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 2368 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", | |
| 9597 | 2369 | jabber_cmd_chat_kick, |
| 2370 | _("kick <user> [room]: Kick a user from the room."), | |
| 2371 | NULL); | |
| 15884 | 2372 | purple_cmd_register("msg", "ws", PURPLE_CMD_P_PRPL, |
| 2373 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 9597 | 2374 | "prpl-jabber", jabber_cmd_chat_msg, |
| 2375 | _("msg <user> <message>: Send a private message to another user."), | |
| 2376 | NULL); | |
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
2377 | 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
|
2378 | 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
|
2379 | 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
|
2380 | "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
|
2381 | _("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
|
2382 | NULL); |
|
17822
1a183f3fa9d7
disapproval of revision 'd52c12703a8e67c41c7f95a2cae7f16ab426ad76'
Andreas Monitzer <am@adiumx.com>
parents:
17821
diff
changeset
|
2383 | purple_cmd_register("buzz", "s", PURPLE_CMD_P_PRPL, |
|
1a183f3fa9d7
disapproval of revision 'd52c12703a8e67c41c7f95a2cae7f16ab426ad76'
Andreas Monitzer <am@adiumx.com>
parents:
17821
diff
changeset
|
2384 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY, |
|
1a183f3fa9d7
disapproval of revision 'd52c12703a8e67c41c7f95a2cae7f16ab426ad76'
Andreas Monitzer <am@adiumx.com>
parents:
17821
diff
changeset
|
2385 | "prpl-jabber", jabber_cmd_buzz, |
|
1a183f3fa9d7
disapproval of revision 'd52c12703a8e67c41c7f95a2cae7f16ab426ad76'
Andreas Monitzer <am@adiumx.com>
parents:
17821
diff
changeset
|
2386 | _("buzz: Buzz a user to get their attention"), NULL); |
| 9130 | 2387 | } |
| 2388 | ||
|
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
|
2389 | 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
|
2390 | jabber_init_plugin(PurplePlugin *plugin) |
| 14358 | 2391 | { |
|
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
|
2392 | my_protocol = plugin; |
| 14358 | 2393 | } |