Mercurial > pidgin.yaz
annotate libpurple/connection.c @ 32816:ec6371d4cae8
Add purple_account_is_disconnecting() accessor function.
author | andrew.victor@mxit.com |
---|---|
date | Sun, 06 Nov 2011 20:31:14 +0000 |
parents | 50cd80d3554e |
children |
rev | line source |
---|---|
15374
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:
19696
diff
changeset
|
4 */ |
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19696
diff
changeset
|
5 |
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19696
diff
changeset
|
6 /* purple |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * |
15823 | 8 * Purple is the legal property of its developers, whose names are too numerous |
15374
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 |
19680
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19653
diff
changeset
|
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
25 */ |
24292
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 |
15374
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 |
15374
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; |
15823 | 47 static PurpleConnectionUiOps *connection_ui_ops = NULL; |
15374
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 { |
15823 | 54 PurpleConnection *gc = data; |
28650
dab0d17dc6c1
Minor cleanup. gc->prpl is guarranteed to be a PurplePlugin with
Mark Doliner <mark@kingant.net>
parents:
28153
diff
changeset
|
55 PurplePluginProtocolInfo *prpl_info; |
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
|
56 |
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 /* 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
|
58 * 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
|
59 */ |
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
|
60 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
|
61 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
|
62 |
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 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); |
28650
dab0d17dc6c1
Minor cleanup. gc->prpl is guarranteed to be a PurplePlugin with
Mark Doliner <mark@kingant.net>
parents:
28153
diff
changeset
|
64 if (prpl_info->keepalive) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
65 prpl_info->keepalive(gc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
66 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
67 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
68 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
69 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
70 static void |
15823 | 71 update_keepalive(PurpleConnection *gc, gboolean on) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
72 { |
15823 | 73 PurplePluginProtocolInfo *prpl_info = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
74 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
75 if (gc != NULL && gc->prpl != NULL) |
15823 | 76 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
77 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
78 if (!prpl_info || !prpl_info->keepalive) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
80 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 if (on && !gc->keepalive) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
82 { |
15823 | 83 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
|
84 gc->keepalive = purple_timeout_add_seconds(KEEPALIVE_INTERVAL, send_keepalive, gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
86 else if (!on && gc->keepalive > 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
87 { |
15823 | 88 purple_debug_info("connection", "Deactivating keepalive.\n"); |
89 purple_timeout_remove(gc->keepalive); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 gc->keepalive = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
91 } |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
94 void |
24292
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
22214
diff
changeset
|
95 _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
|
96 { |
15823 | 97 PurpleConnection *gc; |
98 PurplePlugin *prpl; | |
99 PurplePluginProtocolInfo *prpl_info; | |
15374
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 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
102 |
15823 | 103 if (!purple_account_is_disconnected(account)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
104 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 |
15823 | 106 prpl = purple_find_prpl(purple_account_get_protocol_id(account)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
107 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 if (prpl != NULL) |
15823 | 109 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
110 else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
111 gchar *message; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 message = g_strdup_printf(_("Missing protocol plugin for %s"), |
15823 | 114 purple_account_get_username(account)); |
115 purple_notify_error(NULL, regist ? _("Registration Error") : | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 _("Connection Error"), message, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 g_free(message); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
119 } |
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 (regist) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
122 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 if (prpl_info->register_user == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 return; |
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 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
128 if (((password == NULL) || (*password == '\0')) && |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 !(prpl_info->options & OPT_PROTO_NO_PASSWORD) && |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
130 !(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
131 { |
31078
53f51201b39f
While looking for where "Can not resolve <hostname>" was coming from, I found these.
Paul Aurich <paul@darkrain42.org>
parents:
30650
diff
changeset
|
132 purple_debug_error("connection", "Cannot connect to account %s without " |
15823 | 133 "a password.\n", purple_account_get_username(account)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
134 return; |
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 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
137 |
15823 | 138 gc = g_new0(PurpleConnection, 1); |
139 PURPLE_DBUS_REGISTER_POINTER(gc, PurpleConnection); | |
15374
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 gc->prpl = prpl; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
142 if ((password != NULL) && (*password != '\0')) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
143 gc->password = g_strdup(password); |
15823 | 144 purple_connection_set_account(gc, account); |
145 purple_connection_set_state(gc, PURPLE_CONNECTING); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
146 connections = g_list_append(connections, gc); |
15823 | 147 purple_account_set_connection(account, gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
148 |
15823 | 149 purple_signal_emit(purple_connections_get_handle(), "signing-on", gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
150 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
151 if (regist) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 { |
15823 | 153 purple_debug_info("connection", "Registering. gc = %p\n", gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
154 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
155 /* 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
|
156 gc->wants_to_die = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
157 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 prpl_info->register_user(account); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 { |
15823 | 162 purple_debug_info("connection", "Connecting. gc = %p\n", gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 |
15823 | 164 purple_signal_emit(purple_accounts_get_handle(), "account-connecting", account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 prpl_info->login(account); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 } |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 void |
24292
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
22214
diff
changeset
|
170 _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
|
171 { |
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
|
172 /* 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
|
173 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
|
174 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
|
175 PurplePluginProtocolInfo *prpl_info; |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25401
diff
changeset
|
176 |
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
|
177 g_return_if_fail(account != NULL); |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25401
diff
changeset
|
178 |
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
|
179 prpl = purple_find_prpl(purple_account_get_protocol_id(account)); |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25401
diff
changeset
|
180 |
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
|
181 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
|
182 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
|
183 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
|
184 gchar *message; |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25401
diff
changeset
|
185 |
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
|
186 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
|
187 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
|
188 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
|
189 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
|
190 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
|
191 } |
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 |
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 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
|
194 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
|
195 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
|
196 } |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25401
diff
changeset
|
197 |
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
|
198 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
|
199 !(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
|
200 !(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
|
201 { |
31078
53f51201b39f
While looking for where "Can not resolve <hostname>" was coming from, I found these.
Paul Aurich <paul@darkrain42.org>
parents:
30650
diff
changeset
|
202 purple_debug_error("connection", "Cannot connect to account %s without " |
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
|
203 "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
|
204 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
|
205 } |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25401
diff
changeset
|
206 |
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
|
207 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
|
208 PURPLE_DBUS_REGISTER_POINTER(gc, PurpleConnection); |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25401
diff
changeset
|
209 |
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
|
210 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
|
211 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
|
212 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
|
213 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
|
214 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
|
215 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
|
216 purple_account_set_connection(account, gc); |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25401
diff
changeset
|
217 |
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
|
218 purple_signal_emit(purple_connections_get_handle(), "signing-on", gc); |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25401
diff
changeset
|
219 |
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
|
220 purple_debug_info("connection", "Unregistering. gc = %p\n", gc); |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25401
diff
changeset
|
221 |
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
|
222 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
|
223 } |
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
|
224 |
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 void |
24292
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
22214
diff
changeset
|
226 _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
|
227 { |
15823 | 228 PurpleAccount *account; |
16817
10f175539cfe
Change a few functions to free a linked list while iterating through
Mark Doliner <mark@kingant.net>
parents:
16427
diff
changeset
|
229 GSList *buddies; |
15823 | 230 PurplePluginProtocolInfo *prpl_info = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
231 gboolean remove = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
232 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
233 g_return_if_fail(gc != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 |
15823 | 235 account = purple_connection_get_account(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
236 |
15823 | 237 purple_debug_info("connection", "Disconnecting connection %p\n", gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
238 |
15823 | 239 if (purple_connection_get_state(gc) != PURPLE_CONNECTING) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
240 remove = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 |
15823 | 242 purple_signal_emit(purple_connections_get_handle(), "signing-off", gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
244 while (gc->buddy_chats) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
245 { |
15823 | 246 PurpleConversation *b = gc->buddy_chats->data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
248 gc->buddy_chats = g_slist_remove(gc->buddy_chats, b); |
15823 | 249 purple_conv_chat_left(PURPLE_CONV_CHAT(b)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
250 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
251 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
252 update_keepalive(gc, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
253 |
15823 | 254 purple_proxy_connect_cancel_with_handle(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
255 |
15823 | 256 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
257 if (prpl_info->close) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
258 (prpl_info->close)(gc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
259 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
260 /* Clear out the proto data that was freed in the prpl close method*/ |
15823 | 261 buddies = purple_find_buddies(account, NULL); |
16817
10f175539cfe
Change a few functions to free a linked list while iterating through
Mark Doliner <mark@kingant.net>
parents:
16427
diff
changeset
|
262 while (buddies != NULL) { |
10f175539cfe
Change a few functions to free a linked list while iterating through
Mark Doliner <mark@kingant.net>
parents:
16427
diff
changeset
|
263 PurpleBuddy *buddy = buddies->data; |
25281
9ded0fb57e1c
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22214
diff
changeset
|
264 purple_buddy_set_protocol_data(buddy, NULL); |
16817
10f175539cfe
Change a few functions to free a linked list while iterating through
Mark Doliner <mark@kingant.net>
parents:
16427
diff
changeset
|
265 buddies = g_slist_delete_link(buddies, buddies); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
266 } |
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 connections = g_list_remove(connections, gc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
269 |
15823 | 270 purple_connection_set_state(gc, PURPLE_DISCONNECTED); |
15374
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 if (remove) |
15823 | 273 purple_blist_remove_account(account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 |
15823 | 275 purple_signal_emit(purple_connections_get_handle(), "signed-off", gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
276 |
15823 | 277 purple_account_request_close_with_account(account); |
278 purple_request_close_with_handle(gc); | |
279 purple_notify_close_with_handle(gc); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
280 |
15823 | 281 purple_debug_info("connection", "Destroying connection %p\n", gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 |
15823 | 283 purple_account_set_connection(account, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
285 g_free(gc->password); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 g_free(gc->display_name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
287 |
27194
aa2a2eae9c3e
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <mark@kingant.net>
parents:
25415
diff
changeset
|
288 if (gc->disconnect_timeout > 0) |
15823 | 289 purple_timeout_remove(gc->disconnect_timeout); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
290 |
15823 | 291 PURPLE_DBUS_UNREGISTER_POINTER(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
292 g_free(gc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
294 |
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 * d:)->-< |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
297 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
298 * d:O-\-< |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
299 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
300 * d:D-/-< |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
301 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
302 * d8D->-< DANCE! |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
303 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
304 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
305 void |
15823 | 306 purple_connection_set_state(PurpleConnection *gc, PurpleConnectionState state) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
307 { |
15823 | 308 PurpleConnectionUiOps *ops; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
309 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
310 g_return_if_fail(gc != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
311 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
312 if (gc->state == state) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
313 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
314 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
315 gc->state = state; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
316 |
15823 | 317 ops = purple_connections_get_ui_ops(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
318 |
15823 | 319 if (gc->state == PURPLE_CONNECTING) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 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
|
321 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
323 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
|
324 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 |
15823 | 326 if (gc->state == PURPLE_CONNECTED) { |
327 PurpleAccount *account; | |
328 PurplePresence *presence; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
329 |
15823 | 330 account = purple_connection_get_account(gc); |
331 presence = purple_account_get_presence(account); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
333 /* Set the time the account came online */ |
15823 | 334 purple_presence_set_login_time(presence, time(NULL)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
335 |
16427
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
15829
diff
changeset
|
336 if (purple_prefs_get_bool("/purple/logging/log_system")) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
337 { |
15823 | 338 PurpleLog *log = purple_account_get_log(account, TRUE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
339 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 if (log != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
341 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
342 char *msg = g_strdup_printf(_("+++ %s signed on"), |
15823 | 343 purple_account_get_username(account)); |
344 purple_log_write(log, PURPLE_MESSAGE_SYSTEM, | |
345 purple_account_get_username(account), | |
346 purple_presence_get_login_time(presence), | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
347 msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
348 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
349 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
350 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
351 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
352 if (ops != NULL && ops->connected != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
353 ops->connected(gc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
354 |
15823 | 355 purple_blist_add_account(account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
356 |
15823 | 357 purple_signal_emit(purple_connections_get_handle(), "signed-on", gc); |
30165
378cceb9131d
Add an autojoin connection signal
Richard Laager <rlaager@wiktel.com>
parents:
28650
diff
changeset
|
358 purple_signal_emit_return_1(purple_connections_get_handle(), "autojoin", gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
359 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
360 serv_set_permit_deny(gc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
361 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
362 update_keepalive(gc, TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
363 } |
15823 | 364 else if (gc->state == PURPLE_DISCONNECTED) { |
365 PurpleAccount *account = purple_connection_get_account(gc); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
366 |
16427
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
15829
diff
changeset
|
367 if (purple_prefs_get_bool("/purple/logging/log_system")) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
368 { |
15823 | 369 PurpleLog *log = purple_account_get_log(account, FALSE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
370 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
371 if (log != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
372 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
373 char *msg = g_strdup_printf(_("+++ %s signed off"), |
15823 | 374 purple_account_get_username(account)); |
375 purple_log_write(log, PURPLE_MESSAGE_SYSTEM, | |
376 purple_account_get_username(account), time(NULL), | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
377 msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
378 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
379 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
380 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
381 |
15823 | 382 purple_account_destroy_log(account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
383 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
384 if (ops != NULL && ops->disconnected != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
385 ops->disconnected(gc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
386 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
387 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
388 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
389 void |
32767
2ec94166be43
On the way to hiding the PurpleConnection struct.
andrew.victor@mxit.com
parents:
32707
diff
changeset
|
390 purple_connection_set_flags(PurpleConnection *gc, PurpleConnectionFlags flags) |
2ec94166be43
On the way to hiding the PurpleConnection struct.
andrew.victor@mxit.com
parents:
32707
diff
changeset
|
391 { |
2ec94166be43
On the way to hiding the PurpleConnection struct.
andrew.victor@mxit.com
parents:
32707
diff
changeset
|
392 g_return_if_fail(gc != NULL); |
2ec94166be43
On the way to hiding the PurpleConnection struct.
andrew.victor@mxit.com
parents:
32707
diff
changeset
|
393 |
2ec94166be43
On the way to hiding the PurpleConnection struct.
andrew.victor@mxit.com
parents:
32707
diff
changeset
|
394 gc->flags = flags; |
2ec94166be43
On the way to hiding the PurpleConnection struct.
andrew.victor@mxit.com
parents:
32707
diff
changeset
|
395 } |
2ec94166be43
On the way to hiding the PurpleConnection struct.
andrew.victor@mxit.com
parents:
32707
diff
changeset
|
396 |
2ec94166be43
On the way to hiding the PurpleConnection struct.
andrew.victor@mxit.com
parents:
32707
diff
changeset
|
397 void |
15823 | 398 purple_connection_set_account(PurpleConnection *gc, PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
399 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
400 g_return_if_fail(gc != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
401 g_return_if_fail(account != NULL); |
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 gc->account = account; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
404 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
405 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
406 void |
15823 | 407 purple_connection_set_display_name(PurpleConnection *gc, const char *name) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
408 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
409 g_return_if_fail(gc != NULL); |
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 g_free(gc->display_name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
412 gc->display_name = g_strdup(name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
413 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
414 |
25281
9ded0fb57e1c
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22214
diff
changeset
|
415 void |
9ded0fb57e1c
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22214
diff
changeset
|
416 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
|
417 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
|
418 |
9ded0fb57e1c
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22214
diff
changeset
|
419 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
|
420 } |
9ded0fb57e1c
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22214
diff
changeset
|
421 |
15823 | 422 PurpleConnectionState |
423 purple_connection_get_state(const PurpleConnection *gc) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
424 { |
15823 | 425 g_return_val_if_fail(gc != NULL, PURPLE_DISCONNECTED); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
426 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
427 return gc->state; |
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 |
32767
2ec94166be43
On the way to hiding the PurpleConnection struct.
andrew.victor@mxit.com
parents:
32707
diff
changeset
|
430 PurpleConnectionFlags |
2ec94166be43
On the way to hiding the PurpleConnection struct.
andrew.victor@mxit.com
parents:
32707
diff
changeset
|
431 purple_connection_get_flags(const PurpleConnection *gc) |
2ec94166be43
On the way to hiding the PurpleConnection struct.
andrew.victor@mxit.com
parents:
32707
diff
changeset
|
432 { |
2ec94166be43
On the way to hiding the PurpleConnection struct.
andrew.victor@mxit.com
parents:
32707
diff
changeset
|
433 g_return_val_if_fail(gc != NULL, 0); |
2ec94166be43
On the way to hiding the PurpleConnection struct.
andrew.victor@mxit.com
parents:
32707
diff
changeset
|
434 |
2ec94166be43
On the way to hiding the PurpleConnection struct.
andrew.victor@mxit.com
parents:
32707
diff
changeset
|
435 return gc->flags; |
2ec94166be43
On the way to hiding the PurpleConnection struct.
andrew.victor@mxit.com
parents:
32707
diff
changeset
|
436 } |
2ec94166be43
On the way to hiding the PurpleConnection struct.
andrew.victor@mxit.com
parents:
32707
diff
changeset
|
437 |
15823 | 438 PurpleAccount * |
439 purple_connection_get_account(const PurpleConnection *gc) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
440 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
441 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
|
442 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
443 return gc->account; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
444 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
445 |
22214
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22202
diff
changeset
|
446 PurplePlugin * |
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22202
diff
changeset
|
447 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
|
448 { |
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22202
diff
changeset
|
449 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
|
450 |
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22202
diff
changeset
|
451 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
|
452 } |
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22202
diff
changeset
|
453 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
454 const char * |
15823 | 455 purple_connection_get_password(const PurpleConnection *gc) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
456 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
457 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
|
458 |
32707
f75041cb3fec
Convert libpurple and protocol prpl's to use the purple_account_* accessor functions.
andrew.victor@mxit.com
parents:
32674
diff
changeset
|
459 return gc->password ? gc->password : purple_account_get_password(gc->account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
460 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
461 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
462 const char * |
15823 | 463 purple_connection_get_display_name(const PurpleConnection *gc) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
464 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
465 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
|
466 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
467 return gc->display_name; |
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 |
25281
9ded0fb57e1c
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22214
diff
changeset
|
470 void * |
9ded0fb57e1c
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22214
diff
changeset
|
471 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
|
472 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
|
473 |
9ded0fb57e1c
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22214
diff
changeset
|
474 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
|
475 } |
9ded0fb57e1c
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22214
diff
changeset
|
476 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
477 void |
15823 | 478 purple_connection_update_progress(PurpleConnection *gc, const char *text, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
479 size_t step, size_t count) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
480 { |
15823 | 481 PurpleConnectionUiOps *ops; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
482 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
483 g_return_if_fail(gc != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
484 g_return_if_fail(text != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
485 g_return_if_fail(step < count); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
486 g_return_if_fail(count > 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
487 |
15823 | 488 ops = purple_connections_get_ui_ops(); |
15374
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 if (ops != NULL && ops->connect_progress != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
491 ops->connect_progress(gc, text, step, count); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
492 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
493 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
494 void |
15823 | 495 purple_connection_notice(PurpleConnection *gc, const char *text) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
496 { |
15823 | 497 PurpleConnectionUiOps *ops; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
498 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
499 g_return_if_fail(gc != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
500 g_return_if_fail(text != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
501 |
15823 | 502 ops = purple_connections_get_ui_ops(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
503 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
504 if (ops != NULL && ops->notice != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
505 ops->notice(gc, text); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
506 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
507 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
508 static gboolean |
15823 | 509 purple_connection_disconnect_cb(gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
510 { |
27194
aa2a2eae9c3e
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <mark@kingant.net>
parents:
25415
diff
changeset
|
511 PurpleAccount *account; |
aa2a2eae9c3e
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <mark@kingant.net>
parents:
25415
diff
changeset
|
512 PurpleConnection *gc; |
aa2a2eae9c3e
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <mark@kingant.net>
parents:
25415
diff
changeset
|
513 char *password; |
aa2a2eae9c3e
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <mark@kingant.net>
parents:
25415
diff
changeset
|
514 |
aa2a2eae9c3e
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <mark@kingant.net>
parents:
25415
diff
changeset
|
515 account = data; |
aa2a2eae9c3e
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <mark@kingant.net>
parents:
25415
diff
changeset
|
516 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:
25415
diff
changeset
|
517 |
30650
1c20a2115ad4
I'm sure there's a legitimate reason I had this change locally in one of my
Stu Tomlinson <stu@nosnilmot.com>
parents:
30165
diff
changeset
|
518 if (gc != NULL) |
1c20a2115ad4
I'm sure there's a legitimate reason I had this change locally in one of my
Stu Tomlinson <stu@nosnilmot.com>
parents:
30165
diff
changeset
|
519 gc->disconnect_timeout = 0; |
27194
aa2a2eae9c3e
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <mark@kingant.net>
parents:
25415
diff
changeset
|
520 |
aa2a2eae9c3e
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <mark@kingant.net>
parents:
25415
diff
changeset
|
521 password = g_strdup(purple_account_get_password(account)); |
15823 | 522 purple_account_disconnect(account); |
523 purple_account_set_password(account, password); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
524 g_free(password); |
27194
aa2a2eae9c3e
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <mark@kingant.net>
parents:
25415
diff
changeset
|
525 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
526 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
527 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
528 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
529 void |
32330
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
32329
diff
changeset
|
530 purple_connection_error (PurpleConnection *gc, |
21358 | 531 PurpleConnectionError reason, |
20066
95b2b7a39585
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <will.thompson@collabora.co.uk>
parents:
19696
diff
changeset
|
532 const char *description) |
95b2b7a39585
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <will.thompson@collabora.co.uk>
parents:
19696
diff
changeset
|
533 { |
15823 | 534 PurpleConnectionUiOps *ops; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
535 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
536 g_return_if_fail(gc != NULL); |
21358 | 537 /* This sanity check relies on PURPLE_CONNECTION_ERROR_OTHER_ERROR |
538 * being the last member of the PurpleConnectionError enum in | |
539 * connection.h; if other reasons are added after it, this check should | |
540 * 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
|
541 */ |
21358 | 542 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
|
543 purple_debug_error("connection", |
32330
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
32329
diff
changeset
|
544 "purple_connection_error: reason %u isn't a " |
21357
5a3242b676ad
rlaager suggested using the last element of the PurpleDisconnectReason enum
Will Thompson <will.thompson@collabora.co.uk>
parents:
20818
diff
changeset
|
545 "valid reason\n", reason); |
21358 | 546 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
|
547 } |
15787
b25acae693cd
Change connection.c:gaim_connection_error() to still work even if the
Mark Doliner <mark@kingant.net>
parents:
15478
diff
changeset
|
548 |
20066
95b2b7a39585
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <will.thompson@collabora.co.uk>
parents:
19696
diff
changeset
|
549 if (description == NULL) { |
32330
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
32329
diff
changeset
|
550 purple_debug_error("connection", "purple_connection_error called with NULL description\n"); |
20066
95b2b7a39585
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <will.thompson@collabora.co.uk>
parents:
19696
diff
changeset
|
551 description = _("Unknown error"); |
15787
b25acae693cd
Change connection.c:gaim_connection_error() to still work even if the
Mark Doliner <mark@kingant.net>
parents:
15478
diff
changeset
|
552 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
553 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
554 /* If we've already got one error, we don't need any more */ |
27194
aa2a2eae9c3e
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <mark@kingant.net>
parents:
25415
diff
changeset
|
555 if (gc->disconnect_timeout > 0) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
556 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
557 |
21358 | 558 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
|
559 |
28153
815d9ce1a8b0
Log the reason for disconnection to the debug log, so that we might
Stu Tomlinson <stu@nosnilmot.com>
parents:
27194
diff
changeset
|
560 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:
27194
diff
changeset
|
561 gc, reason, description); |
815d9ce1a8b0
Log the reason for disconnection to the debug log, so that we might
Stu Tomlinson <stu@nosnilmot.com>
parents:
27194
diff
changeset
|
562 |
15823 | 563 ops = purple_connections_get_ui_ops(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
564 |
32326
c3ea1711c372
Rename the report_disconnect_reason cb function to report_disconnect
Mark Doliner <mark@kingant.net>
parents:
32325
diff
changeset
|
565 if (ops && ops->report_disconnect) |
c3ea1711c372
Rename the report_disconnect_reason cb function to report_disconnect
Mark Doliner <mark@kingant.net>
parents:
32325
diff
changeset
|
566 ops->report_disconnect(gc, reason, description); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
567 |
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
|
568 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
|
569 gc, reason, description); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
570 |
15823 | 571 gc->disconnect_timeout = purple_timeout_add(0, purple_connection_disconnect_cb, |
572 purple_connection_get_account(gc)); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
573 } |
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 void |
20115
a68d51d60177
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <will.thompson@collabora.co.uk>
parents:
20114
diff
changeset
|
576 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
|
577 PurpleSslErrorType ssl_error) |
a68d51d60177
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <will.thompson@collabora.co.uk>
parents:
20114
diff
changeset
|
578 { |
21358 | 579 PurpleConnectionError reason; |
20115
a68d51d60177
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <will.thompson@collabora.co.uk>
parents:
20114
diff
changeset
|
580 |
a68d51d60177
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <will.thompson@collabora.co.uk>
parents:
20114
diff
changeset
|
581 switch (ssl_error) { |
a68d51d60177
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <will.thompson@collabora.co.uk>
parents:
20114
diff
changeset
|
582 case PURPLE_SSL_HANDSHAKE_FAILED: |
22041
da0b37abe4bd
Adjust some network error fatalities and things
Stu Tomlinson <stu@nosnilmot.com>
parents:
21750
diff
changeset
|
583 reason = PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR; |
da0b37abe4bd
Adjust some network error fatalities and things
Stu Tomlinson <stu@nosnilmot.com>
parents:
21750
diff
changeset
|
584 break; |
20115
a68d51d60177
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <will.thompson@collabora.co.uk>
parents:
20114
diff
changeset
|
585 case PURPLE_SSL_CONNECT_FAILED: |
22041
da0b37abe4bd
Adjust some network error fatalities and things
Stu Tomlinson <stu@nosnilmot.com>
parents:
21750
diff
changeset
|
586 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
|
587 break; |
a68d51d60177
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <will.thompson@collabora.co.uk>
parents:
20114
diff
changeset
|
588 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
|
589 /* 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
|
590 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
|
591 break; |
a68d51d60177
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <will.thompson@collabora.co.uk>
parents:
20114
diff
changeset
|
592 default: |
a68d51d60177
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <will.thompson@collabora.co.uk>
parents:
20114
diff
changeset
|
593 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
|
594 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
|
595 } |
a68d51d60177
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <will.thompson@collabora.co.uk>
parents:
20114
diff
changeset
|
596 |
32330
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
32329
diff
changeset
|
597 purple_connection_error (gc, reason, |
21358 | 598 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
|
599 } |
a68d51d60177
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <will.thompson@collabora.co.uk>
parents:
20114
diff
changeset
|
600 |
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
|
601 gboolean |
21358 | 602 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
|
603 { |
143c6f34c6eb
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <will.thompson@collabora.co.uk>
parents:
20066
diff
changeset
|
604 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
|
605 { |
21358 | 606 case PURPLE_CONNECTION_ERROR_NETWORK_ERROR: |
22041
da0b37abe4bd
Adjust some network error fatalities and things
Stu Tomlinson <stu@nosnilmot.com>
parents:
21750
diff
changeset
|
607 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
|
608 return FALSE; |
375d10e84c4b
Consensus on #pidgin is that certificate errors and AUTHENTICATION_IMPOSSIBLE
Will Thompson <will.thompson@collabora.co.uk>
parents:
21422
diff
changeset
|
609 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
|
610 case PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED: |
21358 | 611 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
|
612 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
|
613 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
|
614 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
|
615 case PURPLE_CONNECTION_ERROR_OTHER_ERROR: |
21358 | 616 case PURPLE_CONNECTION_ERROR_CERT_NOT_PROVIDED: |
617 case PURPLE_CONNECTION_ERROR_CERT_UNTRUSTED: | |
618 case PURPLE_CONNECTION_ERROR_CERT_EXPIRED: | |
619 case PURPLE_CONNECTION_ERROR_CERT_NOT_ACTIVATED: | |
620 case PURPLE_CONNECTION_ERROR_CERT_HOSTNAME_MISMATCH: | |
621 case PURPLE_CONNECTION_ERROR_CERT_FINGERPRINT_MISMATCH: | |
622 case PURPLE_CONNECTION_ERROR_CERT_SELF_SIGNED: | |
623 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
|
624 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
|
625 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
|
626 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
|
627 } |
143c6f34c6eb
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <will.thompson@collabora.co.uk>
parents:
20066
diff
changeset
|
628 } |
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 |
32768
50cd80d3554e
Add a purple_connection_update_last_received() function to update the
andrew.victor@mxit.com
parents:
32767
diff
changeset
|
630 void purple_connection_update_last_received(PurpleConnection *gc) |
50cd80d3554e
Add a purple_connection_update_last_received() function to update the
andrew.victor@mxit.com
parents:
32767
diff
changeset
|
631 { |
50cd80d3554e
Add a purple_connection_update_last_received() function to update the
andrew.victor@mxit.com
parents:
32767
diff
changeset
|
632 g_return_if_fail(gc != NULL); |
50cd80d3554e
Add a purple_connection_update_last_received() function to update the
andrew.victor@mxit.com
parents:
32767
diff
changeset
|
633 |
50cd80d3554e
Add a purple_connection_update_last_received() function to update the
andrew.victor@mxit.com
parents:
32767
diff
changeset
|
634 gc->last_received = time(NULL); |
50cd80d3554e
Add a purple_connection_update_last_received() function to update the
andrew.victor@mxit.com
parents:
32767
diff
changeset
|
635 } |
50cd80d3554e
Add a purple_connection_update_last_received() function to update the
andrew.victor@mxit.com
parents:
32767
diff
changeset
|
636 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
637 void |
15823 | 638 purple_connections_disconnect_all(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
639 { |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
640 GList *l; |
15823 | 641 PurpleConnection *gc; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
642 |
15823 | 643 while ((l = purple_connections_get_all()) != NULL) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
644 gc = l->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
645 gc->wants_to_die = TRUE; |
15823 | 646 purple_account_disconnect(gc->account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
647 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
648 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
649 |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
650 GList * |
15823 | 651 purple_connections_get_all(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
652 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
653 return connections; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
654 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
655 |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
656 GList * |
15823 | 657 purple_connections_get_connecting(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
658 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
659 return connections_connecting; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
660 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
661 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
662 void |
15823 | 663 purple_connections_set_ui_ops(PurpleConnectionUiOps *ops) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
664 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
665 connection_ui_ops = ops; |
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 |
15823 | 668 PurpleConnectionUiOps * |
669 purple_connections_get_ui_ops(void) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
670 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
671 return connection_ui_ops; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
672 } |
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 void |
15823 | 675 purple_connections_init(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
676 { |
15823 | 677 void *handle = purple_connections_get_handle(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
678 |
15823 | 679 purple_signal_register(handle, "signing-on", |
680 purple_marshal_VOID__POINTER, NULL, 1, | |
681 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
682 PURPLE_SUBTYPE_CONNECTION)); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
683 |
15823 | 684 purple_signal_register(handle, "signed-on", |
685 purple_marshal_VOID__POINTER, NULL, 1, | |
686 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
687 PURPLE_SUBTYPE_CONNECTION)); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
688 |
15823 | 689 purple_signal_register(handle, "signing-off", |
690 purple_marshal_VOID__POINTER, NULL, 1, | |
691 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
692 PURPLE_SUBTYPE_CONNECTION)); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
693 |
15823 | 694 purple_signal_register(handle, "signed-off", |
695 purple_marshal_VOID__POINTER, NULL, 1, | |
696 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
697 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
|
698 |
5a7202fa43a0
I figured a signal firing on a connection error would be useful.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21358
diff
changeset
|
699 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
|
700 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
|
701 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
|
702 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
|
703 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
|
704 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
|
705 |
30165
378cceb9131d
Add an autojoin connection signal
Richard Laager <rlaager@wiktel.com>
parents:
28650
diff
changeset
|
706 purple_signal_register(handle, "autojoin", |
378cceb9131d
Add an autojoin connection signal
Richard Laager <rlaager@wiktel.com>
parents:
28650
diff
changeset
|
707 purple_marshal_BOOLEAN__POINTER, NULL, 1, |
378cceb9131d
Add an autojoin connection signal
Richard Laager <rlaager@wiktel.com>
parents:
28650
diff
changeset
|
708 purple_value_new(PURPLE_TYPE_SUBTYPE, |
378cceb9131d
Add an autojoin connection signal
Richard Laager <rlaager@wiktel.com>
parents:
28650
diff
changeset
|
709 PURPLE_SUBTYPE_CONNECTION)); |
378cceb9131d
Add an autojoin connection signal
Richard Laager <rlaager@wiktel.com>
parents:
28650
diff
changeset
|
710 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
711 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
712 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
713 void |
15823 | 714 purple_connections_uninit(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
715 { |
15823 | 716 purple_signals_unregister_by_instance(purple_connections_get_handle()); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
717 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
718 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
719 void * |
15823 | 720 purple_connections_get_handle(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
721 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
722 return &connections_handle; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
723 } |