annotate src/protocols/jabber/jabber.c @ 7019:3fd0aeb71f95

[gaim-migrate @ 7582] jabber needs SSL as well committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Mon, 29 Sep 2003 15:56:14 +0000
parents 67c4e9d39242
children b40f12355812
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1 /*
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
2 * gaim - Jabber Protocol Plugin
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3 *
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
4 * Copyright (C) 2003, Nathan Walp <faceprint@faceprint.com>
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5 *
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
9 * (at your option) any later version.
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
10 *
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
14 * GNU General Public License for more details.
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
15 *
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
19 *
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
20 */
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
21 #include "internal.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
22
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
23 /*
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
24 #include "conversation.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
25 #include "ft.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
26 #include "multi.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
27 #include "notify.h"
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
28 #include "proxy.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
29 #include "request.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
30 #include "util.h"
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
31
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
32 */
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
33
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
34 #include "account.h"
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
35 #include "accountopt.h"
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
36 #include "debug.h"
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
37 #include "html.h"
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
38 #include "message.h"
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
39 #include "multi.h"
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
40 #include "prpl.h"
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
41 #include "server.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
42
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
43 #include "auth.h"
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
44 #include "buddy.h"
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
45 #include "chat.h"
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
46 #include "iq.h"
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
47 #include "jutil.h"
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
48 #include "message.h"
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
49 #include "parser.h"
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
50 #include "presence.h"
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
51 #include "jabber.h"
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
52 #include "roster.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
53
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
54 #define JABBER_CONNECT_STEPS (js->gsc ? 8 : 5)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
55
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
56 static GaimPlugin *my_protocol = NULL;
4249
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
57
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
58 static void jabber_stream_init(JabberStream *js)
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
59 {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
60 char *open_stream;
3340
f56b36347375 [gaim-migrate @ 3359]
Jim Seymour <jseymour>
parents: 3337
diff changeset
61
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
62 open_stream = g_strdup_printf("<stream:stream to='%s' "
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
63 "xmlns='jabber:client' "
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
64 "xmlns:stream='http://etherx.jabber.org/streams' "
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
65 "version='1.0'>", js->user->domain);
3311
522f37c9f9d2 [gaim-migrate @ 3329]
Jim Seymour <jseymour>
parents: 3260
diff changeset
66
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
67 jabber_send_raw(js, open_stream);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
68
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
69 g_free(open_stream);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
70 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
71
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
72 static void jabber_session_initialized_cb(JabberStream *js, xmlnode *packet)
3311
522f37c9f9d2 [gaim-migrate @ 3329]
Jim Seymour <jseymour>
parents: 3260
diff changeset
73 {
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
74 const char *type = xmlnode_get_attrib(packet, "type");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
75 if(type && !strcmp(type, "result")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
76 jabber_stream_set_state(js, JABBER_STREAM_CONNECTED);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
77 } else {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
78 gaim_connection_error(js->gc, _("Error initializing session"));
3311
522f37c9f9d2 [gaim-migrate @ 3329]
Jim Seymour <jseymour>
parents: 3260
diff changeset
79 }
522f37c9f9d2 [gaim-migrate @ 3329]
Jim Seymour <jseymour>
parents: 3260
diff changeset
80 }
522f37c9f9d2 [gaim-migrate @ 3329]
Jim Seymour <jseymour>
parents: 3260
diff changeset
81
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
82 static void jabber_session_init(JabberStream *js)
3311
522f37c9f9d2 [gaim-migrate @ 3329]
Jim Seymour <jseymour>
parents: 3260
diff changeset
83 {
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
84 JabberIq *iq = jabber_iq_new(js, JABBER_IQ_SET);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
85 xmlnode *session;
3311
522f37c9f9d2 [gaim-migrate @ 3329]
Jim Seymour <jseymour>
parents: 3260
diff changeset
86
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
87 jabber_iq_set_callback(iq, jabber_session_initialized_cb);
3311
522f37c9f9d2 [gaim-migrate @ 3329]
Jim Seymour <jseymour>
parents: 3260
diff changeset
88
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
89 session = xmlnode_new_child(iq->node, "session");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
90 xmlnode_set_attrib(session, "xmlns", "urn:ietf:params:xml:ns:xmpp-session");
3311
522f37c9f9d2 [gaim-migrate @ 3329]
Jim Seymour <jseymour>
parents: 3260
diff changeset
91
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
92 jabber_iq_send(iq);
3311
522f37c9f9d2 [gaim-migrate @ 3329]
Jim Seymour <jseymour>
parents: 3260
diff changeset
93 }
522f37c9f9d2 [gaim-migrate @ 3329]
Jim Seymour <jseymour>
parents: 3260
diff changeset
94
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
95 static void jabber_stream_handle_error(JabberStream *js, xmlnode *packet)
3311
522f37c9f9d2 [gaim-migrate @ 3329]
Jim Seymour <jseymour>
parents: 3260
diff changeset
96 {
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
97 xmlnode *textnode;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
98 char *error_text = NULL;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
99 const char *text;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
100 char *buf;
3311
522f37c9f9d2 [gaim-migrate @ 3329]
Jim Seymour <jseymour>
parents: 3260
diff changeset
101
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
102 if(xmlnode_get_child(packet, "bad-format")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
103 text = _("Bad Format");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
104 } else if(xmlnode_get_child(packet, "bad-namespace-prefix")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
105 text = _("Bad Namespace Prefix");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
106 } else if(xmlnode_get_child(packet, "conflict")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
107 js->gc->wants_to_die = TRUE;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
108 text = _("Resource Conflict");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
109 } else if(xmlnode_get_child(packet, "connection-timeout")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
110 text = _("Connection Timeout");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
111 } else if(xmlnode_get_child(packet, "host-gone")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
112 text = _("Host Gone");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
113 } else if(xmlnode_get_child(packet, "host-unknown")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
114 text = _("Host Unknown");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
115 } else if(xmlnode_get_child(packet, "improper-addressing")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
116 text = _("Improper Addressing");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
117 } else if(xmlnode_get_child(packet, "internal-server-error")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
118 text = _("Internal Server Error");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
119 } else if(xmlnode_get_child(packet, "invalid-id")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
120 text = _("Invalid ID");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
121 } else if(xmlnode_get_child(packet, "invalid-namespace")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
122 text = _("Invalid Namespace");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
123 } else if(xmlnode_get_child(packet, "invalid-xml")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
124 text = _("Invalid XML");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
125 } else if(xmlnode_get_child(packet, "nonmatching-hosts")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
126 text = _("Non-matching Hosts");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
127 } else if(xmlnode_get_child(packet, "not-authorized")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
128 text = _("Not Authorized");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
129 } else if(xmlnode_get_child(packet, "policy-violation")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
130 text = _("Policy Violation");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
131 } else if(xmlnode_get_child(packet, "remote-connection-failed")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
132 text = _("Remote Connection Failed");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
133 } else if(xmlnode_get_child(packet, "resource-constraint")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
134 text = _("Resource Constraint");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
135 } else if(xmlnode_get_child(packet, "restricted-xml")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
136 text = _("Restricted XML");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
137 } else if(xmlnode_get_child(packet, "see-other-host")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
138 text = _("See Other Host");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
139 } else if(xmlnode_get_child(packet, "system-shutdown")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
140 text = _("System Shutdown");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
141 } else if(xmlnode_get_child(packet, "undefined-condition")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
142 text = _("Undefined Condition");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
143 } else if(xmlnode_get_child(packet, "unsupported-encoding")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
144 text = _("Unsupported Condition");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
145 } else if(xmlnode_get_child(packet, "unsupported-stanza-type")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
146 text = _("Unsupported Stanza Type");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
147 } else if(xmlnode_get_child(packet, "unsupported-version")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
148 text = _("Unsupported Version");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
149 } else if(xmlnode_get_child(packet, "xml-not-well-formed")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
150 text = _("XML Not Well Formed");
3311
522f37c9f9d2 [gaim-migrate @ 3329]
Jim Seymour <jseymour>
parents: 3260
diff changeset
151 } else {
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
152 text = _("Stream Error");
3311
522f37c9f9d2 [gaim-migrate @ 3329]
Jim Seymour <jseymour>
parents: 3260
diff changeset
153 }
522f37c9f9d2 [gaim-migrate @ 3329]
Jim Seymour <jseymour>
parents: 3260
diff changeset
154
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
155 if((textnode = xmlnode_get_child(packet, "text")))
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
156 error_text = xmlnode_get_data(textnode);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
157
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
158 buf = g_strdup_printf("%s%s%s", text,
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
159 error_text ? ": " : "",
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
160 error_text ? error_text : "");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
161 gaim_connection_error(js->gc, buf);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
162 g_free(buf);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
163 if(error_text)
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
164 g_free(error_text);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
165 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
166
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
167 static void tls_init(JabberStream *js);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
168
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
169 void jabber_process_packet(JabberStream *js, xmlnode *packet)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
170 {
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
171 const char *id = xmlnode_get_attrib(packet, "id");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
172 const char *type = xmlnode_get_attrib(packet, "type");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
173 JabberCallback *callback;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
174
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
175 if(!strcmp(packet->name, "iq")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
176 if(type && (!strcmp(type, "result") || !strcmp(type, "error")) && id
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
177 && *id && (callback = g_hash_table_lookup(js->callbacks, id)))
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
178 callback(js, packet);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
179 else
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
180 jabber_iq_parse(js, packet);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
181 } else if(!strcmp(packet->name, "presence")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
182 jabber_presence_parse(js, packet);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
183 } else if(!strcmp(packet->name, "message")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
184 jabber_message_parse(js, packet);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
185 } else if(!strcmp(packet->name, "stream:features")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
186 if(js->state == JABBER_STREAM_AUTHENTICATING) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
187 jabber_auth_start(js, packet);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
188 } else if(js->state == JABBER_STREAM_REINITIALIZING) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
189 jabber_session_init(js);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
190 } else {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
191 gaim_debug(GAIM_DEBUG_WARNING, "jabber",
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
192 "Unexpected stream:features packet, ignoring\n", js->state);
6076
8d6aa792e0f6 [gaim-migrate @ 6535]
Nathan Walp <nwalp@pidgin.im>
parents: 6059
diff changeset
193 }
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
194 } else if(!strcmp(packet->name, "stream:error")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
195 jabber_stream_handle_error(js, packet);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
196 } else if(!strcmp(packet->name, "challenge")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
197 if(js->state == JABBER_STREAM_AUTHENTICATING)
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
198 jabber_auth_handle_challenge(js, packet);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
199 } else if(!strcmp(packet->name, "success")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
200 if(js->state == JABBER_STREAM_AUTHENTICATING)
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
201 jabber_auth_handle_success(js, packet);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
202 } else if(!strcmp(packet->name, "failure")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
203 if(js->state == JABBER_STREAM_AUTHENTICATING)
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
204 jabber_auth_handle_failure(js, packet);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
205 } else if(!strcmp(packet->name, "proceed")) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
206 if(js->state == JABBER_STREAM_AUTHENTICATING && !js->gsc)
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
207 tls_init(js);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
208 } else {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
209 gaim_debug(GAIM_DEBUG_WARNING, "jabber", "Unknown packet: %s\n",
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
210 packet->name);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
211 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
212 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
213
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
214 void jabber_send_raw(JabberStream *js, const char *data)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
215 {
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
216 int ret;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
217
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
218 /* because printing a tab to debug every minute gets old */
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
219 if(strcmp(data, "\t"))
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
220 gaim_debug(GAIM_DEBUG_MISC, "jabber", "Sending%s: %s\n",
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
221 js->gsc ? " (ssl)" : "", data);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
222
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
223 if(js->gsc) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
224 ret = gaim_ssl_write(js->gsc, data, strlen(data));
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
225 } else {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
226 ret = write(js->fd, data, strlen(data));
2814
f4f9e5a01890 [gaim-migrate @ 2827]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2800
diff changeset
227 }
f4f9e5a01890 [gaim-migrate @ 2827]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2800
diff changeset
228
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
229 if(ret < 0)
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
230 gaim_connection_error(js->gc, _("Write error"));
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
231
2814
f4f9e5a01890 [gaim-migrate @ 2827]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2800
diff changeset
232 }
f4f9e5a01890 [gaim-migrate @ 2827]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2800
diff changeset
233
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
234 void jabber_send(JabberStream *js, xmlnode *packet)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
235 {
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
236 char *txt;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
237
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
238 txt = xmlnode_to_str(packet);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
239 jabber_send_raw(js, txt);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
240 g_free(txt);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
241 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
242
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
243 static void jabber_keepalive(GaimConnection *gc)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
244 {
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
245 jabber_send_raw(gc->proto_data, "\t");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
246 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
247
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
248 static void
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
249 jabber_recv_cb_ssl(gpointer data, GaimSslConnection *gsc,
6764
6d0d4e9149b9 [gaim-migrate @ 7296]
Nathan Walp <nwalp@pidgin.im>
parents: 6695
diff changeset
250 GaimInputCondition cond)
6d0d4e9149b9 [gaim-migrate @ 7296]
Nathan Walp <nwalp@pidgin.im>
parents: 6695
diff changeset
251 {
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
252 GaimConnection *gc = data;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
253 JabberStream *js = gc->proto_data;
6764
6d0d4e9149b9 [gaim-migrate @ 7296]
Nathan Walp <nwalp@pidgin.im>
parents: 6695
diff changeset
254 int len;
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
255 static char buf[4096];
6768
d6b8bf263903 [gaim-migrate @ 7305]
Nathan Walp <nwalp@pidgin.im>
parents: 6764
diff changeset
256
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
257 if(!g_list_find(gaim_connections_get_all(), gc)) {
6768
d6b8bf263903 [gaim-migrate @ 7305]
Nathan Walp <nwalp@pidgin.im>
parents: 6764
diff changeset
258 gaim_ssl_close(gsc);
d6b8bf263903 [gaim-migrate @ 7305]
Nathan Walp <nwalp@pidgin.im>
parents: 6764
diff changeset
259 return;
d6b8bf263903 [gaim-migrate @ 7305]
Nathan Walp <nwalp@pidgin.im>
parents: 6764
diff changeset
260 }
d6b8bf263903 [gaim-migrate @ 7305]
Nathan Walp <nwalp@pidgin.im>
parents: 6764
diff changeset
261
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
262 if((len = gaim_ssl_read(gsc, buf, sizeof(buf) - 1)) > 0) {
6764
6d0d4e9149b9 [gaim-migrate @ 7296]
Nathan Walp <nwalp@pidgin.im>
parents: 6695
diff changeset
263 buf[len] = '\0';
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
264 gaim_debug(GAIM_DEBUG_INFO, "jabber", "Recv (ssl)(%d): %s\n", len, buf);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
265 jabber_parser_process(js, buf, len);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
266 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
267 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
268
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
269 static void
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
270 jabber_recv_cb(gpointer data, gint source, GaimInputCondition condition)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
271 {
5572
dfdea22a7153 [gaim-migrate @ 5974]
Nathan Walp <nwalp@pidgin.im>
parents: 5498
diff changeset
272 GaimConnection *gc = data;
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
273 JabberStream *js = gc->proto_data;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
274 int len;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
275 static char buf[4096];
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
276
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
277 if(!g_list_find(gaim_connections_get_all(), gc))
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
278 return;
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2856
diff changeset
279
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
280 if((len = read(js->fd, buf, sizeof(buf) - 1)) > 0) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
281 buf[len] = '\0';
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
282 gaim_debug(GAIM_DEBUG_INFO, "jabber", "Recv (%d): %s\n", len, buf);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
283 jabber_parser_process(js, buf, len);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
284 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
285 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
286
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
287 static void
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
288 jabber_login_callback_ssl(gpointer data, GaimSslConnection *gsc,
6764
6d0d4e9149b9 [gaim-migrate @ 7296]
Nathan Walp <nwalp@pidgin.im>
parents: 6695
diff changeset
289 GaimInputCondition cond)
6d0d4e9149b9 [gaim-migrate @ 7296]
Nathan Walp <nwalp@pidgin.im>
parents: 6695
diff changeset
290 {
6d0d4e9149b9 [gaim-migrate @ 7296]
Nathan Walp <nwalp@pidgin.im>
parents: 6695
diff changeset
291 GaimConnection *gc = data;
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
292 JabberStream *js = gc->proto_data;
6764
6d0d4e9149b9 [gaim-migrate @ 7296]
Nathan Walp <nwalp@pidgin.im>
parents: 6695
diff changeset
293
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
294 if(!g_list_find(gaim_connections_get_all(), gc)) {
6764
6d0d4e9149b9 [gaim-migrate @ 7296]
Nathan Walp <nwalp@pidgin.im>
parents: 6695
diff changeset
295 gaim_ssl_close(gsc);
6d0d4e9149b9 [gaim-migrate @ 7296]
Nathan Walp <nwalp@pidgin.im>
parents: 6695
diff changeset
296 return;
6d0d4e9149b9 [gaim-migrate @ 7296]
Nathan Walp <nwalp@pidgin.im>
parents: 6695
diff changeset
297 }
6d0d4e9149b9 [gaim-migrate @ 7296]
Nathan Walp <nwalp@pidgin.im>
parents: 6695
diff changeset
298
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
299 js->gsc = gsc;
6764
6d0d4e9149b9 [gaim-migrate @ 7296]
Nathan Walp <nwalp@pidgin.im>
parents: 6695
diff changeset
300
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
301 if(js->state == JABBER_STREAM_CONNECTING)
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
302 jabber_send_raw(js, "<?xml version='1.0' ?>");
6764
6d0d4e9149b9 [gaim-migrate @ 7296]
Nathan Walp <nwalp@pidgin.im>
parents: 6695
diff changeset
303
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
304 jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
305 gaim_ssl_input_add(gsc, jabber_recv_cb_ssl, gc);
6764
6d0d4e9149b9 [gaim-migrate @ 7296]
Nathan Walp <nwalp@pidgin.im>
parents: 6695
diff changeset
306 }
6d0d4e9149b9 [gaim-migrate @ 7296]
Nathan Walp <nwalp@pidgin.im>
parents: 6695
diff changeset
307
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
308
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
309 static void
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
310 jabber_login_callback(gpointer data, gint source, GaimInputCondition cond)
6764
6d0d4e9149b9 [gaim-migrate @ 7296]
Nathan Walp <nwalp@pidgin.im>
parents: 6695
diff changeset
311 {
5572
dfdea22a7153 [gaim-migrate @ 5974]
Nathan Walp <nwalp@pidgin.im>
parents: 5498
diff changeset
312 GaimConnection *gc = data;
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
313 JabberStream *js = gc->proto_data;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
314
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
315 if(!g_list_find(gaim_connections_get_all(), gc)) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
316 close(source);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
317 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
318 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
319
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
320 js->fd = source;
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2856
diff changeset
321
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
322 if(js->state == JABBER_STREAM_CONNECTING)
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
323 jabber_send_raw(js, "<?xml version='1.0' ?>");
2300
d2686f757d6e [gaim-migrate @ 2310]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2289
diff changeset
324
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
325 jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
326 gc->inpa = gaim_input_add(js->fd, GAIM_INPUT_READ, jabber_recv_cb, gc);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
327 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
328
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
329 static void tls_init(JabberStream *js)
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
330 {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
331 gaim_input_remove(js->gc->inpa);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
332 js->gc->inpa = 0;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
333 js->gsc = gaim_ssl_connect_fd(js->gc->account, js->fd,
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
334 jabber_login_callback_ssl, js->gc);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
335 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
336
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
337 static void
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
338 jabber_login(GaimAccount *account)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
339 {
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
340 int rc;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
341 GaimConnection *gc = gaim_account_get_connection(account);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
342 const char *connect_server = gaim_account_get_string(account,
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
343 "connect_server", "");
5572
dfdea22a7153 [gaim-migrate @ 5974]
Nathan Walp <nwalp@pidgin.im>
parents: 5498
diff changeset
344 const char *server;
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
345 JabberStream *js;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
346
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
347 gc->flags |= GAIM_CONNECTION_HTML;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
348 js = gc->proto_data = g_new0(JabberStream, 1);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
349 js->gc = gc;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
350 js->callbacks = g_hash_table_new_full(g_str_hash, g_str_equal,
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
351 g_free, NULL);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
352 js->buddies = g_hash_table_new_full(g_str_hash, g_str_equal,
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
353 g_free, NULL);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
354 js->chats = g_hash_table_new_full(g_str_hash, g_str_equal,
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
355 g_free, NULL);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
356 js->user = jabber_id_new(gaim_account_get_username(account));
5613
3d0a2b9f5a8e [gaim-migrate @ 6019]
Nathan Walp <nwalp@pidgin.im>
parents: 5599
diff changeset
357
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
358 server = connect_server[0] ? connect_server : js->user->domain;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
359
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
360 jabber_stream_set_state(js, JABBER_STREAM_CONNECTING);
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2856
diff changeset
361
6880
8e0f0f492ff1 [gaim-migrate @ 7426]
Nathan Walp <nwalp@pidgin.im>
parents: 6817
diff changeset
362 if(gaim_account_get_bool(account, "old_ssl", FALSE)
6764
6d0d4e9149b9 [gaim-migrate @ 7296]
Nathan Walp <nwalp@pidgin.im>
parents: 6695
diff changeset
363 && gaim_ssl_is_supported()) {
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
364 js->gsc = gaim_ssl_connect(account, server,
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
365 gaim_account_get_int(account, "port", 5222),
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
366 jabber_login_callback_ssl, gc);
3311
522f37c9f9d2 [gaim-migrate @ 3329]
Jim Seymour <jseymour>
parents: 3260
diff changeset
367 }
3770
a72e303e6f5c [gaim-migrate @ 3909]
Sean Egan <seanegan@gmail.com>
parents: 3769
diff changeset
368
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
369 if(!js->gsc) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
370 rc = gaim_proxy_connect(account, server,
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
371 gaim_account_get_int(account, "port", 5222),
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
372 jabber_login_callback, gc);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
373
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
374 if (rc != 0)
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
375 gaim_connection_error(gc, _("Unable to create socket"));
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2856
diff changeset
376 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
377 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
378
5572
dfdea22a7153 [gaim-migrate @ 5974]
Nathan Walp <nwalp@pidgin.im>
parents: 5498
diff changeset
379 static void jabber_close(GaimConnection *gc)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
380 {
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
381 JabberStream *js = gc->proto_data;
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2856
diff changeset
382
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
383 jabber_send_raw(js, "</stream:stream>");
3311
522f37c9f9d2 [gaim-migrate @ 3329]
Jim Seymour <jseymour>
parents: 3260
diff changeset
384
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
385 if(js->gsc) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
386 gaim_ssl_close(js->gsc);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
387 } else {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
388 close(js->fd);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
389 }
3311
522f37c9f9d2 [gaim-migrate @ 3329]
Jim Seymour <jseymour>
parents: 3260
diff changeset
390
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
391 g_markup_parse_context_free(js->context);
5093
89c0c811befa [gaim-migrate @ 5455]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
392
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
393 g_hash_table_destroy(js->callbacks);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
394 g_hash_table_destroy(js->buddies);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
395 if(js->stream_id)
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
396 g_free(js->stream_id);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
397 jabber_id_free(js->user);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
398 g_free(js);
5093
89c0c811befa [gaim-migrate @ 5455]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
399 }
89c0c811befa [gaim-migrate @ 5455]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
400
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
401 void jabber_stream_set_state(JabberStream *js, JabberStreamState state)
3105
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
402 {
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
403 js->state = state;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
404 switch(state) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
405 case JABBER_STREAM_OFFLINE:
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
406 break;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
407 case JABBER_STREAM_CONNECTING:
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
408 gaim_connection_update_progress(js->gc, _("Connecting"), 1,
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
409 JABBER_CONNECT_STEPS);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
410 break;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
411 case JABBER_STREAM_INITIALIZING:
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
412 gaim_connection_update_progress(js->gc, _("Initializing Stream"),
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
413 js->gsc ? 5 : 2, JABBER_CONNECT_STEPS);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
414 jabber_stream_init(js);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
415 jabber_parser_setup(js);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
416 break;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
417 case JABBER_STREAM_AUTHENTICATING:
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
418 gaim_connection_update_progress(js->gc, _("Authenticating"),
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
419 js->gsc ? 6 : 3, JABBER_CONNECT_STEPS);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
420 if(js->protocol_version == JABBER_PROTO_0_9)
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
421 jabber_auth_start_old(js);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
422 break;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
423 case JABBER_STREAM_REINITIALIZING:
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
424 gaim_connection_update_progress(js->gc, _("Re-initializing Stream"),
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
425 6, JABBER_CONNECT_STEPS);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
426 jabber_stream_init(js);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
427 break;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
428 case JABBER_STREAM_CONNECTED:
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
429 gaim_connection_set_state(js->gc, GAIM_CONNECTED);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
430 jabber_roster_request(js);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
431 jabber_presence_send(js->gc, js->gc->away_state, js->gc->away);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
432 serv_finish_login(js->gc);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
433 break;
3105
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
434 }
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
435 }
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
436
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
437 char *jabber_get_next_id(JabberStream *js)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
438 {
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
439 return g_strdup_printf("gaim%d", js->next_id++);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
440 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
441
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
442 void jabber_idle_set(GaimConnection *gc, int idle)
3340
f56b36347375 [gaim-migrate @ 3359]
Jim Seymour <jseymour>
parents: 3337
diff changeset
443 {
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
444 JabberStream *js = gc->proto_data;
3340
f56b36347375 [gaim-migrate @ 3359]
Jim Seymour <jseymour>
parents: 3337
diff changeset
445
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
446 js->idle = idle ? time(NULL) - idle : idle;
3314
52db87ab4083 [gaim-migrate @ 3332]
Jim Seymour <jseymour>
parents: 3311
diff changeset
447 }
52db87ab4083 [gaim-migrate @ 3332]
Jim Seymour <jseymour>
parents: 3311
diff changeset
448
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6640
diff changeset
449 static const char *jabber_list_icon(GaimAccount *a, GaimBuddy *b)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
450 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4675
diff changeset
451 return "jabber";
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4675
diff changeset
452 }
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4915
diff changeset
453
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
454 static void jabber_list_emblems(GaimBuddy *b, char **se, char **sw,
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
455 char **nw, char **ne)
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4915
diff changeset
456 {
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
457 JabberStream *js;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
458 JabberBuddy *jb;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
459
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
460 if(!b->account->gc)
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
461 return;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
462 js = b->account->gc->proto_data;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
463 jb = jabber_buddy_find(js, b->name, FALSE);
5135
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5112
diff changeset
464
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5112
diff changeset
465 if(!GAIM_BUDDY_IS_ONLINE(b)) {
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
466 if(jb && jb->error_msg)
4927
afffba7c292e [gaim-migrate @ 5261]
Nathan Walp <nwalp@pidgin.im>
parents: 4921
diff changeset
467 *nw = "error";
5135
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5112
diff changeset
468
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
469 if(jb && (jb->subscription & JABBER_SUB_PENDING ||
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
470 !(jb->subscription & JABBER_SUB_TO)))
5135
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5112
diff changeset
471 *se = "notauthorized";
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5112
diff changeset
472 else
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5112
diff changeset
473 *se = "offline";
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4915
diff changeset
474 } else {
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4915
diff changeset
475 switch (b->uc) {
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
476 case JABBER_STATE_AWAY:
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
477 *se = "away";
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
478 break;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
479 case JABBER_STATE_CHAT:
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
480 *se = "chat";
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
481 break;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
482 case JABBER_STATE_XA:
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
483 *se = "extendedaway";
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
484 break;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
485 case JABBER_STATE_DND:
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
486 *se = "extendedaway";
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
487 break;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
488 case JABBER_STATE_ERROR:
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
489 *se = "error";
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
490 break;
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4915
diff changeset
491 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
492 }
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4915
diff changeset
493 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
494
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
495 static char *jabber_status_text(GaimBuddy *b)
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2170
diff changeset
496 {
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
497 JabberBuddy *jb = jabber_buddy_find(b->account->gc->proto_data, b->name,
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
498 FALSE);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
499 char *ret = NULL;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5223
diff changeset
500
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
501 if(jb && !GAIM_BUDDY_IS_ONLINE(b) && (jb->subscription & JABBER_SUB_PENDING || !(jb->subscription & JABBER_SUB_TO))) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
502 ret = g_strdup(_("Not Authorized"));
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
503 } else if(jb && !GAIM_BUDDY_IS_ONLINE(b) && jb->error_msg) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
504 ret = g_strdup(jb->error_msg);
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2856
diff changeset
505 } else {
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
506 char *stripped = strip_html(jabber_buddy_get_status_msg(jb));
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2856
diff changeset
507
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
508 if(!stripped && b->uc & UC_UNAVAILABLE)
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
509 stripped = g_strdup(jabber_get_state_string(b->uc));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
510
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
511 if(stripped) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
512 ret = g_markup_escape_text(stripped, -1);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
513 g_free(stripped);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
514 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
515 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
516
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
517 return ret;
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2856
diff changeset
518 }
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2856
diff changeset
519
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6640
diff changeset
520 static char *jabber_tooltip_text(GaimBuddy *b)
4744
a0746ffce599 [gaim-migrate @ 5059]
Sean Egan <seanegan@gmail.com>
parents: 4732
diff changeset
521 {
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
522 JabberBuddy *jb = jabber_buddy_find(b->account->gc->proto_data, b->name,
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
523 FALSE);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
524 JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, NULL);
5135
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5112
diff changeset
525 char *ret = NULL;
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
526
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
527 if(jbr) {
4777
e23a7e166680 [gaim-migrate @ 5097]
Nathan Walp <nwalp@pidgin.im>
parents: 4775
diff changeset
528 char *text = NULL;
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
529 if(jbr->status) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
530 char *stripped;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
531 stripped = strip_html(jbr->status);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
532 text = g_markup_escape_text(stripped, -1);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
533 g_free(stripped);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
534 }
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
535
5236
0d4b8ca97c17 [gaim-migrate @ 5606]
Luke Schierer <lschiere@pidgin.im>
parents: 5234
diff changeset
536 ret = g_strdup_printf("<b>%s:</b> %s%s%s",
0d4b8ca97c17 [gaim-migrate @ 5606]
Luke Schierer <lschiere@pidgin.im>
parents: 5234
diff changeset
537 _("Status"),
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
538 jabber_get_state_string(jbr->state),
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
539 text ? ": " : "",
4745
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
540 text ? text : "");
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
541 if(text)
4745
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
542 g_free(text);
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
543 } else if(jb && !GAIM_BUDDY_IS_ONLINE(b) && jb->error_msg) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
544 ret = g_strdup_printf("<b>%s:</b> %s",
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
545 _("Error"), jb->error_msg);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
546 } else if(jb && !GAIM_BUDDY_IS_ONLINE(b) &&
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
547 (jb->subscription & JABBER_SUB_PENDING ||
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
548 !(jb->subscription & JABBER_SUB_TO))) {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
549 ret = g_strdup_printf("<b>%s:</b> %s",
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
550 _("Status"), _("Not Authorized"));
4745
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
551 }
4744
a0746ffce599 [gaim-migrate @ 5059]
Sean Egan <seanegan@gmail.com>
parents: 4732
diff changeset
552
5135
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5112
diff changeset
553 return ret;
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4705
diff changeset
554 }
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4705
diff changeset
555
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
556 static GList *jabber_away_states(GaimConnection *gc)
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
557 {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
558 GList *m = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
559
4982
fb232515839a [gaim-migrate @ 5317]
Nathan Walp <nwalp@pidgin.im>
parents: 4966
diff changeset
560 m = g_list_append(m, _("Online"));
fb232515839a [gaim-migrate @ 5317]
Nathan Walp <nwalp@pidgin.im>
parents: 4966
diff changeset
561 m = g_list_append(m, _("Chatty"));
fb232515839a [gaim-migrate @ 5317]
Nathan Walp <nwalp@pidgin.im>
parents: 4966
diff changeset
562 m = g_list_append(m, _("Away"));
fb232515839a [gaim-migrate @ 5317]
Nathan Walp <nwalp@pidgin.im>
parents: 4966
diff changeset
563 m = g_list_append(m, _("Extended Away"));
fb232515839a [gaim-migrate @ 5317]
Nathan Walp <nwalp@pidgin.im>
parents: 4966
diff changeset
564 m = g_list_append(m, _("Do Not Disturb"));
fb232515839a [gaim-migrate @ 5317]
Nathan Walp <nwalp@pidgin.im>
parents: 4966
diff changeset
565 m = g_list_append(m, _("Invisible"));
4110
64d983d6b7bb [gaim-migrate @ 4325]
Luke Schierer <lschiere@pidgin.im>
parents: 4074
diff changeset
566 m = g_list_append(m, GAIM_AWAY_CUSTOM);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
567
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
568 return m;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
569 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
570
5572
dfdea22a7153 [gaim-migrate @ 5974]
Nathan Walp <nwalp@pidgin.im>
parents: 5498
diff changeset
571 static GList *jabber_actions(GaimConnection *gc)
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2856
diff changeset
572 {
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2856
diff changeset
573 GList *m = NULL;
4333
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4316
diff changeset
574 struct proto_actions_menu *pam;
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4316
diff changeset
575
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4316
diff changeset
576 pam = g_new0(struct proto_actions_menu, 1);
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4316
diff changeset
577 pam->label = _("Set User Info");
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4316
diff changeset
578 pam->callback = jabber_setup_set_info;
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4316
diff changeset
579 pam->gc = gc;
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4316
diff changeset
580 m = g_list_append(m, pam);
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4316
diff changeset
581
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
582 /* XXX: Change Password */
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2856
diff changeset
583
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2856
diff changeset
584 return m;
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2856
diff changeset
585 }
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2856
diff changeset
586
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
587 static GaimPluginProtocolInfo prpl_info =
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
588 {
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
589 GAIM_PROTO_JABBER,
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
590 OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
591 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
592 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
593 jabber_list_icon,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
594 jabber_list_emblems,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
595 jabber_status_text,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
596 jabber_tooltip_text,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
597 jabber_away_states,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
598 jabber_actions,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
599 jabber_buddy_menu,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
600 jabber_chat_info,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
601 jabber_login,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
602 jabber_close,
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
603 jabber_message_send_im,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
604 jabber_set_info,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
605 jabber_send_typing,
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
606 jabber_buddy_get_info,
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
607 jabber_presence_send,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
608 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
609 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
610 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
611 NULL,
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
612 jabber_idle_set,
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
613 NULL, /* change_passwd */ /* XXX */
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
614 jabber_roster_add_buddy,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
615 NULL,
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
616 jabber_roster_remove_buddy,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
617 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
618 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
619 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
620 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
621 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
622 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
623 NULL,
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
624 jabber_chat_join,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
625 jabber_chat_invite,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
626 jabber_chat_leave,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
627 jabber_chat_whisper,
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
628 jabber_message_send_chat,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
629 jabber_keepalive,
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
630 NULL, /* register_user */ /* XXX tell the user success/failure */
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
631 jabber_buddy_get_info_chat,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
632 NULL,
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
633 jabber_roster_alias_change,
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
634 jabber_roster_group_change,
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
635 jabber_roster_group_rename,
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
636 NULL,
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
637 NULL, /* convo_closed */ /* XXX: thread_ids */
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
638 NULL /* normalize */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
639 };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
640
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
641 static GaimPluginInfo info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
642 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
643 2, /**< api_version */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
644 GAIM_PLUGIN_PROTOCOL, /**< type */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
645 NULL, /**< ui_requirement */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
646 0, /**< flags */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
647 NULL, /**< dependencies */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
648 GAIM_PRIORITY_DEFAULT, /**< priority */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
649
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
650 "prpl-jabber", /**< id */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
651 "Jabber", /**< name */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
652 VERSION, /**< version */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
653 /** summary */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
654 N_("Jabber Protocol Plugin"),
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
655 /** description */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
656 N_("Jabber Protocol Plugin"),
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
657 NULL, /**< author */
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 6357
diff changeset
658 GAIM_WEBSITE, /**< homepage */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
659
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
660 NULL, /**< load */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
661 NULL, /**< unload */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
662 NULL, /**< destroy */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
663
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
664 NULL, /**< ui_info */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
665 &prpl_info /**< extra_info */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
666 };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
667
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
668 static void
5920
7d385de2f9cd [gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents: 5894
diff changeset
669 init_plugin(GaimPlugin *plugin)
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
670 {
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5613
diff changeset
671 GaimAccountUserSplit *split;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5613
diff changeset
672 GaimAccountOption *option;
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5613
diff changeset
673
7019
3fd0aeb71f95 [gaim-migrate @ 7582]
Nathan Walp <nwalp@pidgin.im>
parents: 7014
diff changeset
674 info.dependencies = g_list_append(info.dependencies, "core-ssl");
3fd0aeb71f95 [gaim-migrate @ 7582]
Nathan Walp <nwalp@pidgin.im>
parents: 7014
diff changeset
675
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5613
diff changeset
676 split = gaim_account_user_split_new(_("Server"), "jabber.org", '@');
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5613
diff changeset
677 prpl_info.user_splits = g_list_append(prpl_info.user_splits, split);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5613
diff changeset
678
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5613
diff changeset
679 split = gaim_account_user_split_new(_("Resource"), "Gaim", '/');
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5613
diff changeset
680 prpl_info.user_splits = g_list_append(prpl_info.user_splits, split);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5613
diff changeset
681
6764
6d0d4e9149b9 [gaim-migrate @ 7296]
Nathan Walp <nwalp@pidgin.im>
parents: 6695
diff changeset
682 if(gaim_ssl_is_supported()) {
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
683 option = gaim_account_option_bool_new(_("Force Old SSL"), "old_ssl", FALSE);
6764
6d0d4e9149b9 [gaim-migrate @ 7296]
Nathan Walp <nwalp@pidgin.im>
parents: 6695
diff changeset
684 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
6d0d4e9149b9 [gaim-migrate @ 7296]
Nathan Walp <nwalp@pidgin.im>
parents: 6695
diff changeset
685 option);
6d0d4e9149b9 [gaim-migrate @ 7296]
Nathan Walp <nwalp@pidgin.im>
parents: 6695
diff changeset
686 }
6d0d4e9149b9 [gaim-migrate @ 7296]
Nathan Walp <nwalp@pidgin.im>
parents: 6695
diff changeset
687
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
688 option = gaim_account_option_int_new(_("Port"), "port", 5222);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5613
diff changeset
689 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
690 option);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5613
diff changeset
691
5685
43ea75092684 [gaim-migrate @ 6106]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
692 option = gaim_account_option_string_new(_("Connect server"),
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
693 "connect_server", NULL);
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5613
diff changeset
694 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
695 option);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
696
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5174
diff changeset
697 my_protocol = plugin;
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
698
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
699 gaim_prefs_add_none("/plugins/prpl/jabber");
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 6982
diff changeset
700 gaim_prefs_add_bool("/plugins/prpl/jabber/hide_os", FALSE);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
701 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
702
5920
7d385de2f9cd [gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents: 5894
diff changeset
703 GAIM_INIT_PLUGIN(jabber, init_plugin, info);