Mercurial > pidgin
annotate libpurple/connection.c @ 28247:bc87a89e4401
merge of '9ce1a7ac92f523b7b5b9983746ae57ee1fac1a67'
and 'ebf771e2c74addf4821a643a9c9179f4adc67c3b'
author | Etan Reisner <pidgin@unreliablesource.net> |
---|---|
date | Tue, 08 Sep 2009 02:23:49 +0000 |
parents | 815d9ce1a8b0 |
children | dab0d17dc6c1 |
rev | line source |
---|---|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2 * @file connection.c Connection API |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * @ingroup core |
20074
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19697
diff
changeset
|
4 */ |
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19697
diff
changeset
|
5 |
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19697
diff
changeset
|
6 /* purple |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * |
15822 | 8 * Purple is the legal property of its developers, whose names are too numerous |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * to list here. Please refer to the COPYRIGHT file distributed with this |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * source distribution. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
22 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 * along with this program; if not, write to the Free Software |
19681
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19654
diff
changeset
|
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
25 */ |
24350
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
22214
diff
changeset
|
26 #define _PURPLE_CONNECTION_C_ |
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
22214
diff
changeset
|
27 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 #include "internal.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 #include "account.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 #include "blist.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #include "connection.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 #include "dbus-maybe.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 #include "debug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #include "log.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 #include "notify.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 #include "prefs.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 #include "proxy.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 #include "request.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 #include "server.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 #include "signals.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 #include "util.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 |
21750
fb8ab2490ac4
De-magic number the prpl_info->keepalive interval, and document it.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21714
diff
changeset
|
43 #define KEEPALIVE_INTERVAL 30 |
fb8ab2490ac4
De-magic number the prpl_info->keepalive interval, and document it.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21714
diff
changeset
|
44 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 static GList *connections = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 static GList *connections_connecting = NULL; |
15822 | 47 static PurpleConnectionUiOps *connection_ui_ops = NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 static int connections_handle; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 static gboolean |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 send_keepalive(gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 { |
15822 | 54 PurpleConnection *gc = data; |
55 PurplePluginProtocolInfo *prpl_info = NULL; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
56 |
22149
252b96b6a32c
Don't send keep-alives if we've received data since in the last KEEPALIVE_INTERVAL seconds
Sean Egan <seanegan@gmail.com>
parents:
22042
diff
changeset
|
57 if (gc == NULL) |
22202
fbdf8136c98c
send_keepalive needs to return TRUE to ensure it'll get called again, and
Stu Tomlinson <stu@nosnilmot.com>
parents:
22149
diff
changeset
|
58 return TRUE; |
22149
252b96b6a32c
Don't send keep-alives if we've received data since in the last KEEPALIVE_INTERVAL seconds
Sean Egan <seanegan@gmail.com>
parents:
22042
diff
changeset
|
59 |
252b96b6a32c
Don't send keep-alives if we've received data since in the last KEEPALIVE_INTERVAL seconds
Sean Egan <seanegan@gmail.com>
parents:
22042
diff
changeset
|
60 /* Only send keep-alives if we haven't heard from the |
22202
fbdf8136c98c
send_keepalive needs to return TRUE to ensure it'll get called again, and
Stu Tomlinson <stu@nosnilmot.com>
parents:
22149
diff
changeset
|
61 * server in a while. |
fbdf8136c98c
send_keepalive needs to return TRUE to ensure it'll get called again, and
Stu Tomlinson <stu@nosnilmot.com>
parents:
22149
diff
changeset
|
62 */ |
22149
252b96b6a32c
Don't send keep-alives if we've received data since in the last KEEPALIVE_INTERVAL seconds
Sean Egan <seanegan@gmail.com>
parents:
22042
diff
changeset
|
63 if ((time(NULL) - gc->last_received) < KEEPALIVE_INTERVAL) |
22202
fbdf8136c98c
send_keepalive needs to return TRUE to ensure it'll get called again, and
Stu Tomlinson <stu@nosnilmot.com>
parents:
22149
diff
changeset
|
64 return TRUE; |
22149
252b96b6a32c
Don't send keep-alives if we've received data since in the last KEEPALIVE_INTERVAL seconds
Sean Egan <seanegan@gmail.com>
parents:
22042
diff
changeset
|
65 |
252b96b6a32c
Don't send keep-alives if we've received data since in the last KEEPALIVE_INTERVAL seconds
Sean Egan <seanegan@gmail.com>
parents:
22042
diff
changeset
|
66 if (gc->prpl == NULL) |
22202
fbdf8136c98c
send_keepalive needs to return TRUE to ensure it'll get called again, and
Stu Tomlinson <stu@nosnilmot.com>
parents:
22149
diff
changeset
|
67 return TRUE; |
22149
252b96b6a32c
Don't send keep-alives if we've received data since in the last KEEPALIVE_INTERVAL seconds
Sean Egan <seanegan@gmail.com>
parents:
22042
diff
changeset
|
68 |
252b96b6a32c
Don't send keep-alives if we've received data since in the last KEEPALIVE_INTERVAL seconds
Sean Egan <seanegan@gmail.com>
parents:
22042
diff
changeset
|
69 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
70 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
71 if (prpl_info && prpl_info->keepalive) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
72 prpl_info->keepalive(gc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
73 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
74 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
75 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
76 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
77 static void |
15822 | 78 update_keepalive(PurpleConnection *gc, gboolean on) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 { |
15822 | 80 PurplePluginProtocolInfo *prpl_info = NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
82 if (gc != NULL && gc->prpl != NULL) |
15822 | 83 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
84 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 if (!prpl_info || !prpl_info->keepalive) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
86 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
87 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
88 if (on && !gc->keepalive) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
89 { |
15822 | 90 purple_debug_info("connection", "Activating keepalive.\n"); |
21750
fb8ab2490ac4
De-magic number the prpl_info->keepalive interval, and document it.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21714
diff
changeset
|
91 gc->keepalive = purple_timeout_add_seconds(KEEPALIVE_INTERVAL, send_keepalive, gc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 else if (!on && gc->keepalive > 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
94 { |
15822 | 95 purple_debug_info("connection", "Deactivating keepalive.\n"); |
96 purple_timeout_remove(gc->keepalive); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
97 gc->keepalive = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
98 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
99 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
100 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 void |
15822 | 102 purple_connection_new(PurpleAccount *account, gboolean regist, const char *password) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
103 { |
24350
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
22214
diff
changeset
|
104 _purple_connection_new(account, regist, password); |
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
22214
diff
changeset
|
105 } |
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
22214
diff
changeset
|
106 |
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
22214
diff
changeset
|
107 void |
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
22214
diff
changeset
|
108 _purple_connection_new(PurpleAccount *account, gboolean regist, const char *password) |
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
22214
diff
changeset
|
109 { |
15822 | 110 PurpleConnection *gc; |
111 PurplePlugin *prpl; | |
112 PurplePluginProtocolInfo *prpl_info; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
114 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
115 |
15822 | 116 if (!purple_account_is_disconnected(account)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 |
15822 | 119 prpl = purple_find_prpl(purple_account_get_protocol_id(account)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
120 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
121 if (prpl != NULL) |
15822 | 122 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 gchar *message; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
125 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
126 message = g_strdup_printf(_("Missing protocol plugin for %s"), |
15822 | 127 purple_account_get_username(account)); |
128 purple_notify_error(NULL, regist ? _("Registration Error") : | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 _("Connection Error"), message, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
130 g_free(message); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
131 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
132 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
133 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
134 if (regist) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
135 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
136 if (prpl_info->register_user == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
137 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
138 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
139 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
140 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
141 if (((password == NULL) || (*password == '\0')) && |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
142 !(prpl_info->options & OPT_PROTO_NO_PASSWORD) && |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
143 !(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
144 { |
15822 | 145 purple_debug_error("connection", "Can not connect to account %s without " |
146 "a password.\n", purple_account_get_username(account)); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
147 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
148 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
149 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
150 |
15822 | 151 gc = g_new0(PurpleConnection, 1); |
152 PURPLE_DBUS_REGISTER_POINTER(gc, PurpleConnection); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
153 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
154 gc->prpl = prpl; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
155 if ((password != NULL) && (*password != '\0')) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
156 gc->password = g_strdup(password); |
15822 | 157 purple_connection_set_account(gc, account); |
158 purple_connection_set_state(gc, PURPLE_CONNECTING); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 connections = g_list_append(connections, gc); |
15822 | 160 purple_account_set_connection(account, gc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 |
15822 | 162 purple_signal_emit(purple_connections_get_handle(), "signing-on", gc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
164 if (regist) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 { |
15822 | 166 purple_debug_info("connection", "Registering. gc = %p\n", gc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
167 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
168 /* set this so we don't auto-reconnect after registering */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 gc->wants_to_die = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
171 prpl_info->register_user(account); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
172 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
173 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
174 { |
15822 | 175 purple_debug_info("connection", "Connecting. gc = %p\n", gc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
176 |
15822 | 177 purple_signal_emit(purple_accounts_get_handle(), "account-connecting", account); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
178 prpl_info->login(account); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
179 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
180 } |
24350
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
22214
diff
changeset
|
181 void |
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
22214
diff
changeset
|
182 purple_connection_new_unregister(PurpleAccount *account, const char *password, PurpleAccountUnregistrationCb cb, void *user_data) |
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
22214
diff
changeset
|
183 { |
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
22214
diff
changeset
|
184 _purple_connection_new_unregister(account, password, cb, user_data); |
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
22214
diff
changeset
|
185 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
186 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
187 void |
24350
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
22214
diff
changeset
|
188 _purple_connection_new_unregister(PurpleAccount *account, const char *password, PurpleAccountUnregistrationCb cb, void *user_data) |
18703
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
189 { |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
190 /* Lots of copy/pasted code to avoid API changes. You might want to integrate that into the previous function when posssible. */ |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
191 PurpleConnection *gc; |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
192 PurplePlugin *prpl; |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
193 PurplePluginProtocolInfo *prpl_info; |
25924
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25910
diff
changeset
|
194 |
18703
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
195 g_return_if_fail(account != NULL); |
25924
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25910
diff
changeset
|
196 |
18703
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
197 prpl = purple_find_prpl(purple_account_get_protocol_id(account)); |
25924
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25910
diff
changeset
|
198 |
18703
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
199 if (prpl != NULL) |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
200 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
201 else { |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
202 gchar *message; |
25924
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25910
diff
changeset
|
203 |
18703
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
204 message = g_strdup_printf(_("Missing protocol plugin for %s"), |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
205 purple_account_get_username(account)); |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
206 purple_notify_error(NULL, _("Unregistration Error"), message, NULL); |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
207 g_free(message); |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
208 return; |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
209 } |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
210 |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
211 if (!purple_account_is_disconnected(account)) { |
18920
2a9d60d7af82
Implemented a callback for unregistering, mirroring the registration callback. Since this is a new API, I can do it properly by passing it right in the unregister function call, instead of having a separate function for setting it.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18703
diff
changeset
|
212 prpl_info->unregister_user(account, cb, user_data); |
18703
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
213 return; |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
214 } |
25924
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25910
diff
changeset
|
215 |
18703
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
216 if (((password == NULL) || (*password == '\0')) && |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
217 !(prpl_info->options & OPT_PROTO_NO_PASSWORD) && |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
218 !(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL)) |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
219 { |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
220 purple_debug_error("connection", "Can not connect to account %s without " |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
221 "a password.\n", purple_account_get_username(account)); |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
222 return; |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
223 } |
25924
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25910
diff
changeset
|
224 |
18703
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
225 gc = g_new0(PurpleConnection, 1); |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
226 PURPLE_DBUS_REGISTER_POINTER(gc, PurpleConnection); |
25924
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25910
diff
changeset
|
227 |
18703
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
228 gc->prpl = prpl; |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
229 if ((password != NULL) && (*password != '\0')) |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
230 gc->password = g_strdup(password); |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
231 purple_connection_set_account(gc, account); |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
232 purple_connection_set_state(gc, PURPLE_CONNECTING); |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
233 connections = g_list_append(connections, gc); |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
234 purple_account_set_connection(account, gc); |
25924
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25910
diff
changeset
|
235 |
18703
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
236 purple_signal_emit(purple_connections_get_handle(), "signing-on", gc); |
25924
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25910
diff
changeset
|
237 |
18703
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
238 purple_debug_info("connection", "Unregistering. gc = %p\n", gc); |
25924
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25910
diff
changeset
|
239 |
18920
2a9d60d7af82
Implemented a callback for unregistering, mirroring the registration callback. Since this is a new API, I can do it properly by passing it right in the unregister function call, instead of having a separate function for setting it.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18703
diff
changeset
|
240 prpl_info->unregister_user(account, cb, user_data); |
18703
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
241 } |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
242 |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18114
diff
changeset
|
243 void |
15822 | 244 purple_connection_destroy(PurpleConnection *gc) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
245 { |
24350
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
22214
diff
changeset
|
246 _purple_connection_destroy(gc); |
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
22214
diff
changeset
|
247 } |
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
22214
diff
changeset
|
248 |
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
22214
diff
changeset
|
249 void |
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
22214
diff
changeset
|
250 _purple_connection_destroy(PurpleConnection *gc) |
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
22214
diff
changeset
|
251 { |
15822 | 252 PurpleAccount *account; |
16806
10f175539cfe
Change a few functions to free a linked list while iterating through
Mark Doliner <mark@kingant.net>
parents:
16424
diff
changeset
|
253 GSList *buddies; |
15822 | 254 PurplePluginProtocolInfo *prpl_info = NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
255 gboolean remove = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
256 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
257 g_return_if_fail(gc != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
258 |
15822 | 259 account = purple_connection_get_account(gc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
260 |
15822 | 261 purple_debug_info("connection", "Disconnecting connection %p\n", gc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
262 |
15822 | 263 if (purple_connection_get_state(gc) != PURPLE_CONNECTING) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
264 remove = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
265 |
15822 | 266 purple_signal_emit(purple_connections_get_handle(), "signing-off", gc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
267 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
268 while (gc->buddy_chats) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
269 { |
15822 | 270 PurpleConversation *b = gc->buddy_chats->data; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
271 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
272 gc->buddy_chats = g_slist_remove(gc->buddy_chats, b); |
15822 | 273 purple_conv_chat_left(PURPLE_CONV_CHAT(b)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
275 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
276 update_keepalive(gc, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
277 |
15822 | 278 purple_proxy_connect_cancel_with_handle(gc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
279 |
15822 | 280 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
281 if (prpl_info->close) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 (prpl_info->close)(gc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
283 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 /* Clear out the proto data that was freed in the prpl close method*/ |
15822 | 285 buddies = purple_find_buddies(account, NULL); |
16806
10f175539cfe
Change a few functions to free a linked list while iterating through
Mark Doliner <mark@kingant.net>
parents:
16424
diff
changeset
|
286 while (buddies != NULL) { |
10f175539cfe
Change a few functions to free a linked list while iterating through
Mark Doliner <mark@kingant.net>
parents:
16424
diff
changeset
|
287 PurpleBuddy *buddy = buddies->data; |
25790
9ded0fb57e1c
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22214
diff
changeset
|
288 purple_buddy_set_protocol_data(buddy, NULL); |
16806
10f175539cfe
Change a few functions to free a linked list while iterating through
Mark Doliner <mark@kingant.net>
parents:
16424
diff
changeset
|
289 buddies = g_slist_delete_link(buddies, buddies); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
290 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
291 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
292 connections = g_list_remove(connections, gc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 |
15822 | 294 purple_connection_set_state(gc, PURPLE_DISCONNECTED); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
295 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
296 if (remove) |
15822 | 297 purple_blist_remove_account(account); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
298 |
15822 | 299 purple_signal_emit(purple_connections_get_handle(), "signed-off", gc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
300 |
15822 | 301 purple_account_request_close_with_account(account); |
302 purple_request_close_with_handle(gc); | |
303 purple_notify_close_with_handle(gc); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
304 |
15822 | 305 purple_debug_info("connection", "Destroying connection %p\n", gc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
306 |
15822 | 307 purple_account_set_connection(account, NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
308 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
309 g_free(gc->password); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
310 g_free(gc->display_name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
311 |
27112
aa2a2eae9c3e
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <mark@kingant.net>
parents:
25924
diff
changeset
|
312 if (gc->disconnect_timeout > 0) |
15822 | 313 purple_timeout_remove(gc->disconnect_timeout); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
314 |
15822 | 315 PURPLE_DBUS_UNREGISTER_POINTER(gc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
316 g_free(gc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
317 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
318 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
319 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 * d:)->-< |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 * d:O-\-< |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
323 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 * d:D-/-< |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
326 * d8D->-< DANCE! |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
327 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
328 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
329 void |
15822 | 330 purple_connection_set_state(PurpleConnection *gc, PurpleConnectionState state) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
331 { |
15822 | 332 PurpleConnectionUiOps *ops; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
333 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
334 g_return_if_fail(gc != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
335 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
336 if (gc->state == state) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
337 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
338 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
339 gc->state = state; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 |
15822 | 341 ops = purple_connections_get_ui_ops(); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
342 |
15822 | 343 if (gc->state == PURPLE_CONNECTING) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
344 connections_connecting = g_list_append(connections_connecting, gc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
345 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
346 else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
347 connections_connecting = g_list_remove(connections_connecting, gc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
348 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
349 |
15822 | 350 if (gc->state == PURPLE_CONNECTED) { |
351 PurpleAccount *account; | |
352 PurplePresence *presence; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
353 |
15822 | 354 account = purple_connection_get_account(gc); |
355 presence = purple_account_get_presence(account); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
356 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
357 /* Set the time the account came online */ |
15822 | 358 purple_presence_set_login_time(presence, time(NULL)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
359 |
16424
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
15828
diff
changeset
|
360 if (purple_prefs_get_bool("/purple/logging/log_system")) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
361 { |
15822 | 362 PurpleLog *log = purple_account_get_log(account, TRUE); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
363 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
364 if (log != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
365 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
366 char *msg = g_strdup_printf(_("+++ %s signed on"), |
15822 | 367 purple_account_get_username(account)); |
368 purple_log_write(log, PURPLE_MESSAGE_SYSTEM, | |
369 purple_account_get_username(account), | |
370 purple_presence_get_login_time(presence), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
371 msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
372 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
373 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
374 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
375 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
376 if (ops != NULL && ops->connected != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
377 ops->connected(gc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
378 |
15822 | 379 purple_blist_add_account(account); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
380 |
15822 | 381 purple_signal_emit(purple_connections_get_handle(), "signed-on", gc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
382 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
383 serv_set_permit_deny(gc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
384 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
385 update_keepalive(gc, TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
386 } |
15822 | 387 else if (gc->state == PURPLE_DISCONNECTED) { |
388 PurpleAccount *account = purple_connection_get_account(gc); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
389 |
16424
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
15828
diff
changeset
|
390 if (purple_prefs_get_bool("/purple/logging/log_system")) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
391 { |
15822 | 392 PurpleLog *log = purple_account_get_log(account, FALSE); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
393 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
394 if (log != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
395 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
396 char *msg = g_strdup_printf(_("+++ %s signed off"), |
15822 | 397 purple_account_get_username(account)); |
398 purple_log_write(log, PURPLE_MESSAGE_SYSTEM, | |
399 purple_account_get_username(account), time(NULL), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
400 msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
401 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
402 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
403 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
404 |
15822 | 405 purple_account_destroy_log(account); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
406 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
407 if (ops != NULL && ops->disconnected != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
408 ops->disconnected(gc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
409 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
410 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
411 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
412 void |
15822 | 413 purple_connection_set_account(PurpleConnection *gc, PurpleAccount *account) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
414 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
415 g_return_if_fail(gc != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
416 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
417 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
418 gc->account = account; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
419 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
420 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
421 void |
15822 | 422 purple_connection_set_display_name(PurpleConnection *gc, const char *name) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
423 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
424 g_return_if_fail(gc != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
425 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
426 g_free(gc->display_name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
427 gc->display_name = g_strdup(name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
428 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
429 |
25790
9ded0fb57e1c
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22214
diff
changeset
|
430 void |
9ded0fb57e1c
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22214
diff
changeset
|
431 purple_connection_set_protocol_data(PurpleConnection *connection, void *proto_data) { |
9ded0fb57e1c
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22214
diff
changeset
|
432 g_return_if_fail(connection != NULL); |
9ded0fb57e1c
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22214
diff
changeset
|
433 |
9ded0fb57e1c
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22214
diff
changeset
|
434 connection->proto_data = proto_data; |
9ded0fb57e1c
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22214
diff
changeset
|
435 } |
9ded0fb57e1c
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22214
diff
changeset
|
436 |
15822 | 437 PurpleConnectionState |
438 purple_connection_get_state(const PurpleConnection *gc) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
439 { |
15822 | 440 g_return_val_if_fail(gc != NULL, PURPLE_DISCONNECTED); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
441 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
442 return gc->state; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
443 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
444 |
15822 | 445 PurpleAccount * |
446 purple_connection_get_account(const PurpleConnection *gc) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
447 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
448 g_return_val_if_fail(gc != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
449 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
450 return gc->account; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
451 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
452 |
22214
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22202
diff
changeset
|
453 PurplePlugin * |
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22202
diff
changeset
|
454 purple_connection_get_prpl(const PurpleConnection *gc) |
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22202
diff
changeset
|
455 { |
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22202
diff
changeset
|
456 g_return_val_if_fail(gc != NULL, NULL); |
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22202
diff
changeset
|
457 |
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22202
diff
changeset
|
458 return gc->prpl; |
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22202
diff
changeset
|
459 } |
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22202
diff
changeset
|
460 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
461 const char * |
15822 | 462 purple_connection_get_password(const PurpleConnection *gc) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
463 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
464 g_return_val_if_fail(gc != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
465 |
21119
7a87450fdafe
Since the XMPP PurpleConnection is created before we know we need a password,
Nathan Walp <nwalp@pidgin.im>
parents:
20074
diff
changeset
|
466 return gc->password ? gc->password : gc->account->password; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
467 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
468 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
469 const char * |
15822 | 470 purple_connection_get_display_name(const PurpleConnection *gc) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
471 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
472 g_return_val_if_fail(gc != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
473 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
474 return gc->display_name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
475 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
476 |
25790
9ded0fb57e1c
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22214
diff
changeset
|
477 void * |
9ded0fb57e1c
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22214
diff
changeset
|
478 purple_connection_get_protocol_data(const PurpleConnection *connection) { |
9ded0fb57e1c
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22214
diff
changeset
|
479 g_return_val_if_fail(connection != NULL, NULL); |
9ded0fb57e1c
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22214
diff
changeset
|
480 |
9ded0fb57e1c
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22214
diff
changeset
|
481 return connection->proto_data; |
9ded0fb57e1c
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22214
diff
changeset
|
482 } |
9ded0fb57e1c
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22214
diff
changeset
|
483 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
484 void |
15822 | 485 purple_connection_update_progress(PurpleConnection *gc, const char *text, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
486 size_t step, size_t count) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
487 { |
15822 | 488 PurpleConnectionUiOps *ops; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
489 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
490 g_return_if_fail(gc != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
491 g_return_if_fail(text != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
492 g_return_if_fail(step < count); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
493 g_return_if_fail(count > 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
494 |
15822 | 495 ops = purple_connections_get_ui_ops(); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
496 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
497 if (ops != NULL && ops->connect_progress != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
498 ops->connect_progress(gc, text, step, count); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
499 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
500 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
501 void |
15822 | 502 purple_connection_notice(PurpleConnection *gc, const char *text) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
503 { |
15822 | 504 PurpleConnectionUiOps *ops; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
505 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
506 g_return_if_fail(gc != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
507 g_return_if_fail(text != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
508 |
15822 | 509 ops = purple_connections_get_ui_ops(); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
510 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
511 if (ops != NULL && ops->notice != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
512 ops->notice(gc, text); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
513 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
514 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
515 static gboolean |
15822 | 516 purple_connection_disconnect_cb(gpointer data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
517 { |
27112
aa2a2eae9c3e
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <mark@kingant.net>
parents:
25924
diff
changeset
|
518 PurpleAccount *account; |
aa2a2eae9c3e
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <mark@kingant.net>
parents:
25924
diff
changeset
|
519 PurpleConnection *gc; |
aa2a2eae9c3e
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <mark@kingant.net>
parents:
25924
diff
changeset
|
520 char *password; |
aa2a2eae9c3e
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <mark@kingant.net>
parents:
25924
diff
changeset
|
521 |
aa2a2eae9c3e
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <mark@kingant.net>
parents:
25924
diff
changeset
|
522 account = data; |
aa2a2eae9c3e
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <mark@kingant.net>
parents:
25924
diff
changeset
|
523 gc = purple_account_get_connection(account); |
aa2a2eae9c3e
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <mark@kingant.net>
parents:
25924
diff
changeset
|
524 |
aa2a2eae9c3e
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <mark@kingant.net>
parents:
25924
diff
changeset
|
525 gc->disconnect_timeout = 0; |
aa2a2eae9c3e
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <mark@kingant.net>
parents:
25924
diff
changeset
|
526 |
aa2a2eae9c3e
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <mark@kingant.net>
parents:
25924
diff
changeset
|
527 password = g_strdup(purple_account_get_password(account)); |
15822 | 528 purple_account_disconnect(account); |
529 purple_account_set_password(account, password); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
530 g_free(password); |
27112
aa2a2eae9c3e
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <mark@kingant.net>
parents:
25924
diff
changeset
|
531 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
532 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
533 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
534 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
535 void |
15822 | 536 purple_connection_error(PurpleConnection *gc, const char *text) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
537 { |
20818
c560286daede
Clarify the documentation of the return value of
Will Thompson <will.thompson@collabora.co.uk>
parents:
20817
diff
changeset
|
538 /* prpls that have not been updated to use disconnection reasons will |
c560286daede
Clarify the documentation of the return value of
Will Thompson <will.thompson@collabora.co.uk>
parents:
20817
diff
changeset
|
539 * be setting wants_to_die before calling this function, so choose |
21358 | 540 * PURPLE_CONNECTION_ERROR_OTHER_ERROR (which is fatal) if it's true, |
541 * and PURPLE_CONNECTION_ERROR_NETWORK_ERROR (which isn't) if not. See | |
542 * the documentation in connection.h. | |
20818
c560286daede
Clarify the documentation of the return value of
Will Thompson <will.thompson@collabora.co.uk>
parents:
20817
diff
changeset
|
543 */ |
21358 | 544 PurpleConnectionError reason = gc->wants_to_die |
545 ? PURPLE_CONNECTION_ERROR_OTHER_ERROR | |
546 : PURPLE_CONNECTION_ERROR_NETWORK_ERROR; | |
20813
66e7b104b4ea
rlaager pointed out that purple_connection_error_reason should be setting
Will Thompson <will.thompson@collabora.co.uk>
parents:
20792
diff
changeset
|
547 purple_connection_error_reason (gc, reason, text); |
20066
95b2b7a39585
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <will.thompson@collabora.co.uk>
parents:
19697
diff
changeset
|
548 } |
95b2b7a39585
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <will.thompson@collabora.co.uk>
parents:
19697
diff
changeset
|
549 |
95b2b7a39585
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <will.thompson@collabora.co.uk>
parents:
19697
diff
changeset
|
550 void |
95b2b7a39585
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <will.thompson@collabora.co.uk>
parents:
19697
diff
changeset
|
551 purple_connection_error_reason (PurpleConnection *gc, |
21358 | 552 PurpleConnectionError reason, |
20066
95b2b7a39585
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <will.thompson@collabora.co.uk>
parents:
19697
diff
changeset
|
553 const char *description) |
95b2b7a39585
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <will.thompson@collabora.co.uk>
parents:
19697
diff
changeset
|
554 { |
15822 | 555 PurpleConnectionUiOps *ops; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
556 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
557 g_return_if_fail(gc != NULL); |
21358 | 558 /* This sanity check relies on PURPLE_CONNECTION_ERROR_OTHER_ERROR |
559 * being the last member of the PurpleConnectionError enum in | |
560 * connection.h; if other reasons are added after it, this check should | |
561 * be updated. | |
21357
5a3242b676ad
rlaager suggested using the last element of the PurpleDisconnectReason enum
Will Thompson <will.thompson@collabora.co.uk>
parents:
20818
diff
changeset
|
562 */ |
21358 | 563 if (reason > PURPLE_CONNECTION_ERROR_OTHER_ERROR) { |
21357
5a3242b676ad
rlaager suggested using the last element of the PurpleDisconnectReason enum
Will Thompson <will.thompson@collabora.co.uk>
parents:
20818
diff
changeset
|
564 purple_debug_error("connection", |
5a3242b676ad
rlaager suggested using the last element of the PurpleDisconnectReason enum
Will Thompson <will.thompson@collabora.co.uk>
parents:
20818
diff
changeset
|
565 "purple_connection_error_reason: reason %u isn't a " |
5a3242b676ad
rlaager suggested using the last element of the PurpleDisconnectReason enum
Will Thompson <will.thompson@collabora.co.uk>
parents:
20818
diff
changeset
|
566 "valid reason\n", reason); |
21358 | 567 reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR; |
21357
5a3242b676ad
rlaager suggested using the last element of the PurpleDisconnectReason enum
Will Thompson <will.thompson@collabora.co.uk>
parents:
20818
diff
changeset
|
568 } |
15786
b25acae693cd
Change connection.c:gaim_connection_error() to still work even if the
Mark Doliner <mark@kingant.net>
parents:
15477
diff
changeset
|
569 |
20066
95b2b7a39585
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <will.thompson@collabora.co.uk>
parents:
19697
diff
changeset
|
570 if (description == NULL) { |
25362
43a093eb913f
Slightly improve this debug error message
Mark Doliner <mark@kingant.net>
parents:
24350
diff
changeset
|
571 purple_debug_error("connection", "purple_connection_error_reason called with NULL description\n"); |
20066
95b2b7a39585
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <will.thompson@collabora.co.uk>
parents:
19697
diff
changeset
|
572 description = _("Unknown error"); |
15786
b25acae693cd
Change connection.c:gaim_connection_error() to still work even if the
Mark Doliner <mark@kingant.net>
parents:
15477
diff
changeset
|
573 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
574 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
575 /* If we've already got one error, we don't need any more */ |
27112
aa2a2eae9c3e
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <mark@kingant.net>
parents:
25924
diff
changeset
|
576 if (gc->disconnect_timeout > 0) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
577 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
578 |
21358 | 579 gc->wants_to_die = purple_connection_error_is_fatal (reason); |
20813
66e7b104b4ea
rlaager pointed out that purple_connection_error_reason should be setting
Will Thompson <will.thompson@collabora.co.uk>
parents:
20792
diff
changeset
|
580 |
27813
815d9ce1a8b0
Log the reason for disconnection to the debug log, so that we might
Stu Tomlinson <stu@nosnilmot.com>
parents:
27112
diff
changeset
|
581 purple_debug_info("connection", "Connection error on %p (reason: %u description: %s)\n", |
815d9ce1a8b0
Log the reason for disconnection to the debug log, so that we might
Stu Tomlinson <stu@nosnilmot.com>
parents:
27112
diff
changeset
|
582 gc, reason, description); |
815d9ce1a8b0
Log the reason for disconnection to the debug log, so that we might
Stu Tomlinson <stu@nosnilmot.com>
parents:
27112
diff
changeset
|
583 |
15822 | 584 ops = purple_connections_get_ui_ops(); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
585 |
20066
95b2b7a39585
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <will.thompson@collabora.co.uk>
parents:
19697
diff
changeset
|
586 if (ops != NULL) |
95b2b7a39585
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <will.thompson@collabora.co.uk>
parents:
19697
diff
changeset
|
587 { |
95b2b7a39585
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <will.thompson@collabora.co.uk>
parents:
19697
diff
changeset
|
588 if (ops->report_disconnect_reason != NULL) |
95b2b7a39585
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <will.thompson@collabora.co.uk>
parents:
19697
diff
changeset
|
589 ops->report_disconnect_reason (gc, reason, description); |
95b2b7a39585
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <will.thompson@collabora.co.uk>
parents:
19697
diff
changeset
|
590 if (ops->report_disconnect != NULL) |
95b2b7a39585
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <will.thompson@collabora.co.uk>
parents:
19697
diff
changeset
|
591 ops->report_disconnect (gc, description); |
95b2b7a39585
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <will.thompson@collabora.co.uk>
parents:
19697
diff
changeset
|
592 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
593 |
21364
5a7202fa43a0
I figured a signal firing on a connection error would be useful.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21358
diff
changeset
|
594 purple_signal_emit(purple_connections_get_handle(), "connection-error", |
5a7202fa43a0
I figured a signal firing on a connection error would be useful.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21358
diff
changeset
|
595 gc, reason, description); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
596 |
15822 | 597 gc->disconnect_timeout = purple_timeout_add(0, purple_connection_disconnect_cb, |
598 purple_connection_get_account(gc)); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
599 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
600 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
601 void |
20115
a68d51d60177
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <will.thompson@collabora.co.uk>
parents:
20114
diff
changeset
|
602 purple_connection_ssl_error (PurpleConnection *gc, |
a68d51d60177
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <will.thompson@collabora.co.uk>
parents:
20114
diff
changeset
|
603 PurpleSslErrorType ssl_error) |
a68d51d60177
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <will.thompson@collabora.co.uk>
parents:
20114
diff
changeset
|
604 { |
21358 | 605 PurpleConnectionError reason; |
20115
a68d51d60177
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <will.thompson@collabora.co.uk>
parents:
20114
diff
changeset
|
606 |
a68d51d60177
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <will.thompson@collabora.co.uk>
parents:
20114
diff
changeset
|
607 switch (ssl_error) { |
a68d51d60177
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <will.thompson@collabora.co.uk>
parents:
20114
diff
changeset
|
608 case PURPLE_SSL_HANDSHAKE_FAILED: |
22041
da0b37abe4bd
Adjust some network error fatalities and things
Stu Tomlinson <stu@nosnilmot.com>
parents:
21750
diff
changeset
|
609 reason = PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR; |
da0b37abe4bd
Adjust some network error fatalities and things
Stu Tomlinson <stu@nosnilmot.com>
parents:
21750
diff
changeset
|
610 break; |
20115
a68d51d60177
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <will.thompson@collabora.co.uk>
parents:
20114
diff
changeset
|
611 case PURPLE_SSL_CONNECT_FAILED: |
22041
da0b37abe4bd
Adjust some network error fatalities and things
Stu Tomlinson <stu@nosnilmot.com>
parents:
21750
diff
changeset
|
612 reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
20115
a68d51d60177
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <will.thompson@collabora.co.uk>
parents:
20114
diff
changeset
|
613 break; |
a68d51d60177
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <will.thompson@collabora.co.uk>
parents:
20114
diff
changeset
|
614 case PURPLE_SSL_CERTIFICATE_INVALID: |
a68d51d60177
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <will.thompson@collabora.co.uk>
parents:
20114
diff
changeset
|
615 /* TODO: maybe PURPLE_SSL_* should be more specific? */ |
22042
7553cbc95504
Huh, you want to be able to compile? I clearly (or not so clearly) need new
Stu Tomlinson <stu@nosnilmot.com>
parents:
22041
diff
changeset
|
616 reason = PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR; |
20115
a68d51d60177
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <will.thompson@collabora.co.uk>
parents:
20114
diff
changeset
|
617 break; |
a68d51d60177
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <will.thompson@collabora.co.uk>
parents:
20114
diff
changeset
|
618 default: |
a68d51d60177
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <will.thompson@collabora.co.uk>
parents:
20114
diff
changeset
|
619 g_assert_not_reached (); |
22042
7553cbc95504
Huh, you want to be able to compile? I clearly (or not so clearly) need new
Stu Tomlinson <stu@nosnilmot.com>
parents:
22041
diff
changeset
|
620 reason = PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR; |
20115
a68d51d60177
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <will.thompson@collabora.co.uk>
parents:
20114
diff
changeset
|
621 } |
a68d51d60177
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <will.thompson@collabora.co.uk>
parents:
20114
diff
changeset
|
622 |
21358 | 623 purple_connection_error_reason (gc, reason, |
624 purple_ssl_strerror(ssl_error)); | |
20115
a68d51d60177
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <will.thompson@collabora.co.uk>
parents:
20114
diff
changeset
|
625 } |
a68d51d60177
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <will.thompson@collabora.co.uk>
parents:
20114
diff
changeset
|
626 |
20067
143c6f34c6eb
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <will.thompson@collabora.co.uk>
parents:
20066
diff
changeset
|
627 gboolean |
21358 | 628 purple_connection_error_is_fatal (PurpleConnectionError reason) |
20067
143c6f34c6eb
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <will.thompson@collabora.co.uk>
parents:
20066
diff
changeset
|
629 { |
143c6f34c6eb
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <will.thompson@collabora.co.uk>
parents:
20066
diff
changeset
|
630 switch (reason) |
143c6f34c6eb
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <will.thompson@collabora.co.uk>
parents:
20066
diff
changeset
|
631 { |
21358 | 632 case PURPLE_CONNECTION_ERROR_NETWORK_ERROR: |
22041
da0b37abe4bd
Adjust some network error fatalities and things
Stu Tomlinson <stu@nosnilmot.com>
parents:
21750
diff
changeset
|
633 case PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR: |
21423
375d10e84c4b
Consensus on #pidgin is that certificate errors and AUTHENTICATION_IMPOSSIBLE
Will Thompson <will.thompson@collabora.co.uk>
parents:
21422
diff
changeset
|
634 return FALSE; |
375d10e84c4b
Consensus on #pidgin is that certificate errors and AUTHENTICATION_IMPOSSIBLE
Will Thompson <will.thompson@collabora.co.uk>
parents:
21422
diff
changeset
|
635 case PURPLE_CONNECTION_ERROR_INVALID_USERNAME: |
375d10e84c4b
Consensus on #pidgin is that certificate errors and AUTHENTICATION_IMPOSSIBLE
Will Thompson <will.thompson@collabora.co.uk>
parents:
21422
diff
changeset
|
636 case PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED: |
21358 | 637 case PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE: |
21423
375d10e84c4b
Consensus on #pidgin is that certificate errors and AUTHENTICATION_IMPOSSIBLE
Will Thompson <will.thompson@collabora.co.uk>
parents:
21422
diff
changeset
|
638 case PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT: |
375d10e84c4b
Consensus on #pidgin is that certificate errors and AUTHENTICATION_IMPOSSIBLE
Will Thompson <will.thompson@collabora.co.uk>
parents:
21422
diff
changeset
|
639 case PURPLE_CONNECTION_ERROR_NAME_IN_USE: |
375d10e84c4b
Consensus on #pidgin is that certificate errors and AUTHENTICATION_IMPOSSIBLE
Will Thompson <will.thompson@collabora.co.uk>
parents:
21422
diff
changeset
|
640 case PURPLE_CONNECTION_ERROR_INVALID_SETTINGS: |
375d10e84c4b
Consensus on #pidgin is that certificate errors and AUTHENTICATION_IMPOSSIBLE
Will Thompson <will.thompson@collabora.co.uk>
parents:
21422
diff
changeset
|
641 case PURPLE_CONNECTION_ERROR_OTHER_ERROR: |
21358 | 642 case PURPLE_CONNECTION_ERROR_CERT_NOT_PROVIDED: |
643 case PURPLE_CONNECTION_ERROR_CERT_UNTRUSTED: | |
644 case PURPLE_CONNECTION_ERROR_CERT_EXPIRED: | |
645 case PURPLE_CONNECTION_ERROR_CERT_NOT_ACTIVATED: | |
646 case PURPLE_CONNECTION_ERROR_CERT_HOSTNAME_MISMATCH: | |
647 case PURPLE_CONNECTION_ERROR_CERT_FINGERPRINT_MISMATCH: | |
648 case PURPLE_CONNECTION_ERROR_CERT_SELF_SIGNED: | |
649 case PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR: | |
20067
143c6f34c6eb
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <will.thompson@collabora.co.uk>
parents:
20066
diff
changeset
|
650 return TRUE; |
20817
38d7c849d444
datallah pointed out that using g_return_if_fail() is preferable to
Will Thompson <will.thompson@collabora.co.uk>
parents:
20813
diff
changeset
|
651 default: |
38d7c849d444
datallah pointed out that using g_return_if_fail() is preferable to
Will Thompson <will.thompson@collabora.co.uk>
parents:
20813
diff
changeset
|
652 g_return_val_if_reached(TRUE); |
20067
143c6f34c6eb
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <will.thompson@collabora.co.uk>
parents:
20066
diff
changeset
|
653 } |
143c6f34c6eb
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <will.thompson@collabora.co.uk>
parents:
20066
diff
changeset
|
654 } |
143c6f34c6eb
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <will.thompson@collabora.co.uk>
parents:
20066
diff
changeset
|
655 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
656 void |
15822 | 657 purple_connections_disconnect_all(void) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
658 { |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
659 GList *l; |
15822 | 660 PurpleConnection *gc; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
661 |
15822 | 662 while ((l = purple_connections_get_all()) != NULL) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
663 gc = l->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
664 gc->wants_to_die = TRUE; |
15822 | 665 purple_account_disconnect(gc->account); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
666 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
667 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
668 |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
669 GList * |
15822 | 670 purple_connections_get_all(void) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
671 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
672 return connections; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
673 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
674 |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
675 GList * |
15822 | 676 purple_connections_get_connecting(void) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
677 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
678 return connections_connecting; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
679 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
680 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
681 void |
15822 | 682 purple_connections_set_ui_ops(PurpleConnectionUiOps *ops) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
683 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
684 connection_ui_ops = ops; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
685 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
686 |
15822 | 687 PurpleConnectionUiOps * |
688 purple_connections_get_ui_ops(void) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
689 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
690 return connection_ui_ops; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
691 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
692 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
693 void |
15822 | 694 purple_connections_init(void) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
695 { |
15822 | 696 void *handle = purple_connections_get_handle(); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
697 |
15822 | 698 purple_signal_register(handle, "signing-on", |
699 purple_marshal_VOID__POINTER, NULL, 1, | |
700 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
701 PURPLE_SUBTYPE_CONNECTION)); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
702 |
15822 | 703 purple_signal_register(handle, "signed-on", |
704 purple_marshal_VOID__POINTER, NULL, 1, | |
705 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
706 PURPLE_SUBTYPE_CONNECTION)); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
707 |
15822 | 708 purple_signal_register(handle, "signing-off", |
709 purple_marshal_VOID__POINTER, NULL, 1, | |
710 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
711 PURPLE_SUBTYPE_CONNECTION)); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
712 |
15822 | 713 purple_signal_register(handle, "signed-off", |
714 purple_marshal_VOID__POINTER, NULL, 1, | |
715 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
716 PURPLE_SUBTYPE_CONNECTION)); | |
21364
5a7202fa43a0
I figured a signal firing on a connection error would be useful.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21358
diff
changeset
|
717 |
5a7202fa43a0
I figured a signal firing on a connection error would be useful.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21358
diff
changeset
|
718 purple_signal_register(handle, "connection-error", |
21490
f9b468c5d0aa
Register the correct number of values for the "connection-error" signal.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21424
diff
changeset
|
719 purple_marshal_VOID__POINTER_INT_POINTER, NULL, 3, |
21364
5a7202fa43a0
I figured a signal firing on a connection error would be useful.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21358
diff
changeset
|
720 purple_value_new(PURPLE_TYPE_SUBTYPE, |
5a7202fa43a0
I figured a signal firing on a connection error would be useful.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21358
diff
changeset
|
721 PURPLE_SUBTYPE_CONNECTION), |
5a7202fa43a0
I figured a signal firing on a connection error would be useful.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21358
diff
changeset
|
722 purple_value_new(PURPLE_TYPE_ENUM), |
5a7202fa43a0
I figured a signal firing on a connection error would be useful.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21358
diff
changeset
|
723 purple_value_new(PURPLE_TYPE_STRING)); |
5a7202fa43a0
I figured a signal firing on a connection error would be useful.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21358
diff
changeset
|
724 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
725 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
726 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
727 void |
15822 | 728 purple_connections_uninit(void) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
729 { |
15822 | 730 purple_signals_unregister_by_instance(purple_connections_get_handle()); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
731 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
732 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
733 void * |
15822 | 734 purple_connections_get_handle(void) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
735 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
736 return &connections_handle; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
737 } |