Tue, 25 Nov 2003 06:56:44 +0000
[gaim-migrate @ 8254]
i heart jabber
| 2086 | 1 | /* |
| 7014 | 2 | * gaim - 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 | |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 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" | |
| 25 | #include "debug.h" | |
| 26 | #include "message.h" | |
| 27 | #include "multi.h" | |
| 7072 | 28 | #include "notify.h" |
| 7014 | 29 | #include "prpl.h" |
| 7072 | 30 | #include "request.h" |
| 7014 | 31 | #include "server.h" |
|
7095
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7072
diff
changeset
|
32 | #include "util.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
33 | |
| 7014 | 34 | #include "auth.h" |
| 35 | #include "buddy.h" | |
| 36 | #include "chat.h" | |
| 37 | #include "iq.h" | |
| 38 | #include "jutil.h" | |
| 39 | #include "message.h" | |
| 40 | #include "parser.h" | |
| 41 | #include "presence.h" | |
| 42 | #include "jabber.h" | |
| 43 | #include "roster.h" | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
44 | |
| 7014 | 45 | #define JABBER_CONNECT_STEPS (js->gsc ? 8 : 5) |
| 2086 | 46 | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
47 | static GaimPlugin *my_protocol = NULL; |
|
4249
62583b5d3663
[gaim-migrate @ 4499]
Robert McQueen <robot101@debian.org>
parents:
4245
diff
changeset
|
48 | |
| 7014 | 49 | static void jabber_stream_init(JabberStream *js) |
| 50 | { | |
| 51 | char *open_stream; | |
|
3340
7e59a209931d
[gaim-migrate @ 3359]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3337
diff
changeset
|
52 | |
| 7014 | 53 | open_stream = g_strdup_printf("<stream:stream to='%s' " |
| 54 | "xmlns='jabber:client' " | |
| 7395 | 55 | "xmlns:stream='http://etherx.jabber.org/streams' " |
| 56 | "version='1.0'>", | |
| 7291 | 57 | js->user->domain); |
| 3311 | 58 | |
| 7014 | 59 | jabber_send_raw(js, open_stream); |
| 2086 | 60 | |
| 7014 | 61 | g_free(open_stream); |
| 2086 | 62 | } |
| 63 | ||
| 7395 | 64 | static void |
| 65 | jabber_session_initialized_cb(JabberStream *js, xmlnode *packet, gpointer data) | |
| 3311 | 66 | { |
| 7014 | 67 | const char *type = xmlnode_get_attrib(packet, "type"); |
| 68 | if(type && !strcmp(type, "result")) { | |
| 69 | jabber_stream_set_state(js, JABBER_STREAM_CONNECTED); | |
| 70 | } else { | |
| 71 | gaim_connection_error(js->gc, _("Error initializing session")); | |
| 3311 | 72 | } |
| 73 | } | |
| 74 | ||
| 7014 | 75 | static void jabber_session_init(JabberStream *js) |
| 3311 | 76 | { |
| 7014 | 77 | JabberIq *iq = jabber_iq_new(js, JABBER_IQ_SET); |
| 78 | xmlnode *session; | |
| 3311 | 79 | |
| 7395 | 80 | jabber_iq_set_callback(iq, jabber_session_initialized_cb, NULL); |
| 3311 | 81 | |
| 7014 | 82 | session = xmlnode_new_child(iq->node, "session"); |
| 83 | xmlnode_set_attrib(session, "xmlns", "urn:ietf:params:xml:ns:xmpp-session"); | |
| 3311 | 84 | |
| 7014 | 85 | jabber_iq_send(iq); |
| 3311 | 86 | } |
| 87 | ||
| 7395 | 88 | static void jabber_bind_result_cb(JabberStream *js, xmlnode *packet, |
| 89 | gpointer data) | |
| 90 | { | |
| 91 | /* XXX: check for errors, re-set our ow js->user JID */ | |
| 92 | ||
| 93 | jabber_session_init(js); | |
| 94 | } | |
| 95 | ||
| 96 | static void jabber_stream_features_parse(JabberStream *js, xmlnode *packet) | |
| 97 | { | |
| 98 | if(xmlnode_get_child(packet, "mechanisms")) { | |
| 99 | jabber_auth_start(js, packet); | |
| 100 | } else if(xmlnode_get_child(packet, "bind")) { | |
| 101 | xmlnode *bind, *resource; | |
| 102 | JabberIq *iq = jabber_iq_new(js, JABBER_IQ_SET); | |
| 103 | bind = xmlnode_new_child(iq->node, "bind"); | |
| 104 | xmlnode_set_attrib(bind, "xmlns", "urn:ietf:params:xml:ns:xmpp-bind"); | |
| 105 | resource = xmlnode_new_child(bind, "resource"); | |
| 106 | xmlnode_insert_data(resource, js->user->resource, -1); | |
| 107 | ||
| 108 | jabber_iq_set_callback(iq, jabber_bind_result_cb, NULL); | |
| 109 | ||
| 110 | jabber_iq_send(iq); | |
| 111 | } | |
| 112 | } | |
| 113 | ||
| 7014 | 114 | static void jabber_stream_handle_error(JabberStream *js, xmlnode *packet) |
| 3311 | 115 | { |
| 7014 | 116 | xmlnode *textnode; |
| 117 | char *error_text = NULL; | |
| 118 | const char *text; | |
| 119 | char *buf; | |
| 3311 | 120 | |
| 7014 | 121 | if(xmlnode_get_child(packet, "bad-format")) { |
| 122 | text = _("Bad Format"); | |
| 123 | } else if(xmlnode_get_child(packet, "bad-namespace-prefix")) { | |
| 124 | text = _("Bad Namespace Prefix"); | |
| 125 | } else if(xmlnode_get_child(packet, "conflict")) { | |
| 126 | js->gc->wants_to_die = TRUE; | |
| 127 | text = _("Resource Conflict"); | |
| 128 | } else if(xmlnode_get_child(packet, "connection-timeout")) { | |
| 129 | text = _("Connection Timeout"); | |
| 130 | } else if(xmlnode_get_child(packet, "host-gone")) { | |
| 131 | text = _("Host Gone"); | |
| 132 | } else if(xmlnode_get_child(packet, "host-unknown")) { | |
| 133 | text = _("Host Unknown"); | |
| 134 | } else if(xmlnode_get_child(packet, "improper-addressing")) { | |
| 135 | text = _("Improper Addressing"); | |
| 136 | } else if(xmlnode_get_child(packet, "internal-server-error")) { | |
| 137 | text = _("Internal Server Error"); | |
| 138 | } else if(xmlnode_get_child(packet, "invalid-id")) { | |
| 139 | text = _("Invalid ID"); | |
| 140 | } else if(xmlnode_get_child(packet, "invalid-namespace")) { | |
| 141 | text = _("Invalid Namespace"); | |
| 142 | } else if(xmlnode_get_child(packet, "invalid-xml")) { | |
| 143 | text = _("Invalid XML"); | |
| 144 | } else if(xmlnode_get_child(packet, "nonmatching-hosts")) { | |
| 145 | text = _("Non-matching Hosts"); | |
| 146 | } else if(xmlnode_get_child(packet, "not-authorized")) { | |
| 147 | text = _("Not Authorized"); | |
| 148 | } else if(xmlnode_get_child(packet, "policy-violation")) { | |
| 149 | text = _("Policy Violation"); | |
| 150 | } else if(xmlnode_get_child(packet, "remote-connection-failed")) { | |
| 151 | text = _("Remote Connection Failed"); | |
| 152 | } else if(xmlnode_get_child(packet, "resource-constraint")) { | |
| 153 | text = _("Resource Constraint"); | |
| 154 | } else if(xmlnode_get_child(packet, "restricted-xml")) { | |
| 155 | text = _("Restricted XML"); | |
| 156 | } else if(xmlnode_get_child(packet, "see-other-host")) { | |
| 157 | text = _("See Other Host"); | |
| 158 | } else if(xmlnode_get_child(packet, "system-shutdown")) { | |
| 159 | text = _("System Shutdown"); | |
| 160 | } else if(xmlnode_get_child(packet, "undefined-condition")) { | |
| 161 | text = _("Undefined Condition"); | |
| 162 | } else if(xmlnode_get_child(packet, "unsupported-encoding")) { | |
| 7417 | 163 | text = _("Unsupported Encoding"); |
| 7014 | 164 | } else if(xmlnode_get_child(packet, "unsupported-stanza-type")) { |
| 165 | text = _("Unsupported Stanza Type"); | |
| 166 | } else if(xmlnode_get_child(packet, "unsupported-version")) { | |
| 167 | text = _("Unsupported Version"); | |
| 168 | } else if(xmlnode_get_child(packet, "xml-not-well-formed")) { | |
| 169 | text = _("XML Not Well Formed"); | |
| 3311 | 170 | } else { |
| 7014 | 171 | text = _("Stream Error"); |
| 3311 | 172 | } |
| 173 | ||
| 7014 | 174 | if((textnode = xmlnode_get_child(packet, "text"))) |
| 175 | error_text = xmlnode_get_data(textnode); | |
| 2086 | 176 | |
| 7014 | 177 | buf = g_strdup_printf("%s%s%s", text, |
| 178 | error_text ? ": " : "", | |
| 179 | error_text ? error_text : ""); | |
| 180 | gaim_connection_error(js->gc, buf); | |
| 181 | g_free(buf); | |
| 182 | if(error_text) | |
| 183 | g_free(error_text); | |
| 2086 | 184 | } |
| 185 | ||
| 7014 | 186 | static void tls_init(JabberStream *js); |
| 2086 | 187 | |
| 7014 | 188 | void jabber_process_packet(JabberStream *js, xmlnode *packet) |
| 2086 | 189 | { |
| 7014 | 190 | if(!strcmp(packet->name, "iq")) { |
| 7395 | 191 | jabber_iq_parse(js, packet); |
| 7014 | 192 | } else if(!strcmp(packet->name, "presence")) { |
| 193 | jabber_presence_parse(js, packet); | |
| 194 | } else if(!strcmp(packet->name, "message")) { | |
| 195 | jabber_message_parse(js, packet); | |
| 196 | } else if(!strcmp(packet->name, "stream:features")) { | |
| 7395 | 197 | jabber_stream_features_parse(js, packet); |
| 7014 | 198 | } else if(!strcmp(packet->name, "stream:error")) { |
| 199 | jabber_stream_handle_error(js, packet); | |
| 200 | } else if(!strcmp(packet->name, "challenge")) { | |
| 201 | if(js->state == JABBER_STREAM_AUTHENTICATING) | |
| 202 | jabber_auth_handle_challenge(js, packet); | |
| 203 | } else if(!strcmp(packet->name, "success")) { | |
| 204 | if(js->state == JABBER_STREAM_AUTHENTICATING) | |
| 205 | jabber_auth_handle_success(js, packet); | |
| 206 | } else if(!strcmp(packet->name, "failure")) { | |
| 207 | if(js->state == JABBER_STREAM_AUTHENTICATING) | |
| 208 | jabber_auth_handle_failure(js, packet); | |
| 209 | } else if(!strcmp(packet->name, "proceed")) { | |
| 210 | if(js->state == JABBER_STREAM_AUTHENTICATING && !js->gsc) | |
| 211 | tls_init(js); | |
| 212 | } else { | |
| 213 | gaim_debug(GAIM_DEBUG_WARNING, "jabber", "Unknown packet: %s\n", | |
| 214 | packet->name); | |
| 2086 | 215 | } |
| 216 | } | |
| 217 | ||
| 7014 | 218 | void jabber_send_raw(JabberStream *js, const char *data) |
| 2086 | 219 | { |
| 7014 | 220 | int ret; |
| 2086 | 221 | |
| 7014 | 222 | /* because printing a tab to debug every minute gets old */ |
| 223 | if(strcmp(data, "\t")) | |
| 224 | gaim_debug(GAIM_DEBUG_MISC, "jabber", "Sending%s: %s\n", | |
| 225 | js->gsc ? " (ssl)" : "", data); | |
| 2086 | 226 | |
| 7014 | 227 | if(js->gsc) { |
| 228 | ret = gaim_ssl_write(js->gsc, data, strlen(data)); | |
| 229 | } else { | |
| 230 | ret = write(js->fd, data, strlen(data)); | |
|
2814
91cc1a0cdee0
[gaim-migrate @ 2827]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2800
diff
changeset
|
231 | } |
|
91cc1a0cdee0
[gaim-migrate @ 2827]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2800
diff
changeset
|
232 | |
| 7014 | 233 | if(ret < 0) |
| 234 | gaim_connection_error(js->gc, _("Write error")); | |
| 235 | ||
|
2814
91cc1a0cdee0
[gaim-migrate @ 2827]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2800
diff
changeset
|
236 | } |
|
91cc1a0cdee0
[gaim-migrate @ 2827]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2800
diff
changeset
|
237 | |
| 7014 | 238 | void jabber_send(JabberStream *js, xmlnode *packet) |
| 2086 | 239 | { |
| 7014 | 240 | char *txt; |
| 2086 | 241 | |
| 7014 | 242 | txt = xmlnode_to_str(packet); |
| 243 | jabber_send_raw(js, txt); | |
| 244 | g_free(txt); | |
| 2086 | 245 | } |
| 246 | ||
| 7014 | 247 | static void jabber_keepalive(GaimConnection *gc) |
| 2086 | 248 | { |
| 7014 | 249 | jabber_send_raw(gc->proto_data, "\t"); |
| 2086 | 250 | } |
| 251 | ||
| 7014 | 252 | static void |
| 253 | jabber_recv_cb_ssl(gpointer data, GaimSslConnection *gsc, | |
| 6764 | 254 | GaimInputCondition cond) |
| 255 | { | |
| 7014 | 256 | GaimConnection *gc = data; |
| 257 | JabberStream *js = gc->proto_data; | |
| 6764 | 258 | int len; |
| 7014 | 259 | static char buf[4096]; |
| 6768 | 260 | |
| 7014 | 261 | if(!g_list_find(gaim_connections_get_all(), gc)) { |
| 6768 | 262 | gaim_ssl_close(gsc); |
| 263 | return; | |
| 264 | } | |
| 265 | ||
| 7014 | 266 | if((len = gaim_ssl_read(gsc, buf, sizeof(buf) - 1)) > 0) { |
| 6764 | 267 | buf[len] = '\0'; |
| 7014 | 268 | gaim_debug(GAIM_DEBUG_INFO, "jabber", "Recv (ssl)(%d): %s\n", len, buf); |
| 269 | jabber_parser_process(js, buf, len); | |
| 7177 | 270 | } else { |
| 271 | gaim_connection_error(gc, _("Read Error")); | |
| 2086 | 272 | } |
| 273 | } | |
| 274 | ||
| 7014 | 275 | static void |
| 276 | jabber_recv_cb(gpointer data, gint source, GaimInputCondition condition) | |
| 2086 | 277 | { |
| 5572 | 278 | GaimConnection *gc = data; |
| 7014 | 279 | JabberStream *js = gc->proto_data; |
| 280 | int len; | |
| 281 | static char buf[4096]; | |
| 2086 | 282 | |
| 7014 | 283 | if(!g_list_find(gaim_connections_get_all(), gc)) |
| 284 | return; | |
| 2956 | 285 | |
| 7014 | 286 | if((len = read(js->fd, buf, sizeof(buf) - 1)) > 0) { |
| 287 | buf[len] = '\0'; | |
| 288 | gaim_debug(GAIM_DEBUG_INFO, "jabber", "Recv (%d): %s\n", len, buf); | |
| 289 | jabber_parser_process(js, buf, len); | |
| 7177 | 290 | } else { |
| 291 | gaim_connection_error(gc, _("Read Error")); | |
| 7014 | 292 | } |
| 2086 | 293 | } |
| 294 | ||
| 7014 | 295 | static void |
| 296 | jabber_login_callback_ssl(gpointer data, GaimSslConnection *gsc, | |
| 6764 | 297 | GaimInputCondition cond) |
| 298 | { | |
| 299 | GaimConnection *gc = data; | |
| 7014 | 300 | JabberStream *js = gc->proto_data; |
| 6764 | 301 | |
| 7014 | 302 | if(!g_list_find(gaim_connections_get_all(), gc)) { |
| 6764 | 303 | gaim_ssl_close(gsc); |
| 304 | return; | |
| 305 | } | |
| 306 | ||
| 7014 | 307 | js->gsc = gsc; |
| 6764 | 308 | |
| 7014 | 309 | if(js->state == JABBER_STREAM_CONNECTING) |
| 310 | jabber_send_raw(js, "<?xml version='1.0' ?>"); | |
| 6764 | 311 | |
| 7014 | 312 | jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING); |
| 313 | gaim_ssl_input_add(gsc, jabber_recv_cb_ssl, gc); | |
| 6764 | 314 | } |
| 315 | ||
| 7014 | 316 | |
| 317 | static void | |
| 318 | jabber_login_callback(gpointer data, gint source, GaimInputCondition cond) | |
| 6764 | 319 | { |
| 5572 | 320 | GaimConnection *gc = data; |
| 7014 | 321 | JabberStream *js = gc->proto_data; |
| 2086 | 322 | |
| 7014 | 323 | if(!g_list_find(gaim_connections_get_all(), gc)) { |
| 2086 | 324 | close(source); |
| 325 | return; | |
| 326 | } | |
| 327 | ||
| 7014 | 328 | js->fd = source; |
| 2956 | 329 | |
| 7014 | 330 | if(js->state == JABBER_STREAM_CONNECTING) |
| 331 | jabber_send_raw(js, "<?xml version='1.0' ?>"); | |
|
2300
06a3c10f4918
[gaim-migrate @ 2310]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2289
diff
changeset
|
332 | |
| 7014 | 333 | jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING); |
| 334 | gc->inpa = gaim_input_add(js->fd, GAIM_INPUT_READ, jabber_recv_cb, gc); | |
| 335 | } | |
| 2086 | 336 | |
| 7014 | 337 | static void |
| 7426 | 338 | jabber_ssl_connect_failure(GaimSslConnection *gsc, GaimSslErrorType error, |
| 339 | gpointer data) | |
| 340 | { | |
| 341 | GaimConnection *gc = data; | |
| 342 | ||
| 343 | switch(error) { | |
| 344 | case GAIM_SSL_HANDSHAKE_FAILED: | |
| 345 | gaim_connection_error(gc, _("SSL Handshake Failed")); | |
| 346 | break; | |
| 347 | } | |
| 348 | } | |
| 349 | ||
| 7427 | 350 | static void tls_init(JabberStream *js) |
| 351 | { | |
| 352 | gaim_input_remove(js->gc->inpa); | |
| 353 | js->gc->inpa = 0; | |
| 354 | js->gsc = gaim_ssl_connect_fd(js->gc->account, js->fd, | |
| 355 | jabber_login_callback_ssl, jabber_ssl_connect_failure, js->gc); | |
| 356 | } | |
| 357 | ||
| 358 | ||
| 7426 | 359 | static void |
| 7014 | 360 | jabber_login(GaimAccount *account) |
| 2086 | 361 | { |
| 7014 | 362 | int rc; |
| 363 | GaimConnection *gc = gaim_account_get_connection(account); | |
| 364 | const char *connect_server = gaim_account_get_string(account, | |
| 365 | "connect_server", ""); | |
| 5572 | 366 | const char *server; |
| 7014 | 367 | JabberStream *js; |
| 2086 | 368 | |
| 7014 | 369 | gc->flags |= GAIM_CONNECTION_HTML; |
| 370 | js = gc->proto_data = g_new0(JabberStream, 1); | |
| 371 | js->gc = gc; | |
| 372 | js->callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, | |
| 7395 | 373 | g_free, g_free); |
| 7014 | 374 | js->buddies = g_hash_table_new_full(g_str_hash, g_str_equal, |
| 7116 | 375 | g_free, (GDestroyNotify)jabber_buddy_free); |
| 7014 | 376 | js->chats = g_hash_table_new_full(g_str_hash, g_str_equal, |
| 377 | g_free, NULL); | |
| 378 | js->user = jabber_id_new(gaim_account_get_username(account)); | |
| 7322 | 379 | js->next_id = g_random_int(); |
| 5613 | 380 | |
| 7310 | 381 | if(!js->user) { |
| 382 | gaim_connection_error(gc, _("Invalid Jabber ID")); | |
| 383 | return; | |
| 384 | } | |
| 385 | ||
| 7147 | 386 | if(!js->user->resource) { |
| 387 | char *me; | |
| 388 | js->user->resource = g_strdup("Gaim"); | |
| 389 | if(!js->user->node) { | |
| 390 | js->user->node = js->user->domain; | |
| 391 | js->user->domain = g_strdup("jabber.org"); | |
| 392 | } | |
| 393 | me = g_strdup_printf("%s@%s/%s", js->user->node, js->user->domain, | |
| 394 | js->user->resource); | |
| 395 | gaim_account_set_username(account, me); | |
| 396 | g_free(me); | |
| 7145 | 397 | } |
| 398 | ||
| 7014 | 399 | server = connect_server[0] ? connect_server : js->user->domain; |
| 2086 | 400 | |
| 7014 | 401 | jabber_stream_set_state(js, JABBER_STREAM_CONNECTING); |
| 2956 | 402 | |
| 7630 | 403 | |
| 404 | if(gaim_account_get_bool(account, "old_ssl", FALSE)) { | |
| 405 | if(gaim_ssl_is_supported()) { | |
| 406 | js->gsc = gaim_ssl_connect(account, server, | |
| 407 | gaim_account_get_int(account, "port", 5222), | |
| 408 | jabber_login_callback_ssl, jabber_ssl_connect_failure, gc); | |
| 409 | } else { | |
| 410 | gaim_connection_error(gc, _("SSL support unavailable")); | |
| 411 | } | |
| 3311 | 412 | } |
| 3770 | 413 | |
| 7014 | 414 | if(!js->gsc) { |
| 415 | rc = gaim_proxy_connect(account, server, | |
| 416 | gaim_account_get_int(account, "port", 5222), | |
| 417 | jabber_login_callback, gc); | |
| 2086 | 418 | |
| 7014 | 419 | if (rc != 0) |
| 420 | gaim_connection_error(gc, _("Unable to create socket")); | |
| 2956 | 421 | } |
| 2086 | 422 | } |
| 423 | ||
| 7072 | 424 | static gboolean |
| 425 | conn_close_cb(gpointer data) | |
| 426 | { | |
| 427 | JabberStream *js = data; | |
| 428 | gaim_connection_destroy(js->gc); | |
| 429 | return FALSE; | |
| 430 | } | |
| 431 | ||
| 432 | static void | |
| 433 | jabber_connection_schedule_close(JabberStream *js) | |
| 434 | { | |
| 435 | g_timeout_add(0, conn_close_cb, js); | |
| 436 | } | |
| 437 | ||
| 438 | static void | |
| 7395 | 439 | jabber_registration_result_cb(JabberStream *js, xmlnode *packet, gpointer data) |
| 7072 | 440 | { |
| 441 | const char *type = xmlnode_get_attrib(packet, "type"); | |
| 442 | char *buf; | |
| 443 | ||
| 444 | if(!strcmp(type, "result")) { | |
| 445 | buf = g_strdup_printf(_("Registration of %s@%s successful"), | |
| 446 | js->user->node, js->user->domain); | |
| 447 | gaim_notify_info(NULL, _("Registration Successful"), | |
| 448 | _("Registration Successful"), buf); | |
| 449 | g_free(buf); | |
| 450 | } else { | |
| 451 | char *error; | |
| 452 | xmlnode *y; | |
| 453 | ||
| 454 | if((y = xmlnode_get_child(packet, "error"))) { | |
| 455 | error = xmlnode_get_data(y); | |
| 456 | } else { | |
| 457 | error = g_strdup(_("Unknown Error")); | |
| 458 | } | |
| 459 | ||
| 460 | buf = g_strdup_printf(_("Registration of %s@%s failed: %s"), | |
| 461 | js->user->node, js->user->domain, error); | |
| 462 | gaim_notify_error(NULL, _("Registration Failed"), | |
| 463 | _("Registration Failed"), buf); | |
| 464 | g_free(buf); | |
| 465 | g_free(error); | |
| 466 | } | |
| 467 | jabber_connection_schedule_close(js); | |
| 468 | } | |
| 469 | ||
| 470 | static void | |
| 471 | jabber_register_cb(JabberStream *js, GaimRequestFields *fields) | |
| 472 | { | |
| 473 | GList *groups, *flds; | |
| 474 | xmlnode *query, *y; | |
| 475 | JabberIq *iq; | |
| 7264 | 476 | char *username; |
| 7072 | 477 | |
| 478 | iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register"); | |
| 479 | query = xmlnode_get_child(iq->node, "query"); | |
| 480 | ||
| 481 | for(groups = gaim_request_fields_get_groups(fields); groups; | |
| 482 | groups = groups->next) { | |
| 483 | for(flds = gaim_request_field_group_get_fields(groups->data); | |
| 484 | flds; flds = flds->next) { | |
| 485 | GaimRequestField *field = flds->data; | |
| 486 | const char *id = gaim_request_field_get_id(field); | |
| 487 | const char *value = gaim_request_field_string_get_value(field); | |
| 488 | ||
| 489 | if(!strcmp(id, "username")) { | |
| 490 | y = xmlnode_new_child(query, "username"); | |
| 491 | } else if(!strcmp(id, "password")) { | |
| 492 | y = xmlnode_new_child(query, "password"); | |
| 493 | } else if(!strcmp(id, "name")) { | |
| 494 | y = xmlnode_new_child(query, "name"); | |
| 495 | } else if(!strcmp(id, "email")) { | |
| 496 | y = xmlnode_new_child(query, "email"); | |
| 497 | } else if(!strcmp(id, "nick")) { | |
| 498 | y = xmlnode_new_child(query, "nick"); | |
| 499 | } else if(!strcmp(id, "first")) { | |
| 500 | y = xmlnode_new_child(query, "first"); | |
| 501 | } else if(!strcmp(id, "last")) { | |
| 502 | y = xmlnode_new_child(query, "last"); | |
| 503 | } else if(!strcmp(id, "address")) { | |
| 504 | y = xmlnode_new_child(query, "address"); | |
| 505 | } else if(!strcmp(id, "city")) { | |
| 506 | y = xmlnode_new_child(query, "city"); | |
| 507 | } else if(!strcmp(id, "state")) { | |
| 508 | y = xmlnode_new_child(query, "state"); | |
| 509 | } else if(!strcmp(id, "zip")) { | |
| 510 | y = xmlnode_new_child(query, "zip"); | |
| 511 | } else if(!strcmp(id, "phone")) { | |
| 512 | y = xmlnode_new_child(query, "phone"); | |
| 513 | } else if(!strcmp(id, "url")) { | |
| 514 | y = xmlnode_new_child(query, "url"); | |
| 515 | } else if(!strcmp(id, "date")) { | |
| 516 | y = xmlnode_new_child(query, "date"); | |
| 517 | } else { | |
| 518 | continue; | |
| 519 | } | |
| 520 | xmlnode_insert_data(y, value, -1); | |
| 7264 | 521 | if(!strcmp(id, "username")) { |
| 522 | if(js->user->node) | |
| 523 | g_free(js->user->node); | |
| 524 | js->user->node = g_strdup(value); | |
| 525 | } | |
| 7072 | 526 | } |
| 527 | } | |
| 528 | ||
| 7264 | 529 | username = g_strdup_printf("%s@%s/%s", js->user->node, js->user->domain, |
| 530 | js->user->resource); | |
| 531 | gaim_account_set_username(js->gc->account, username); | |
| 532 | g_free(username); | |
| 533 | ||
| 7395 | 534 | jabber_iq_set_callback(iq, jabber_registration_result_cb, NULL); |
| 7072 | 535 | |
| 536 | jabber_iq_send(iq); | |
| 537 | ||
| 538 | } | |
| 539 | ||
| 540 | static void | |
| 541 | jabber_register_cancel_cb(JabberStream *js, GaimRequestFields *fields) | |
| 542 | { | |
| 543 | jabber_connection_schedule_close(js); | |
| 544 | } | |
| 545 | ||
| 546 | void jabber_register_parse(JabberStream *js, xmlnode *packet) | |
| 547 | { | |
| 548 | if(js->registration) { | |
| 549 | GaimRequestFields *fields; | |
| 550 | GaimRequestFieldGroup *group; | |
| 551 | GaimRequestField *field; | |
| 552 | xmlnode *query, *y; | |
| 553 | char *instructions; | |
| 554 | ||
| 555 | /* get rid of the login thingy */ | |
| 556 | gaim_connection_set_state(js->gc, GAIM_CONNECTED); | |
| 557 | ||
| 558 | query = xmlnode_get_child(packet, "query"); | |
| 559 | ||
| 560 | if(xmlnode_get_child(query, "registered")) { | |
| 561 | gaim_notify_error(NULL, _("Already Registered"), | |
| 562 | _("Already Registered"), NULL); | |
| 563 | jabber_connection_schedule_close(js); | |
| 564 | return; | |
| 565 | } | |
| 566 | ||
| 567 | fields = gaim_request_fields_new(); | |
| 568 | group = gaim_request_field_group_new(NULL); | |
| 569 | gaim_request_fields_add_group(fields, group); | |
| 570 | ||
| 571 | field = gaim_request_field_string_new("username", _("Username"), | |
| 572 | js->user->node, FALSE); | |
| 573 | gaim_request_field_group_add_field(group, field); | |
| 574 | ||
| 575 | field = gaim_request_field_string_new("password", _("Password"), | |
| 576 | gaim_account_get_password(js->gc->account), FALSE); | |
| 577 | gaim_request_field_string_set_masked(field, TRUE); | |
| 578 | gaim_request_field_group_add_field(group, field); | |
| 579 | ||
| 580 | if(xmlnode_get_child(query, "name")) { | |
| 581 | field = gaim_request_field_string_new("name", _("Name"), | |
| 582 | gaim_account_get_alias(js->gc->account), FALSE); | |
| 583 | gaim_request_field_group_add_field(group, field); | |
| 584 | } | |
| 585 | if(xmlnode_get_child(query, "email")) { | |
| 586 | field = gaim_request_field_string_new("email", _("E-Mail"), | |
| 587 | NULL, FALSE); | |
| 588 | gaim_request_field_group_add_field(group, field); | |
| 589 | } | |
| 590 | if(xmlnode_get_child(query, "nick")) { | |
| 591 | field = gaim_request_field_string_new("nick", _("Nickname"), | |
| 592 | NULL, FALSE); | |
| 593 | gaim_request_field_group_add_field(group, field); | |
| 594 | } | |
| 595 | if(xmlnode_get_child(query, "first")) { | |
| 596 | field = gaim_request_field_string_new("first", _("First Name"), | |
| 597 | NULL, FALSE); | |
| 598 | gaim_request_field_group_add_field(group, field); | |
| 599 | } | |
| 600 | if(xmlnode_get_child(query, "last")) { | |
| 601 | field = gaim_request_field_string_new("last", _("Last Name"), | |
| 602 | NULL, FALSE); | |
| 603 | gaim_request_field_group_add_field(group, field); | |
| 604 | } | |
| 605 | if(xmlnode_get_child(query, "address")) { | |
| 606 | field = gaim_request_field_string_new("address", _("Address"), | |
| 607 | NULL, FALSE); | |
| 608 | gaim_request_field_group_add_field(group, field); | |
| 609 | } | |
| 610 | if(xmlnode_get_child(query, "city")) { | |
| 611 | field = gaim_request_field_string_new("city", _("City"), | |
| 612 | NULL, FALSE); | |
| 613 | gaim_request_field_group_add_field(group, field); | |
| 614 | } | |
| 615 | if(xmlnode_get_child(query, "state")) { | |
| 616 | field = gaim_request_field_string_new("state", _("State"), | |
| 617 | NULL, FALSE); | |
| 618 | gaim_request_field_group_add_field(group, field); | |
| 619 | } | |
| 620 | if(xmlnode_get_child(query, "zip")) { | |
| 621 | field = gaim_request_field_string_new("zip", _("Postal Code"), | |
| 622 | NULL, FALSE); | |
| 623 | gaim_request_field_group_add_field(group, field); | |
| 624 | } | |
| 625 | if(xmlnode_get_child(query, "phone")) { | |
| 626 | field = gaim_request_field_string_new("phone", _("Phone"), | |
| 627 | NULL, FALSE); | |
| 628 | gaim_request_field_group_add_field(group, field); | |
| 629 | } | |
| 630 | if(xmlnode_get_child(query, "url")) { | |
| 631 | field = gaim_request_field_string_new("url", _("URL"), | |
| 632 | NULL, FALSE); | |
| 633 | gaim_request_field_group_add_field(group, field); | |
| 634 | } | |
| 635 | if(xmlnode_get_child(query, "date")) { | |
| 636 | field = gaim_request_field_string_new("date", _("Date"), | |
| 637 | NULL, FALSE); | |
| 638 | gaim_request_field_group_add_field(group, field); | |
| 639 | } | |
| 640 | ||
| 641 | if((y = xmlnode_get_child(query, "instructions"))) | |
| 642 | instructions = xmlnode_get_data(y); | |
| 643 | else | |
| 644 | instructions = g_strdup(_("Please fill out the information below " | |
| 645 | "to register your new account.")); | |
| 646 | ||
| 647 | gaim_request_fields(js->gc, _("Register New Jabber Account"), | |
| 648 | _("Register New Jabber Account"), instructions, fields, | |
| 649 | _("Register"), G_CALLBACK(jabber_register_cb), | |
| 650 | _("Cancel"), G_CALLBACK(jabber_register_cancel_cb), js); | |
| 651 | } | |
| 652 | } | |
| 653 | ||
| 654 | static void jabber_register_start(JabberStream *js) | |
| 655 | { | |
| 656 | JabberIq *iq; | |
| 657 | ||
| 658 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:register"); | |
| 659 | jabber_iq_send(iq); | |
| 660 | } | |
| 661 | ||
| 662 | static void jabber_register_account(GaimAccount *account) | |
| 663 | { | |
| 664 | GaimConnection *gc = gaim_account_get_connection(account); | |
| 665 | JabberStream *js; | |
| 666 | const char *connect_server = gaim_account_get_string(account, | |
| 667 | "connect_server", ""); | |
| 668 | const char *server; | |
| 669 | int rc; | |
| 670 | ||
| 671 | js = gc->proto_data = g_new0(JabberStream, 1); | |
| 672 | js->gc = gc; | |
| 673 | js->registration = TRUE; | |
| 674 | js->callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, | |
| 7395 | 675 | g_free, g_free); |
| 7072 | 676 | js->user = jabber_id_new(gaim_account_get_username(account)); |
| 7322 | 677 | js->next_id = g_random_int(); |
| 7072 | 678 | |
| 7310 | 679 | if(!js->user) { |
| 680 | gaim_connection_error(gc, _("Invalid Jabber ID")); | |
| 681 | return; | |
| 682 | } | |
| 683 | ||
| 7147 | 684 | if(!js->user->resource) { |
| 685 | char *me; | |
| 686 | js->user->resource = g_strdup("Gaim"); | |
| 687 | if(!js->user->node) { | |
| 688 | js->user->node = js->user->domain; | |
| 689 | js->user->domain = g_strdup("jabber.org"); | |
| 690 | } | |
| 691 | me = g_strdup_printf("%s@%s/%s", js->user->node, js->user->domain, | |
| 692 | js->user->resource); | |
| 693 | gaim_account_set_username(account, me); | |
| 694 | g_free(me); | |
| 695 | } | |
| 696 | ||
| 7072 | 697 | server = connect_server[0] ? connect_server : js->user->domain; |
| 698 | ||
| 699 | jabber_stream_set_state(js, JABBER_STREAM_CONNECTING); | |
| 700 | ||
| 7630 | 701 | if(gaim_account_get_bool(account, "old_ssl", FALSE)) { |
| 702 | if(gaim_ssl_is_supported()) { | |
| 703 | js->gsc = gaim_ssl_connect(account, server, | |
| 704 | gaim_account_get_int(account, "port", 5222), | |
| 705 | jabber_login_callback_ssl, jabber_ssl_connect_failure, gc); | |
| 706 | } else { | |
| 707 | gaim_connection_error(gc, _("SSL support unavailable")); | |
| 708 | } | |
| 7072 | 709 | } |
| 710 | ||
| 711 | if(!js->gsc) { | |
| 712 | rc = gaim_proxy_connect(account, server, | |
| 713 | gaim_account_get_int(account, "port", 5222), | |
| 714 | jabber_login_callback, gc); | |
| 715 | ||
| 716 | if (rc != 0) | |
| 717 | gaim_connection_error(gc, _("Unable to create socket")); | |
| 718 | } | |
| 719 | } | |
| 720 | ||
| 5572 | 721 | static void jabber_close(GaimConnection *gc) |
| 2086 | 722 | { |
| 7014 | 723 | JabberStream *js = gc->proto_data; |
| 2956 | 724 | |
| 7014 | 725 | jabber_send_raw(js, "</stream:stream>"); |
| 3311 | 726 | |
| 7014 | 727 | if(js->gsc) { |
| 728 | gaim_ssl_close(js->gsc); | |
| 729 | } else { | |
| 7072 | 730 | if(js->gc->inpa) |
| 731 | gaim_input_remove(js->gc->inpa); | |
| 7014 | 732 | close(js->fd); |
| 733 | } | |
| 3311 | 734 | |
| 7587 | 735 | if(js->context) |
| 736 | g_markup_parse_context_free(js->context); | |
| 7072 | 737 | if(js->callbacks) |
| 738 | g_hash_table_destroy(js->callbacks); | |
| 739 | if(js->buddies) | |
| 740 | g_hash_table_destroy(js->buddies); | |
| 741 | if(js->chats) | |
| 742 | g_hash_table_destroy(js->chats); | |
| 7014 | 743 | if(js->stream_id) |
| 744 | g_free(js->stream_id); | |
| 7587 | 745 | if(js->user) |
| 746 | jabber_id_free(js->user); | |
| 7014 | 747 | g_free(js); |
| 5093 | 748 | } |
| 749 | ||
| 7395 | 750 | static void jabber_server_probe(JabberStream *js) |
| 751 | { | |
| 752 | JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET, | |
| 753 | "http://jabber.org/protocol/disco#items"); | |
| 754 | ||
| 755 | xmlnode_set_attrib(iq->node, "to", js->user->domain); | |
| 756 | jabber_iq_send(iq); | |
| 757 | } | |
| 758 | ||
| 7014 | 759 | void jabber_stream_set_state(JabberStream *js, JabberStreamState state) |
|
3105
8c23b0ec1036
[gaim-migrate @ 3119]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3074
diff
changeset
|
760 | { |
| 7014 | 761 | js->state = state; |
| 762 | switch(state) { | |
| 763 | case JABBER_STREAM_OFFLINE: | |
| 764 | break; | |
| 765 | case JABBER_STREAM_CONNECTING: | |
| 766 | gaim_connection_update_progress(js->gc, _("Connecting"), 1, | |
| 767 | JABBER_CONNECT_STEPS); | |
| 768 | break; | |
| 769 | case JABBER_STREAM_INITIALIZING: | |
| 770 | gaim_connection_update_progress(js->gc, _("Initializing Stream"), | |
| 771 | js->gsc ? 5 : 2, JABBER_CONNECT_STEPS); | |
| 772 | jabber_stream_init(js); | |
| 773 | jabber_parser_setup(js); | |
| 774 | break; | |
| 775 | case JABBER_STREAM_AUTHENTICATING: | |
| 776 | gaim_connection_update_progress(js->gc, _("Authenticating"), | |
| 777 | js->gsc ? 6 : 3, JABBER_CONNECT_STEPS); | |
| 7072 | 778 | if(js->registration) |
| 779 | jabber_register_start(js); | |
| 780 | else if(js->protocol_version == JABBER_PROTO_0_9) | |
| 7014 | 781 | jabber_auth_start_old(js); |
| 782 | break; | |
| 783 | case JABBER_STREAM_REINITIALIZING: | |
| 784 | gaim_connection_update_progress(js->gc, _("Re-initializing Stream"), | |
| 785 | 6, JABBER_CONNECT_STEPS); | |
| 786 | jabber_stream_init(js); | |
| 787 | break; | |
| 788 | case JABBER_STREAM_CONNECTED: | |
| 789 | gaim_connection_set_state(js->gc, GAIM_CONNECTED); | |
| 790 | jabber_roster_request(js); | |
| 791 | jabber_presence_send(js->gc, js->gc->away_state, js->gc->away); | |
| 7395 | 792 | jabber_server_probe(js); |
| 7014 | 793 | serv_finish_login(js->gc); |
| 794 | break; | |
|
3105
8c23b0ec1036
[gaim-migrate @ 3119]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3074
diff
changeset
|
795 | } |
|
8c23b0ec1036
[gaim-migrate @ 3119]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3074
diff
changeset
|
796 | } |
|
8c23b0ec1036
[gaim-migrate @ 3119]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3074
diff
changeset
|
797 | |
| 7014 | 798 | char *jabber_get_next_id(JabberStream *js) |
| 2086 | 799 | { |
| 7322 | 800 | return g_strdup_printf("gaim%x", js->next_id++); |
| 2086 | 801 | } |
| 802 | ||
| 7014 | 803 | void jabber_idle_set(GaimConnection *gc, int idle) |
|
3340
7e59a209931d
[gaim-migrate @ 3359]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3337
diff
changeset
|
804 | { |
| 7014 | 805 | JabberStream *js = gc->proto_data; |
|
3340
7e59a209931d
[gaim-migrate @ 3359]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3337
diff
changeset
|
806 | |
| 7014 | 807 | js->idle = idle ? time(NULL) - idle : idle; |
|
3314
12fa45677717
[gaim-migrate @ 3332]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3311
diff
changeset
|
808 | } |
|
12fa45677717
[gaim-migrate @ 3332]
Jim Seymour <jseymour@users.sourceforge.net>
parents:
3311
diff
changeset
|
809 | |
| 6695 | 810 | static const char *jabber_list_icon(GaimAccount *a, GaimBuddy *b) |
| 2086 | 811 | { |
| 4687 | 812 | return "jabber"; |
| 813 | } | |
| 4916 | 814 | |
| 7014 | 815 | static void jabber_list_emblems(GaimBuddy *b, char **se, char **sw, |
| 816 | char **nw, char **ne) | |
| 4916 | 817 | { |
| 7014 | 818 | JabberStream *js; |
| 819 | JabberBuddy *jb; | |
| 820 | ||
| 821 | if(!b->account->gc) | |
| 822 | return; | |
| 823 | js = b->account->gc->proto_data; | |
| 824 | jb = jabber_buddy_find(js, b->name, FALSE); | |
| 5135 | 825 | |
| 826 | if(!GAIM_BUDDY_IS_ONLINE(b)) { | |
| 7014 | 827 | if(jb && jb->error_msg) |
| 4927 | 828 | *nw = "error"; |
| 5135 | 829 | |
| 7014 | 830 | if(jb && (jb->subscription & JABBER_SUB_PENDING || |
| 831 | !(jb->subscription & JABBER_SUB_TO))) | |
| 5135 | 832 | *se = "notauthorized"; |
| 833 | else | |
| 834 | *se = "offline"; | |
| 4916 | 835 | } else { |
| 836 | switch (b->uc) { | |
| 7014 | 837 | case JABBER_STATE_AWAY: |
| 838 | *se = "away"; | |
| 839 | break; | |
| 840 | case JABBER_STATE_CHAT: | |
| 841 | *se = "chat"; | |
| 842 | break; | |
| 843 | case JABBER_STATE_XA: | |
| 844 | *se = "extendedaway"; | |
| 845 | break; | |
| 846 | case JABBER_STATE_DND: | |
| 847 | *se = "extendedaway"; | |
| 848 | break; | |
| 849 | case JABBER_STATE_ERROR: | |
| 850 | *se = "error"; | |
| 851 | break; | |
| 4916 | 852 | } |
| 2086 | 853 | } |
| 4916 | 854 | } |
| 2086 | 855 | |
| 7014 | 856 | static char *jabber_status_text(GaimBuddy *b) |
|
2205
68c42ce8eba6
[gaim-migrate @ 2215]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2170
diff
changeset
|
857 | { |
| 7014 | 858 | JabberBuddy *jb = jabber_buddy_find(b->account->gc->proto_data, b->name, |
| 859 | FALSE); | |
| 860 | char *ret = NULL; | |
| 5234 | 861 | |
| 7014 | 862 | if(jb && !GAIM_BUDDY_IS_ONLINE(b) && (jb->subscription & JABBER_SUB_PENDING || !(jb->subscription & JABBER_SUB_TO))) { |
| 863 | ret = g_strdup(_("Not Authorized")); | |
| 864 | } else if(jb && !GAIM_BUDDY_IS_ONLINE(b) && jb->error_msg) { | |
| 865 | ret = g_strdup(jb->error_msg); | |
| 2956 | 866 | } else { |
|
7095
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7072
diff
changeset
|
867 | char *stripped; |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7072
diff
changeset
|
868 | |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7072
diff
changeset
|
869 | stripped = gaim_markup_strip_html(jabber_buddy_get_status_msg(jb)); |
| 2956 | 870 | |
| 7014 | 871 | if(!stripped && b->uc & UC_UNAVAILABLE) |
| 872 | stripped = g_strdup(jabber_get_state_string(b->uc)); | |
| 2086 | 873 | |
| 7014 | 874 | if(stripped) { |
| 875 | ret = g_markup_escape_text(stripped, -1); | |
| 876 | g_free(stripped); | |
| 877 | } | |
| 2086 | 878 | } |
| 879 | ||
| 7014 | 880 | return ret; |
| 2956 | 881 | } |
| 882 | ||
| 6695 | 883 | static char *jabber_tooltip_text(GaimBuddy *b) |
| 4744 | 884 | { |
| 7014 | 885 | JabberBuddy *jb = jabber_buddy_find(b->account->gc->proto_data, b->name, |
| 886 | FALSE); | |
| 887 | JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, NULL); | |
| 5135 | 888 | char *ret = NULL; |
| 7014 | 889 | |
| 890 | if(jbr) { | |
| 4777 | 891 | char *text = NULL; |
| 7014 | 892 | if(jbr->status) { |
| 893 | char *stripped; | |
|
7095
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7072
diff
changeset
|
894 | stripped = gaim_markup_strip_html(jbr->status); |
| 7014 | 895 | text = g_markup_escape_text(stripped, -1); |
| 896 | g_free(stripped); | |
| 897 | } | |
| 898 | ||
|
5236
d0667c1c18b2
[gaim-migrate @ 5606]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
5234
diff
changeset
|
899 | ret = g_strdup_printf("<b>%s:</b> %s%s%s", |
|
d0667c1c18b2
[gaim-migrate @ 5606]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
5234
diff
changeset
|
900 | _("Status"), |
| 7014 | 901 | jabber_get_state_string(jbr->state), |
| 902 | text ? ": " : "", | |
| 4745 | 903 | text ? text : ""); |
| 7014 | 904 | if(text) |
| 4745 | 905 | g_free(text); |
| 7014 | 906 | } else if(jb && !GAIM_BUDDY_IS_ONLINE(b) && jb->error_msg) { |
| 907 | ret = g_strdup_printf("<b>%s:</b> %s", | |
| 908 | _("Error"), jb->error_msg); | |
| 909 | } else if(jb && !GAIM_BUDDY_IS_ONLINE(b) && | |
| 910 | (jb->subscription & JABBER_SUB_PENDING || | |
| 911 | !(jb->subscription & JABBER_SUB_TO))) { | |
| 912 | ret = g_strdup_printf("<b>%s:</b> %s", | |
| 913 | _("Status"), _("Not Authorized")); | |
| 4745 | 914 | } |
| 4744 | 915 | |
| 5135 | 916 | return ret; |
| 4732 | 917 | } |
| 918 | ||
| 7014 | 919 | static GList *jabber_away_states(GaimConnection *gc) |
| 920 | { | |
| 2086 | 921 | GList *m = NULL; |
| 922 | ||
| 4982 | 923 | m = g_list_append(m, _("Online")); |
| 924 | m = g_list_append(m, _("Chatty")); | |
| 925 | m = g_list_append(m, _("Away")); | |
| 926 | m = g_list_append(m, _("Extended Away")); | |
| 927 | m = g_list_append(m, _("Do Not Disturb")); | |
| 928 | m = g_list_append(m, _("Invisible")); | |
|
4110
481c7ea9e258
[gaim-migrate @ 4325]
Robert McQueen <robot101@debian.org>
parents:
4074
diff
changeset
|
929 | m = g_list_append(m, GAIM_AWAY_CUSTOM); |
| 2086 | 930 | |
| 931 | return m; | |
| 932 | } | |
| 933 | ||
| 7395 | 934 | static void |
| 935 | jabber_password_change_result_cb(JabberStream *js, xmlnode *packet, | |
| 936 | gpointer data) | |
| 7124 | 937 | { |
| 938 | const char *type; | |
| 939 | ||
| 940 | type = xmlnode_get_attrib(packet, "type"); | |
| 941 | ||
| 942 | if(!strcmp(type, "result")) { | |
| 943 | gaim_notify_info(js->gc, _("Password Changed"), _("Password Changed"), | |
| 944 | _("Your password has been changed.")); | |
| 945 | } else { | |
| 946 | xmlnode *error; | |
| 947 | char *buf, *error_txt = NULL; | |
| 948 | ||
| 949 | ||
| 950 | if((error = xmlnode_get_child(packet, "error"))) | |
| 951 | error_txt = xmlnode_get_data(error); | |
| 952 | ||
| 953 | if(error_txt) { | |
| 954 | buf = g_strdup_printf(_("Error changing password: %s"), | |
| 955 | error_txt); | |
| 956 | g_free(error_txt); | |
| 957 | } else { | |
| 958 | buf = g_strdup(_("Unknown error occurred changing password")); | |
| 959 | } | |
| 960 | ||
| 961 | gaim_notify_error(js->gc, _("Error"), _("Error"), buf); | |
| 962 | g_free(buf); | |
| 963 | } | |
| 964 | } | |
| 965 | ||
| 966 | static void jabber_password_change_cb(JabberStream *js, | |
| 967 | GaimRequestFields *fields) | |
| 968 | { | |
| 969 | const char *p1, *p2; | |
| 970 | JabberIq *iq; | |
| 971 | xmlnode *query, *y; | |
| 972 | ||
| 973 | p1 = gaim_request_fields_get_string(fields, "password1"); | |
| 974 | p2 = gaim_request_fields_get_string(fields, "password2"); | |
| 975 | ||
| 976 | if(strcmp(p1, p2)) { | |
| 977 | gaim_notify_error(js->gc, NULL, _("New passwords do not match."), NULL); | |
| 978 | return; | |
| 979 | } | |
| 980 | ||
| 981 | iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register"); | |
| 982 | ||
| 983 | xmlnode_set_attrib(iq->node, "to", js->user->domain); | |
| 984 | ||
| 985 | query = xmlnode_get_child(iq->node, "query"); | |
| 986 | ||
| 987 | y = xmlnode_new_child(query, "username"); | |
| 988 | xmlnode_insert_data(y, js->user->node, -1); | |
| 989 | y = xmlnode_new_child(query, "password"); | |
| 990 | xmlnode_insert_data(y, p1, -1); | |
| 991 | ||
| 7395 | 992 | jabber_iq_set_callback(iq, jabber_password_change_result_cb, NULL); |
| 7124 | 993 | |
| 994 | jabber_iq_send(iq); | |
| 995 | ||
| 996 | gaim_account_set_password(js->gc->account, p1); | |
| 997 | } | |
| 998 | ||
| 999 | static void jabber_password_change(GaimConnection *gc) | |
| 1000 | { | |
| 1001 | JabberStream *js = gc->proto_data; | |
| 1002 | GaimRequestFields *fields; | |
| 1003 | GaimRequestFieldGroup *group; | |
| 1004 | GaimRequestField *field; | |
| 1005 | ||
| 1006 | fields = gaim_request_fields_new(); | |
| 1007 | group = gaim_request_field_group_new(NULL); | |
| 1008 | gaim_request_fields_add_group(fields, group); | |
| 1009 | ||
| 1010 | field = gaim_request_field_string_new("password1", _("Password"), | |
| 1011 | "", FALSE); | |
| 1012 | gaim_request_field_string_set_masked(field, TRUE); | |
| 1013 | gaim_request_field_group_add_field(group, field); | |
| 1014 | ||
| 1015 | field = gaim_request_field_string_new("password2", _("Password (again)"), | |
| 1016 | "", FALSE); | |
| 1017 | gaim_request_field_string_set_masked(field, TRUE); | |
| 1018 | gaim_request_field_group_add_field(group, field); | |
| 1019 | ||
| 1020 | gaim_request_fields(js->gc, _("Change Jabber Password"), | |
| 1021 | _("Change Jabber Password"), _("Please enter your new password"), | |
| 1022 | fields, _("OK"), G_CALLBACK(jabber_password_change_cb), | |
| 1023 | _("Cancel"), NULL, js); | |
| 1024 | } | |
| 1025 | ||
| 5572 | 1026 | static GList *jabber_actions(GaimConnection *gc) |
| 2956 | 1027 | { |
| 7124 | 1028 | JabberStream *js = gc->proto_data; |
| 2956 | 1029 | GList *m = NULL; |
|
4333
f4c095774bc2
[gaim-migrate @ 4597]
Mark Doliner <markdoliner@pidgin.im>
parents:
4316
diff
changeset
|
1030 | struct proto_actions_menu *pam; |
|
f4c095774bc2
[gaim-migrate @ 4597]
Mark Doliner <markdoliner@pidgin.im>
parents:
4316
diff
changeset
|
1031 | |
|
f4c095774bc2
[gaim-migrate @ 4597]
Mark Doliner <markdoliner@pidgin.im>
parents:
4316
diff
changeset
|
1032 | pam = g_new0(struct proto_actions_menu, 1); |
|
f4c095774bc2
[gaim-migrate @ 4597]
Mark Doliner <markdoliner@pidgin.im>
parents:
4316
diff
changeset
|
1033 | pam->label = _("Set User Info"); |
|
f4c095774bc2
[gaim-migrate @ 4597]
Mark Doliner <markdoliner@pidgin.im>
parents:
4316
diff
changeset
|
1034 | pam->callback = jabber_setup_set_info; |
|
f4c095774bc2
[gaim-migrate @ 4597]
Mark Doliner <markdoliner@pidgin.im>
parents:
4316
diff
changeset
|
1035 | pam->gc = gc; |
|
f4c095774bc2
[gaim-migrate @ 4597]
Mark Doliner <markdoliner@pidgin.im>
parents:
4316
diff
changeset
|
1036 | m = g_list_append(m, pam); |
|
f4c095774bc2
[gaim-migrate @ 4597]
Mark Doliner <markdoliner@pidgin.im>
parents:
4316
diff
changeset
|
1037 | |
| 7124 | 1038 | if(js->protocol_version == JABBER_PROTO_0_9) { |
| 1039 | pam = g_new0(struct proto_actions_menu, 1); | |
| 1040 | pam->label = _("Change Password"); | |
| 1041 | pam->callback = jabber_password_change; | |
| 1042 | pam->gc = gc; | |
| 1043 | m = g_list_append(m, pam); | |
| 1044 | } | |
| 2956 | 1045 | |
| 1046 | return m; | |
| 1047 | } | |
| 1048 | ||
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1049 | static GaimPluginProtocolInfo prpl_info = |
| 2086 | 1050 | { |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1051 | GAIM_PROTO_JABBER, |
| 7014 | 1052 | OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME, |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1053 | NULL, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1054 | NULL, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1055 | jabber_list_icon, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1056 | jabber_list_emblems, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1057 | jabber_status_text, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1058 | jabber_tooltip_text, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1059 | jabber_away_states, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1060 | jabber_actions, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1061 | jabber_buddy_menu, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1062 | jabber_chat_info, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1063 | jabber_login, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1064 | jabber_close, |
| 7014 | 1065 | jabber_message_send_im, |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1066 | jabber_set_info, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1067 | jabber_send_typing, |
| 7014 | 1068 | jabber_buddy_get_info, |
| 1069 | jabber_presence_send, | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1070 | NULL, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1071 | NULL, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1072 | NULL, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1073 | NULL, |
| 7014 | 1074 | jabber_idle_set, |
| 7514 | 1075 | NULL, |
| 7014 | 1076 | jabber_roster_add_buddy, |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1077 | NULL, |
| 7014 | 1078 | jabber_roster_remove_buddy, |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1079 | NULL, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1080 | NULL, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1081 | NULL, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1082 | NULL, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1083 | NULL, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1084 | NULL, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1085 | NULL, |
| 7014 | 1086 | jabber_chat_join, |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1087 | jabber_chat_invite, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1088 | jabber_chat_leave, |
| 7400 | 1089 | NULL, |
| 7014 | 1090 | jabber_message_send_chat, |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1091 | jabber_keepalive, |
| 7072 | 1092 | jabber_register_account, |
| 7014 | 1093 | jabber_buddy_get_info_chat, |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1094 | NULL, |
| 7014 | 1095 | jabber_roster_alias_change, |
| 1096 | jabber_roster_group_change, | |
| 1097 | jabber_roster_group_rename, | |
| 1098 | NULL, | |
| 1099 | NULL, /* convo_closed */ /* XXX: thread_ids */ | |
| 7398 | 1100 | jabber_normalize, |
| 1101 | NULL, /* set_buddy_icon */ | |
| 1102 | NULL, /* remove_group */ | |
| 1103 | jabber_chat_buddy_real_name | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1104 | }; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1105 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1106 | static GaimPluginInfo info = |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1107 | { |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1108 | 2, /**< api_version */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1109 | GAIM_PLUGIN_PROTOCOL, /**< type */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1110 | NULL, /**< ui_requirement */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1111 | 0, /**< flags */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1112 | NULL, /**< dependencies */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1113 | GAIM_PRIORITY_DEFAULT, /**< priority */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1114 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1115 | "prpl-jabber", /**< id */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1116 | "Jabber", /**< name */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1117 | VERSION, /**< version */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1118 | /** summary */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1119 | N_("Jabber Protocol Plugin"), |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1120 | /** description */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1121 | N_("Jabber Protocol Plugin"), |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1122 | NULL, /**< author */ |
|
6371
e92b66ee5518
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6357
diff
changeset
|
1123 | GAIM_WEBSITE, /**< homepage */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1124 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1125 | NULL, /**< load */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1126 | NULL, /**< unload */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1127 | NULL, /**< destroy */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1128 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1129 | NULL, /**< ui_info */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1130 | &prpl_info /**< extra_info */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1131 | }; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1132 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1133 | static void |
|
5920
963bfdefee02
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5894
diff
changeset
|
1134 | init_plugin(GaimPlugin *plugin) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1135 | { |
|
5638
53e752c88ea1
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5613
diff
changeset
|
1136 | GaimAccountUserSplit *split; |
|
53e752c88ea1
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5613
diff
changeset
|
1137 | GaimAccountOption *option; |
|
53e752c88ea1
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5613
diff
changeset
|
1138 | |
|
53e752c88ea1
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5613
diff
changeset
|
1139 | split = gaim_account_user_split_new(_("Server"), "jabber.org", '@'); |
|
53e752c88ea1
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5613
diff
changeset
|
1140 | prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); |
|
53e752c88ea1
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5613
diff
changeset
|
1141 | |
|
53e752c88ea1
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5613
diff
changeset
|
1142 | split = gaim_account_user_split_new(_("Resource"), "Gaim", '/'); |
|
53e752c88ea1
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5613
diff
changeset
|
1143 | prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); |
|
53e752c88ea1
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5613
diff
changeset
|
1144 | |
| 7630 | 1145 | option = gaim_account_option_bool_new(_("Use TLS if available"), "use_tls", |
| 1146 | TRUE); | |
| 1147 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, | |
| 1148 | option); | |
| 1149 | ||
| 1150 | option = gaim_account_option_bool_new(_("Force old SSL"), "old_ssl", FALSE); | |
| 7124 | 1151 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
| 1152 | option); | |
| 6764 | 1153 | |
| 7014 | 1154 | option = gaim_account_option_int_new(_("Port"), "port", 5222); |
|
5638
53e752c88ea1
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5613
diff
changeset
|
1155 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
| 7014 | 1156 | option); |
|
5638
53e752c88ea1
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5613
diff
changeset
|
1157 | |
|
5685
2523e4143d74
[gaim-migrate @ 6106]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1158 | option = gaim_account_option_string_new(_("Connect server"), |
| 7014 | 1159 | "connect_server", NULL); |
|
5638
53e752c88ea1
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5613
diff
changeset
|
1160 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
| 7014 | 1161 | option); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1162 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5174
diff
changeset
|
1163 | my_protocol = plugin; |
| 7014 | 1164 | |
| 1165 | gaim_prefs_add_none("/plugins/prpl/jabber"); | |
| 1166 | gaim_prefs_add_bool("/plugins/prpl/jabber/hide_os", FALSE); | |
| 2086 | 1167 | } |
| 1168 | ||
|
5920
963bfdefee02
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5894
diff
changeset
|
1169 | GAIM_INIT_PLUGIN(jabber, init_plugin, info); |