Thu, 28 Mar 2013 09:49:16 +0100
Some polishing on files modified on this branch (mostly formatting)
| 5563 | 1 | /** |
| 2 | * @file connection.c Connection API | |
| 3 | * @ingroup core | |
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19897
diff
changeset
|
4 | */ |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19897
diff
changeset
|
5 | |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19897
diff
changeset
|
6 | /* purple |
| 5563 | 7 | * |
| 15884 | 8 | * Purple is the legal property of its developers, whose names are too numerous |
| 8046 | 9 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 10 | * source distribution. | |
| 5631 | 11 | * |
| 5563 | 12 | * This program is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by | |
| 14 | * the Free Software Foundation; either version 2 of the License, or | |
| 15 | * (at your option) any later version. | |
| 16 | * | |
| 17 | * This program is distributed in the hope that it will be useful, | |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 20 | * GNU General Public License for more details. | |
| 21 | * | |
| 22 | * You should have received a copy of the GNU General Public License | |
| 23 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 5563 | 25 | */ |
|
24569
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
22336
diff
changeset
|
26 | #define _PURPLE_CONNECTION_C_ |
|
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
22336
diff
changeset
|
27 | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
28 | #include "internal.h" |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
29 | #include "account.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
30 | #include "blist.h" |
| 5563 | 31 | #include "connection.h" |
|
11146
c56333373e3c
[gaim-migrate @ 13217]
Piotr Zielinski <zielaj@users.sourceforge.net>
parents:
11033
diff
changeset
|
32 | #include "dbus-maybe.h" |
| 5717 | 33 | #include "debug.h" |
|
33427
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32679
diff
changeset
|
34 | #include "http.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
35 | #include "log.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
36 | #include "notify.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
37 | #include "prefs.h" |
|
14900
4af8b81519b6
[gaim-migrate @ 17607]
Mark Doliner <markdoliner@pidgin.im>
parents:
14814
diff
changeset
|
38 | #include "proxy.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
39 | #include "request.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
40 | #include "server.h" |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
41 | #include "signals.h" |
|
6106
1dc08be40f0a
[gaim-migrate @ 6567]
Mark Doliner <markdoliner@pidgin.im>
parents:
6076
diff
changeset
|
42 | #include "util.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
43 | |
|
21865
59b1c56633d1
De-magic number the prpl_info->keepalive interval, and document it.
Will Thompson <resiak@pidgin.im>
parents:
21831
diff
changeset
|
44 | #define KEEPALIVE_INTERVAL 30 |
|
59b1c56633d1
De-magic number the prpl_info->keepalive interval, and document it.
Will Thompson <resiak@pidgin.im>
parents:
21831
diff
changeset
|
45 | |
| 5563 | 46 | static GList *connections = NULL; |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
47 | static GList *connections_connecting = NULL; |
| 15884 | 48 | static PurpleConnectionUiOps *connection_ui_ops = NULL; |
| 5563 | 49 | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
50 | static int connections_handle; |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
51 | |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
52 | static gboolean |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
53 | send_keepalive(gpointer data) |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
54 | { |
| 15884 | 55 | PurpleConnection *gc = data; |
|
28577
513297aa5f42
Minor cleanup. gc->prpl is guarranteed to be a PurplePlugin with
Mark Doliner <markdoliner@pidgin.im>
parents:
28091
diff
changeset
|
56 | PurplePluginProtocolInfo *prpl_info; |
|
22277
7c386db62c81
Don't send keep-alives if we've received data since in the last KEEPALIVE_INTERVAL seconds
Sean Egan <seanegan@pidgin.im>
parents:
22163
diff
changeset
|
57 | |
|
7c386db62c81
Don't send keep-alives if we've received data since in the last KEEPALIVE_INTERVAL seconds
Sean Egan <seanegan@pidgin.im>
parents:
22163
diff
changeset
|
58 | /* Only send keep-alives if we haven't heard from the |
|
22324
ca786d5fa291
send_keepalive needs to return TRUE to ensure it'll get called again, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22277
diff
changeset
|
59 | * server in a while. |
|
ca786d5fa291
send_keepalive needs to return TRUE to ensure it'll get called again, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22277
diff
changeset
|
60 | */ |
|
22277
7c386db62c81
Don't send keep-alives if we've received data since in the last KEEPALIVE_INTERVAL seconds
Sean Egan <seanegan@pidgin.im>
parents:
22163
diff
changeset
|
61 | if ((time(NULL) - gc->last_received) < KEEPALIVE_INTERVAL) |
|
22324
ca786d5fa291
send_keepalive needs to return TRUE to ensure it'll get called again, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22277
diff
changeset
|
62 | return TRUE; |
|
22277
7c386db62c81
Don't send keep-alives if we've received data since in the last KEEPALIVE_INTERVAL seconds
Sean Egan <seanegan@pidgin.im>
parents:
22163
diff
changeset
|
63 | |
|
7c386db62c81
Don't send keep-alives if we've received data since in the last KEEPALIVE_INTERVAL seconds
Sean Egan <seanegan@pidgin.im>
parents:
22163
diff
changeset
|
64 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); |
|
28577
513297aa5f42
Minor cleanup. gc->prpl is guarranteed to be a PurplePlugin with
Mark Doliner <markdoliner@pidgin.im>
parents:
28091
diff
changeset
|
65 | if (prpl_info->keepalive) |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
66 | prpl_info->keepalive(gc); |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
67 | |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
68 | return TRUE; |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
69 | } |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
70 | |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
71 | static void |
| 15884 | 72 | update_keepalive(PurpleConnection *gc, gboolean on) |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
73 | { |
| 15884 | 74 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
14545
f8b45a0ddac5
[gaim-migrate @ 17202]
Daniel Atallah <datallah@pidgin.im>
parents:
14254
diff
changeset
|
75 | |
|
f8b45a0ddac5
[gaim-migrate @ 17202]
Daniel Atallah <datallah@pidgin.im>
parents:
14254
diff
changeset
|
76 | if (gc != NULL && gc->prpl != NULL) |
| 15884 | 77 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); |
|
14545
f8b45a0ddac5
[gaim-migrate @ 17202]
Daniel Atallah <datallah@pidgin.im>
parents:
14254
diff
changeset
|
78 | |
|
f8b45a0ddac5
[gaim-migrate @ 17202]
Daniel Atallah <datallah@pidgin.im>
parents:
14254
diff
changeset
|
79 | if (!prpl_info || !prpl_info->keepalive) |
|
f8b45a0ddac5
[gaim-migrate @ 17202]
Daniel Atallah <datallah@pidgin.im>
parents:
14254
diff
changeset
|
80 | return; |
|
f8b45a0ddac5
[gaim-migrate @ 17202]
Daniel Atallah <datallah@pidgin.im>
parents:
14254
diff
changeset
|
81 | |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
82 | if (on && !gc->keepalive) |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
83 | { |
| 15884 | 84 | purple_debug_info("connection", "Activating keepalive.\n"); |
|
21865
59b1c56633d1
De-magic number the prpl_info->keepalive interval, and document it.
Will Thompson <resiak@pidgin.im>
parents:
21831
diff
changeset
|
85 | gc->keepalive = purple_timeout_add_seconds(KEEPALIVE_INTERVAL, send_keepalive, gc); |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
86 | } |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
87 | else if (!on && gc->keepalive > 0) |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
88 | { |
| 15884 | 89 | purple_debug_info("connection", "Deactivating keepalive.\n"); |
| 90 | purple_timeout_remove(gc->keepalive); | |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
91 | gc->keepalive = 0; |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
92 | } |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
93 | } |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
94 | |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
95 | void |
|
24569
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
22336
diff
changeset
|
96 | _purple_connection_new(PurpleAccount *account, gboolean regist, const char *password) |
|
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
22336
diff
changeset
|
97 | { |
| 15884 | 98 | PurpleConnection *gc; |
| 99 | PurplePlugin *prpl; | |
| 100 | PurplePluginProtocolInfo *prpl_info; | |
| 5563 | 101 | |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
102 | g_return_if_fail(account != NULL); |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
103 | |
| 15884 | 104 | if (!purple_account_is_disconnected(account)) |
|
10755
a336a5d3102d
[gaim-migrate @ 12358]
Mark Doliner <markdoliner@pidgin.im>
parents:
10754
diff
changeset
|
105 | return; |
|
a336a5d3102d
[gaim-migrate @ 12358]
Mark Doliner <markdoliner@pidgin.im>
parents:
10754
diff
changeset
|
106 | |
| 15884 | 107 | prpl = purple_find_prpl(purple_account_get_protocol_id(account)); |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
108 | |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
109 | if (prpl != NULL) |
| 15884 | 110 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
111 | else { |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
112 | gchar *message; |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
113 | |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
114 | message = g_strdup_printf(_("Missing protocol plugin for %s"), |
| 15884 | 115 | purple_account_get_username(account)); |
| 116 | purple_notify_error(NULL, regist ? _("Registration Error") : | |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
117 | _("Connection Error"), message, NULL); |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
118 | g_free(message); |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
119 | return; |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
120 | } |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
121 | |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
122 | if (regist) |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
123 | { |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
124 | if (prpl_info->register_user == NULL) |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
125 | return; |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
126 | } |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
127 | else |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
128 | { |
|
10751
e15f4f5927ce
[gaim-migrate @ 12354]
Mark Doliner <markdoliner@pidgin.im>
parents:
10745
diff
changeset
|
129 | if (((password == NULL) || (*password == '\0')) && |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
130 | !(prpl_info->options & OPT_PROTO_NO_PASSWORD) && |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
131 | !(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL)) |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
132 | { |
|
30881
2255c073c129
While looking for where "Can not resolve <hostname>" was coming from, I found these.
Paul Aurich <darkrain42@pidgin.im>
parents:
30476
diff
changeset
|
133 | purple_debug_error("connection", "Cannot connect to account %s without " |
| 15884 | 134 | "a password.\n", purple_account_get_username(account)); |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
135 | return; |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
136 | } |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
137 | } |
| 5563 | 138 | |
| 15884 | 139 | gc = g_new0(PurpleConnection, 1); |
| 140 | PURPLE_DBUS_REGISTER_POINTER(gc, PurpleConnection); | |
|
11146
c56333373e3c
[gaim-migrate @ 13217]
Piotr Zielinski <zielaj@users.sourceforge.net>
parents:
11033
diff
changeset
|
141 | |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
142 | gc->prpl = prpl; |
|
10751
e15f4f5927ce
[gaim-migrate @ 12354]
Mark Doliner <markdoliner@pidgin.im>
parents:
10745
diff
changeset
|
143 | if ((password != NULL) && (*password != '\0')) |
|
e15f4f5927ce
[gaim-migrate @ 12354]
Mark Doliner <markdoliner@pidgin.im>
parents:
10745
diff
changeset
|
144 | gc->password = g_strdup(password); |
| 15884 | 145 | purple_connection_set_account(gc, account); |
| 146 | purple_connection_set_state(gc, PURPLE_CONNECTING); | |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
147 | connections = g_list_append(connections, gc); |
| 15884 | 148 | purple_account_set_connection(account, gc); |
| 5563 | 149 | |
| 15884 | 150 | purple_signal_emit(purple_connections_get_handle(), "signing-on", gc); |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
151 | |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
152 | if (regist) |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
153 | { |
| 15884 | 154 | purple_debug_info("connection", "Registering. gc = %p\n", gc); |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
155 | |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
156 | /* set this so we don't auto-reconnect after registering */ |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
157 | gc->wants_to_die = TRUE; |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
158 | |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
159 | prpl_info->register_user(account); |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
160 | } |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
161 | else |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
162 | { |
| 15884 | 163 | purple_debug_info("connection", "Connecting. gc = %p\n", gc); |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
164 | |
| 15884 | 165 | purple_signal_emit(purple_accounts_get_handle(), "account-connecting", account); |
|
11837
2f1206084fef
[gaim-migrate @ 14128]
Mark Doliner <markdoliner@pidgin.im>
parents:
11698
diff
changeset
|
166 | prpl_info->login(account); |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
167 | } |
| 5563 | 168 | } |
| 169 | ||
| 170 | void | |
|
24569
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
22336
diff
changeset
|
171 | _purple_connection_new_unregister(PurpleAccount *account, const char *password, PurpleAccountUnregistrationCb cb, void *user_data) |
|
18912
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
172 | { |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
173 | /* Lots of copy/pasted code to avoid API changes. You might want to integrate that into the previous function when posssible. */ |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
174 | PurpleConnection *gc; |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
175 | PurplePlugin *prpl; |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
176 | PurplePluginProtocolInfo *prpl_info; |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25874
diff
changeset
|
177 | |
|
18912
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
178 | g_return_if_fail(account != NULL); |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25874
diff
changeset
|
179 | |
|
18912
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
180 | prpl = purple_find_prpl(purple_account_get_protocol_id(account)); |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25874
diff
changeset
|
181 | |
|
18912
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
182 | if (prpl != NULL) |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
183 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
184 | else { |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
185 | gchar *message; |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25874
diff
changeset
|
186 | |
|
18912
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
187 | message = g_strdup_printf(_("Missing protocol plugin for %s"), |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
188 | purple_account_get_username(account)); |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
189 | purple_notify_error(NULL, _("Unregistration Error"), message, NULL); |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
190 | g_free(message); |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
191 | return; |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
192 | } |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
193 | |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
194 | if (!purple_account_is_disconnected(account)) { |
|
18994
310e9d853e2b
Implemented a callback for unregistering, mirroring the registration callback. Since this is a new API, I can do it properly by passing it right in the unregister function call, instead of having a separate function for setting it.
Andreas Monitzer <am@adiumx.com>
parents:
18912
diff
changeset
|
195 | prpl_info->unregister_user(account, cb, user_data); |
|
18912
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
196 | return; |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
197 | } |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25874
diff
changeset
|
198 | |
|
18912
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
199 | if (((password == NULL) || (*password == '\0')) && |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
200 | !(prpl_info->options & OPT_PROTO_NO_PASSWORD) && |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
201 | !(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL)) |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
202 | { |
|
30881
2255c073c129
While looking for where "Can not resolve <hostname>" was coming from, I found these.
Paul Aurich <darkrain42@pidgin.im>
parents:
30476
diff
changeset
|
203 | purple_debug_error("connection", "Cannot connect to account %s without " |
|
18912
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
204 | "a password.\n", purple_account_get_username(account)); |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
205 | return; |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
206 | } |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25874
diff
changeset
|
207 | |
|
18912
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
208 | gc = g_new0(PurpleConnection, 1); |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
209 | PURPLE_DBUS_REGISTER_POINTER(gc, PurpleConnection); |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25874
diff
changeset
|
210 | |
|
18912
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
211 | gc->prpl = prpl; |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
212 | if ((password != NULL) && (*password != '\0')) |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
213 | gc->password = g_strdup(password); |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
214 | purple_connection_set_account(gc, account); |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
215 | purple_connection_set_state(gc, PURPLE_CONNECTING); |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
216 | connections = g_list_append(connections, gc); |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
217 | purple_account_set_connection(account, gc); |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25874
diff
changeset
|
218 | |
|
18912
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
219 | purple_signal_emit(purple_connections_get_handle(), "signing-on", gc); |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25874
diff
changeset
|
220 | |
|
18912
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
221 | purple_debug_info("connection", "Unregistering. gc = %p\n", gc); |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25874
diff
changeset
|
222 | |
|
18994
310e9d853e2b
Implemented a callback for unregistering, mirroring the registration callback. Since this is a new API, I can do it properly by passing it right in the unregister function call, instead of having a separate function for setting it.
Andreas Monitzer <am@adiumx.com>
parents:
18912
diff
changeset
|
223 | prpl_info->unregister_user(account, cb, user_data); |
|
18912
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
224 | } |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
225 | |
|
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
226 | void |
|
24569
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
22336
diff
changeset
|
227 | _purple_connection_destroy(PurpleConnection *gc) |
|
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
22336
diff
changeset
|
228 | { |
| 15884 | 229 | PurpleAccount *account; |
|
16863
b98303c15033
Change a few functions to free a linked list while iterating through
Mark Doliner <markdoliner@pidgin.im>
parents:
16478
diff
changeset
|
230 | GSList *buddies; |
| 15884 | 231 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
11507
1a6c8ccce2a9
[gaim-migrate @ 13752]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11305
diff
changeset
|
232 | gboolean remove = FALSE; |
|
5741
0a52405f402f
[gaim-migrate @ 6165]
Christian Hammond <chipx86@chipx86.com>
parents:
5740
diff
changeset
|
233 | |
| 5563 | 234 | g_return_if_fail(gc != NULL); |
| 235 | ||
| 15884 | 236 | account = purple_connection_get_account(gc); |
|
5926
f0c5bbf16793
[gaim-migrate @ 6366]
Christian Hammond <chipx86@chipx86.com>
parents:
5905
diff
changeset
|
237 | |
| 15884 | 238 | purple_debug_info("connection", "Disconnecting connection %p\n", gc); |
|
10754
d5f1ddb4146f
[gaim-migrate @ 12357]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
239 | |
| 15884 | 240 | if (purple_connection_get_state(gc) != PURPLE_CONNECTING) |
|
11507
1a6c8ccce2a9
[gaim-migrate @ 13752]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11305
diff
changeset
|
241 | remove = TRUE; |
|
5926
f0c5bbf16793
[gaim-migrate @ 6366]
Christian Hammond <chipx86@chipx86.com>
parents:
5905
diff
changeset
|
242 | |
| 15884 | 243 | purple_signal_emit(purple_connections_get_handle(), "signing-off", gc); |
|
5930
cdd2e5397cd3
[gaim-migrate @ 6370]
Christian Hammond <chipx86@chipx86.com>
parents:
5926
diff
changeset
|
244 | |
|
10754
d5f1ddb4146f
[gaim-migrate @ 12357]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
245 | while (gc->buddy_chats) |
|
d5f1ddb4146f
[gaim-migrate @ 12357]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
246 | { |
| 15884 | 247 | PurpleConversation *b = gc->buddy_chats->data; |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
248 | |
|
10754
d5f1ddb4146f
[gaim-migrate @ 12357]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
249 | gc->buddy_chats = g_slist_remove(gc->buddy_chats, b); |
| 15884 | 250 | purple_conv_chat_left(PURPLE_CONV_CHAT(b)); |
|
10754
d5f1ddb4146f
[gaim-migrate @ 12357]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
251 | } |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
252 | |
|
10754
d5f1ddb4146f
[gaim-migrate @ 12357]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
253 | update_keepalive(gc, FALSE); |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
254 | |
|
33427
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32679
diff
changeset
|
255 | purple_http_conn_cancel_all(gc); |
| 15884 | 256 | purple_proxy_connect_cancel_with_handle(gc); |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
257 | |
| 15884 | 258 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); |
|
14900
4af8b81519b6
[gaim-migrate @ 17607]
Mark Doliner <markdoliner@pidgin.im>
parents:
14814
diff
changeset
|
259 | if (prpl_info->close) |
|
4af8b81519b6
[gaim-migrate @ 17607]
Mark Doliner <markdoliner@pidgin.im>
parents:
14814
diff
changeset
|
260 | (prpl_info->close)(gc); |
| 5563 | 261 | |
|
14814
479ac60fb641
[gaim-migrate @ 17509]
Daniel Atallah <datallah@pidgin.im>
parents:
14669
diff
changeset
|
262 | /* Clear out the proto data that was freed in the prpl close method*/ |
| 15884 | 263 | buddies = purple_find_buddies(account, NULL); |
|
16863
b98303c15033
Change a few functions to free a linked list while iterating through
Mark Doliner <markdoliner@pidgin.im>
parents:
16478
diff
changeset
|
264 | while (buddies != NULL) { |
|
b98303c15033
Change a few functions to free a linked list while iterating through
Mark Doliner <markdoliner@pidgin.im>
parents:
16478
diff
changeset
|
265 | PurpleBuddy *buddy = buddies->data; |
|
24937
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
266 | purple_buddy_set_protocol_data(buddy, NULL); |
|
16863
b98303c15033
Change a few functions to free a linked list while iterating through
Mark Doliner <markdoliner@pidgin.im>
parents:
16478
diff
changeset
|
267 | buddies = g_slist_delete_link(buddies, buddies); |
|
14814
479ac60fb641
[gaim-migrate @ 17509]
Daniel Atallah <datallah@pidgin.im>
parents:
14669
diff
changeset
|
268 | } |
|
479ac60fb641
[gaim-migrate @ 17509]
Daniel Atallah <datallah@pidgin.im>
parents:
14669
diff
changeset
|
269 | |
|
10754
d5f1ddb4146f
[gaim-migrate @ 12357]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
270 | connections = g_list_remove(connections, gc); |
| 5563 | 271 | |
| 15884 | 272 | purple_connection_set_state(gc, PURPLE_DISCONNECTED); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
273 | |
|
11507
1a6c8ccce2a9
[gaim-migrate @ 13752]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11305
diff
changeset
|
274 | if (remove) |
| 15884 | 275 | purple_blist_remove_account(account); |
|
11507
1a6c8ccce2a9
[gaim-migrate @ 13752]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11305
diff
changeset
|
276 | |
| 15884 | 277 | purple_signal_emit(purple_connections_get_handle(), "signed-off", gc); |
|
5615
2eb715cbbd9b
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
278 | |
| 15884 | 279 | purple_account_request_close_with_account(account); |
| 280 | purple_request_close_with_handle(gc); | |
| 281 | purple_notify_close_with_handle(gc); | |
| 5563 | 282 | |
| 15884 | 283 | purple_debug_info("connection", "Destroying connection %p\n", gc); |
|
10742
2783135f0ecf
[gaim-migrate @ 12344]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
284 | |
| 15884 | 285 | purple_account_set_connection(account, NULL); |
|
10742
2783135f0ecf
[gaim-migrate @ 12344]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
286 | |
|
34145
fa72f1e5cd77
Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34108
diff
changeset
|
287 | purple_str_wipe(gc->password); |
|
13976
2543396bd00e
[gaim-migrate @ 16414]
Mark Doliner <markdoliner@pidgin.im>
parents:
13508
diff
changeset
|
288 | g_free(gc->display_name); |
|
9848
708a47f26faa
[gaim-migrate @ 10726]
Dave West <kat@users.sourceforge.net>
parents:
9699
diff
changeset
|
289 | |
|
27336
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
290 | if (gc->disconnect_timeout > 0) |
| 15884 | 291 | purple_timeout_remove(gc->disconnect_timeout); |
|
6029
85d6afa168fb
[gaim-migrate @ 6479]
Mark Doliner <markdoliner@pidgin.im>
parents:
6018
diff
changeset
|
292 | |
| 15884 | 293 | PURPLE_DBUS_UNREGISTER_POINTER(gc); |
|
10742
2783135f0ecf
[gaim-migrate @ 12344]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
294 | g_free(gc); |
|
6029
85d6afa168fb
[gaim-migrate @ 6479]
Mark Doliner <markdoliner@pidgin.im>
parents:
6018
diff
changeset
|
295 | } |
|
85d6afa168fb
[gaim-migrate @ 6479]
Mark Doliner <markdoliner@pidgin.im>
parents:
6018
diff
changeset
|
296 | |
| 5563 | 297 | /* |
|
8130
58e4e51f514b
[gaim-migrate @ 8835]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
298 | * d:)->-< |
| 5563 | 299 | * |
| 300 | * d:O-\-< | |
|
8130
58e4e51f514b
[gaim-migrate @ 8835]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
301 | * |
| 5563 | 302 | * d:D-/-< |
| 303 | * | |
| 304 | * d8D->-< DANCE! | |
| 305 | */ | |
| 306 | ||
| 307 | void | |
| 15884 | 308 | purple_connection_set_state(PurpleConnection *gc, PurpleConnectionState state) |
| 5563 | 309 | { |
| 15884 | 310 | PurpleConnectionUiOps *ops; |
|
5885
223ac977eed2
[gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents:
5883
diff
changeset
|
311 | |
| 5563 | 312 | g_return_if_fail(gc != NULL); |
| 313 | ||
|
5784
4c9046760b5b
[gaim-migrate @ 6209]
Christian Hammond <chipx86@chipx86.com>
parents:
5741
diff
changeset
|
314 | if (gc->state == state) |
|
4c9046760b5b
[gaim-migrate @ 6209]
Christian Hammond <chipx86@chipx86.com>
parents:
5741
diff
changeset
|
315 | return; |
|
4c9046760b5b
[gaim-migrate @ 6209]
Christian Hammond <chipx86@chipx86.com>
parents:
5741
diff
changeset
|
316 | |
| 5563 | 317 | gc->state = state; |
| 318 | ||
| 15884 | 319 | ops = purple_connections_get_ui_ops(); |
|
5885
223ac977eed2
[gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents:
5883
diff
changeset
|
320 | |
| 15884 | 321 | if (gc->state == PURPLE_CONNECTING) { |
|
5905
62a6bdbc09b7
[gaim-migrate @ 6337]
Robert McQueen <robot101@debian.org>
parents:
5885
diff
changeset
|
322 | connections_connecting = g_list_append(connections_connecting, gc); |
|
62a6bdbc09b7
[gaim-migrate @ 6337]
Robert McQueen <robot101@debian.org>
parents:
5885
diff
changeset
|
323 | } |
|
62a6bdbc09b7
[gaim-migrate @ 6337]
Robert McQueen <robot101@debian.org>
parents:
5885
diff
changeset
|
324 | else { |
|
5885
223ac977eed2
[gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents:
5883
diff
changeset
|
325 | connections_connecting = g_list_remove(connections_connecting, gc); |
|
5905
62a6bdbc09b7
[gaim-migrate @ 6337]
Robert McQueen <robot101@debian.org>
parents:
5885
diff
changeset
|
326 | } |
|
5885
223ac977eed2
[gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents:
5883
diff
changeset
|
327 | |
| 15884 | 328 | if (gc->state == PURPLE_CONNECTED) { |
| 329 | PurpleAccount *account; | |
| 330 | PurplePresence *presence; | |
|
10052
329dad7e2da3
[gaim-migrate @ 11013]
Dave West <kat@users.sourceforge.net>
parents:
9944
diff
changeset
|
331 | |
| 15884 | 332 | account = purple_connection_get_account(gc); |
| 333 | presence = purple_account_get_presence(account); | |
| 5563 | 334 | |
| 335 | /* Set the time the account came online */ | |
| 15884 | 336 | purple_presence_set_login_time(presence, time(NULL)); |
| 5563 | 337 | |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
15890
diff
changeset
|
338 | if (purple_prefs_get_bool("/purple/logging/log_system")) |
|
11698
afbf0d8bdacf
[gaim-migrate @ 13989]
Mark Doliner <markdoliner@pidgin.im>
parents:
11562
diff
changeset
|
339 | { |
| 15884 | 340 | PurpleLog *log = purple_account_get_log(account, TRUE); |
|
13508
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
341 | |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
342 | if (log != NULL) |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
343 | { |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
344 | char *msg = g_strdup_printf(_("+++ %s signed on"), |
| 15884 | 345 | purple_account_get_username(account)); |
| 346 | purple_log_write(log, PURPLE_MESSAGE_SYSTEM, | |
| 347 | purple_account_get_username(account), | |
| 348 | purple_presence_get_login_time(presence), | |
|
13508
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
349 | msg); |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
350 | g_free(msg); |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
351 | } |
|
10301
fd24ab69574a
[gaim-migrate @ 11486]
Mark Doliner <markdoliner@pidgin.im>
parents:
10193
diff
changeset
|
352 | } |
|
fd24ab69574a
[gaim-migrate @ 11486]
Mark Doliner <markdoliner@pidgin.im>
parents:
10193
diff
changeset
|
353 | |
| 5563 | 354 | if (ops != NULL && ops->connected != NULL) |
| 355 | ops->connected(gc); | |
| 356 | ||
| 15884 | 357 | purple_blist_add_account(account); |
| 5563 | 358 | |
| 15884 | 359 | purple_signal_emit(purple_connections_get_handle(), "signed-on", gc); |
|
30039
9cd7672bae4f
Add an autojoin connection signal
Richard Laager <rlaager@pidgin.im>
parents:
28577
diff
changeset
|
360 | purple_signal_emit_return_1(purple_connections_get_handle(), "autojoin", gc); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
361 | |
| 5563 | 362 | serv_set_permit_deny(gc); |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
363 | |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
364 | update_keepalive(gc, TRUE); |
| 5563 | 365 | } |
| 15884 | 366 | else if (gc->state == PURPLE_DISCONNECTED) { |
| 367 | PurpleAccount *account = purple_connection_get_account(gc); | |
| 8573 | 368 | |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
15890
diff
changeset
|
369 | if (purple_prefs_get_bool("/purple/logging/log_system")) |
|
11698
afbf0d8bdacf
[gaim-migrate @ 13989]
Mark Doliner <markdoliner@pidgin.im>
parents:
11562
diff
changeset
|
370 | { |
| 15884 | 371 | PurpleLog *log = purple_account_get_log(account, FALSE); |
|
13508
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
372 | |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
373 | if (log != NULL) |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
374 | { |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
375 | char *msg = g_strdup_printf(_("+++ %s signed off"), |
| 15884 | 376 | purple_account_get_username(account)); |
| 377 | purple_log_write(log, PURPLE_MESSAGE_SYSTEM, | |
| 378 | purple_account_get_username(account), time(NULL), | |
|
13508
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
379 | msg); |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
380 | g_free(msg); |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
381 | } |
| 8573 | 382 | } |
| 383 | ||
| 15884 | 384 | purple_account_destroy_log(account); |
| 8573 | 385 | |
|
5885
223ac977eed2
[gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents:
5883
diff
changeset
|
386 | if (ops != NULL && ops->disconnected != NULL) |
| 9190 | 387 | ops->disconnected(gc); |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
388 | } |
| 5563 | 389 | } |
| 390 | ||
| 391 | void | |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
392 | purple_connection_set_flags(PurpleConnection *gc, PurpleConnectionFlags flags) |
|
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
393 | { |
|
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
394 | g_return_if_fail(gc != NULL); |
|
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
395 | |
|
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
396 | gc->flags = flags; |
|
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
397 | } |
|
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
398 | |
|
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
399 | void |
| 15884 | 400 | purple_connection_set_account(PurpleConnection *gc, PurpleAccount *account) |
| 5563 | 401 | { |
| 402 | g_return_if_fail(gc != NULL); | |
| 403 | g_return_if_fail(account != NULL); | |
| 404 | ||
| 405 | gc->account = account; | |
| 406 | } | |
| 407 | ||
| 408 | void | |
| 15884 | 409 | purple_connection_set_display_name(PurpleConnection *gc, const char *name) |
| 5563 | 410 | { |
| 411 | g_return_if_fail(gc != NULL); | |
| 412 | ||
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14035
diff
changeset
|
413 | g_free(gc->display_name); |
|
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14035
diff
changeset
|
414 | gc->display_name = g_strdup(name); |
| 5563 | 415 | } |
| 416 | ||
|
24937
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
417 | void |
|
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
418 | purple_connection_set_protocol_data(PurpleConnection *connection, void *proto_data) { |
|
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
419 | g_return_if_fail(connection != NULL); |
|
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
420 | |
|
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
421 | connection->proto_data = proto_data; |
|
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
422 | } |
|
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
423 | |
| 15884 | 424 | PurpleConnectionState |
| 425 | purple_connection_get_state(const PurpleConnection *gc) | |
| 5563 | 426 | { |
| 15884 | 427 | g_return_val_if_fail(gc != NULL, PURPLE_DISCONNECTED); |
| 5563 | 428 | |
| 429 | return gc->state; | |
| 430 | } | |
| 431 | ||
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
432 | PurpleConnectionFlags |
|
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
433 | purple_connection_get_flags(const PurpleConnection *gc) |
|
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
434 | { |
|
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
435 | g_return_val_if_fail(gc != NULL, 0); |
|
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
436 | |
|
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
437 | return gc->flags; |
|
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
438 | } |
|
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
439 | |
| 15884 | 440 | PurpleAccount * |
| 441 | purple_connection_get_account(const PurpleConnection *gc) | |
| 5563 | 442 | { |
| 443 | g_return_val_if_fail(gc != NULL, NULL); | |
| 444 | ||
| 445 | return gc->account; | |
| 446 | } | |
| 447 | ||
|
22336
ac905bb0a8ec
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22324
diff
changeset
|
448 | PurplePlugin * |
|
ac905bb0a8ec
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22324
diff
changeset
|
449 | purple_connection_get_prpl(const PurpleConnection *gc) |
|
ac905bb0a8ec
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22324
diff
changeset
|
450 | { |
|
ac905bb0a8ec
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22324
diff
changeset
|
451 | g_return_val_if_fail(gc != NULL, NULL); |
|
ac905bb0a8ec
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22324
diff
changeset
|
452 | |
|
ac905bb0a8ec
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22324
diff
changeset
|
453 | return gc->prpl; |
|
ac905bb0a8ec
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22324
diff
changeset
|
454 | } |
|
ac905bb0a8ec
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22324
diff
changeset
|
455 | |
| 5563 | 456 | const char * |
| 15884 | 457 | purple_connection_get_password(const PurpleConnection *gc) |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
458 | { |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
459 | g_return_val_if_fail(gc != NULL, NULL); |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
460 | |
|
34019
bc87f596bb4c
compile, appears to work too.
Ka-Hing Cheung <khc@pidgin.im>
parents:
34018
diff
changeset
|
461 | return gc->password; |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
462 | } |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
463 | |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
464 | const char * |
| 15884 | 465 | purple_connection_get_display_name(const PurpleConnection *gc) |
| 5563 | 466 | { |
| 467 | g_return_val_if_fail(gc != NULL, NULL); | |
| 468 | ||
| 469 | return gc->display_name; | |
| 470 | } | |
| 471 | ||
|
24937
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
472 | void * |
|
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
473 | purple_connection_get_protocol_data(const PurpleConnection *connection) { |
|
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
474 | g_return_val_if_fail(connection != NULL, NULL); |
|
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
475 | |
|
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
476 | return connection->proto_data; |
|
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
477 | } |
|
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
478 | |
|
34019
bc87f596bb4c
compile, appears to work too.
Ka-Hing Cheung <khc@pidgin.im>
parents:
34018
diff
changeset
|
479 | gboolean |
|
bc87f596bb4c
compile, appears to work too.
Ka-Hing Cheung <khc@pidgin.im>
parents:
34018
diff
changeset
|
480 | purple_connection_had_error(const PurpleConnection *gc) |
|
bc87f596bb4c
compile, appears to work too.
Ka-Hing Cheung <khc@pidgin.im>
parents:
34018
diff
changeset
|
481 | { |
|
bc87f596bb4c
compile, appears to work too.
Ka-Hing Cheung <khc@pidgin.im>
parents:
34018
diff
changeset
|
482 | g_return_val_if_fail(gc != NULL, FALSE); |
|
bc87f596bb4c
compile, appears to work too.
Ka-Hing Cheung <khc@pidgin.im>
parents:
34018
diff
changeset
|
483 | |
|
bc87f596bb4c
compile, appears to work too.
Ka-Hing Cheung <khc@pidgin.im>
parents:
34018
diff
changeset
|
484 | return gc->disconnect_timeout != 0; |
|
bc87f596bb4c
compile, appears to work too.
Ka-Hing Cheung <khc@pidgin.im>
parents:
34018
diff
changeset
|
485 | } |
|
bc87f596bb4c
compile, appears to work too.
Ka-Hing Cheung <khc@pidgin.im>
parents:
34018
diff
changeset
|
486 | |
| 5563 | 487 | void |
| 15884 | 488 | purple_connection_update_progress(PurpleConnection *gc, const char *text, |
| 5563 | 489 | size_t step, size_t count) |
| 490 | { | |
| 15884 | 491 | PurpleConnectionUiOps *ops; |
| 5563 | 492 | |
| 493 | g_return_if_fail(gc != NULL); | |
| 494 | g_return_if_fail(text != NULL); | |
| 495 | g_return_if_fail(step < count); | |
| 496 | g_return_if_fail(count > 1); | |
| 497 | ||
| 15884 | 498 | ops = purple_connections_get_ui_ops(); |
| 5563 | 499 | |
| 500 | if (ops != NULL && ops->connect_progress != NULL) | |
| 501 | ops->connect_progress(gc, text, step, count); | |
| 502 | } | |
| 503 | ||
| 504 | void | |
| 15884 | 505 | purple_connection_notice(PurpleConnection *gc, const char *text) |
|
5571
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
506 | { |
| 15884 | 507 | PurpleConnectionUiOps *ops; |
|
5571
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
508 | |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
509 | g_return_if_fail(gc != NULL); |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
510 | g_return_if_fail(text != NULL); |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
511 | |
| 15884 | 512 | ops = purple_connections_get_ui_ops(); |
|
5571
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
513 | |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
514 | if (ops != NULL && ops->notice != NULL) |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
515 | ops->notice(gc, text); |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
516 | } |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
517 | |
|
12412
8abe3226695e
[gaim-migrate @ 14719]
Richard Laager <rlaager@pidgin.im>
parents:
12272
diff
changeset
|
518 | static gboolean |
| 15884 | 519 | purple_connection_disconnect_cb(gpointer data) |
|
10742
2783135f0ecf
[gaim-migrate @ 12344]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
520 | { |
|
27336
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
521 | PurpleAccount *account; |
|
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
522 | PurpleConnection *gc; |
|
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
523 | |
|
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
524 | account = data; |
|
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
525 | gc = purple_account_get_connection(account); |
|
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
526 | |
|
30476
1fd7f030c5e6
I'm sure there's a legitimate reason I had this change locally in one of my
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
30039
diff
changeset
|
527 | if (gc != NULL) |
|
1fd7f030c5e6
I'm sure there's a legitimate reason I had this change locally in one of my
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
30039
diff
changeset
|
528 | gc->disconnect_timeout = 0; |
|
27336
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
529 | |
| 15884 | 530 | purple_account_disconnect(account); |
|
10742
2783135f0ecf
[gaim-migrate @ 12344]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
531 | return FALSE; |
|
2783135f0ecf
[gaim-migrate @ 12344]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
532 | } |
|
2783135f0ecf
[gaim-migrate @ 12344]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
533 | |
|
5571
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
534 | void |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
32156
diff
changeset
|
535 | purple_connection_error (PurpleConnection *gc, |
| 21279 | 536 | PurpleConnectionError reason, |
|
20430
bb30dff3da21
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <resiak@pidgin.im>
parents:
19897
diff
changeset
|
537 | const char *description) |
|
bb30dff3da21
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <resiak@pidgin.im>
parents:
19897
diff
changeset
|
538 | { |
| 15884 | 539 | PurpleConnectionUiOps *ops; |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
540 | |
|
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
541 | g_return_if_fail(gc != NULL); |
| 21279 | 542 | /* This sanity check relies on PURPLE_CONNECTION_ERROR_OTHER_ERROR |
| 543 | * being the last member of the PurpleConnectionError enum in | |
| 544 | * connection.h; if other reasons are added after it, this check should | |
| 545 | * be updated. | |
|
21278
19f6ce8ee4ad
rlaager suggested using the last element of the PurpleDisconnectReason enum
Will Thompson <resiak@pidgin.im>
parents:
21154
diff
changeset
|
546 | */ |
| 21279 | 547 | if (reason > PURPLE_CONNECTION_ERROR_OTHER_ERROR) { |
|
21278
19f6ce8ee4ad
rlaager suggested using the last element of the PurpleDisconnectReason enum
Will Thompson <resiak@pidgin.im>
parents:
21154
diff
changeset
|
548 | purple_debug_error("connection", |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
32156
diff
changeset
|
549 | "purple_connection_error: reason %u isn't a " |
|
21278
19f6ce8ee4ad
rlaager suggested using the last element of the PurpleDisconnectReason enum
Will Thompson <resiak@pidgin.im>
parents:
21154
diff
changeset
|
550 | "valid reason\n", reason); |
| 21279 | 551 | reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR; |
|
21278
19f6ce8ee4ad
rlaager suggested using the last element of the PurpleDisconnectReason enum
Will Thompson <resiak@pidgin.im>
parents:
21154
diff
changeset
|
552 | } |
|
15848
44463a06e833
Change connection.c:gaim_connection_error() to still work even if the
Mark Doliner <markdoliner@pidgin.im>
parents:
15537
diff
changeset
|
553 | |
|
20430
bb30dff3da21
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <resiak@pidgin.im>
parents:
19897
diff
changeset
|
554 | if (description == NULL) { |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
32156
diff
changeset
|
555 | purple_debug_error("connection", "purple_connection_error called with NULL description\n"); |
|
20430
bb30dff3da21
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <resiak@pidgin.im>
parents:
19897
diff
changeset
|
556 | description = _("Unknown error"); |
|
15848
44463a06e833
Change connection.c:gaim_connection_error() to still work even if the
Mark Doliner <markdoliner@pidgin.im>
parents:
15537
diff
changeset
|
557 | } |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
558 | |
| 6393 | 559 | /* If we've already got one error, we don't need any more */ |
|
27336
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
560 | if (gc->disconnect_timeout > 0) |
| 6393 | 561 | return; |
| 562 | ||
| 21279 | 563 | gc->wants_to_die = purple_connection_error_is_fatal (reason); |
|
21149
160a0845b527
rlaager pointed out that purple_connection_error_reason should be setting
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
564 | |
|
28091
03d2cecdb234
Log the reason for disconnection to the debug log, so that we might
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
27336
diff
changeset
|
565 | purple_debug_info("connection", "Connection error on %p (reason: %u description: %s)\n", |
|
03d2cecdb234
Log the reason for disconnection to the debug log, so that we might
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
27336
diff
changeset
|
566 | gc, reason, description); |
|
03d2cecdb234
Log the reason for disconnection to the debug log, so that we might
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
27336
diff
changeset
|
567 | |
| 15884 | 568 | ops = purple_connections_get_ui_ops(); |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
569 | |
|
32153
121f15699f88
Rename the report_disconnect_reason cb function to report_disconnect
Mark Doliner <markdoliner@pidgin.im>
parents:
32152
diff
changeset
|
570 | if (ops && ops->report_disconnect) |
|
121f15699f88
Rename the report_disconnect_reason cb function to report_disconnect
Mark Doliner <markdoliner@pidgin.im>
parents:
32152
diff
changeset
|
571 | ops->report_disconnect(gc, reason, description); |
| 5727 | 572 | |
|
21285
ca8cb8706802
I figured a signal firing on a connection error would be useful.
Will Thompson <resiak@pidgin.im>
parents:
21279
diff
changeset
|
573 | purple_signal_emit(purple_connections_get_handle(), "connection-error", |
|
ca8cb8706802
I figured a signal firing on a connection error would be useful.
Will Thompson <resiak@pidgin.im>
parents:
21279
diff
changeset
|
574 | gc, reason, description); |
| 5727 | 575 | |
| 15884 | 576 | gc->disconnect_timeout = purple_timeout_add(0, purple_connection_disconnect_cb, |
| 577 | purple_connection_get_account(gc)); | |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
578 | } |
|
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
579 | |
|
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
580 | void |
|
20443
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
581 | purple_connection_ssl_error (PurpleConnection *gc, |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
582 | PurpleSslErrorType ssl_error) |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
583 | { |
| 21279 | 584 | PurpleConnectionError reason; |
|
20443
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
585 | |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
586 | switch (ssl_error) { |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
587 | case PURPLE_SSL_HANDSHAKE_FAILED: |
|
22162
1e0f1dbe89da
Adjust some network error fatalities and things
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21865
diff
changeset
|
588 | reason = PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR; |
|
1e0f1dbe89da
Adjust some network error fatalities and things
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21865
diff
changeset
|
589 | break; |
|
20443
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
590 | case PURPLE_SSL_CONNECT_FAILED: |
|
22162
1e0f1dbe89da
Adjust some network error fatalities and things
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21865
diff
changeset
|
591 | reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
|
20443
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
592 | break; |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
593 | case PURPLE_SSL_CERTIFICATE_INVALID: |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
594 | /* TODO: maybe PURPLE_SSL_* should be more specific? */ |
|
22163
186613d5bc34
Huh, you want to be able to compile? I clearly (or not so clearly) need new
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22162
diff
changeset
|
595 | reason = PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR; |
|
20443
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
596 | break; |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
597 | default: |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
598 | g_assert_not_reached (); |
|
22163
186613d5bc34
Huh, you want to be able to compile? I clearly (or not so clearly) need new
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22162
diff
changeset
|
599 | reason = PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR; |
|
20443
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
600 | } |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
601 | |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
32156
diff
changeset
|
602 | purple_connection_error (gc, reason, |
| 21279 | 603 | purple_ssl_strerror(ssl_error)); |
|
20443
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
604 | } |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
605 | |
|
20431
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
606 | gboolean |
| 21279 | 607 | purple_connection_error_is_fatal (PurpleConnectionError reason) |
|
20431
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
608 | { |
|
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
609 | switch (reason) |
|
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
610 | { |
| 21279 | 611 | case PURPLE_CONNECTION_ERROR_NETWORK_ERROR: |
|
22162
1e0f1dbe89da
Adjust some network error fatalities and things
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21865
diff
changeset
|
612 | case PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR: |
|
21508
0ae51085309d
Consensus on #pidgin is that certificate errors and AUTHENTICATION_IMPOSSIBLE
Will Thompson <resiak@pidgin.im>
parents:
21507
diff
changeset
|
613 | return FALSE; |
|
0ae51085309d
Consensus on #pidgin is that certificate errors and AUTHENTICATION_IMPOSSIBLE
Will Thompson <resiak@pidgin.im>
parents:
21507
diff
changeset
|
614 | case PURPLE_CONNECTION_ERROR_INVALID_USERNAME: |
|
0ae51085309d
Consensus on #pidgin is that certificate errors and AUTHENTICATION_IMPOSSIBLE
Will Thompson <resiak@pidgin.im>
parents:
21507
diff
changeset
|
615 | case PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED: |
| 21279 | 616 | case PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE: |
|
21508
0ae51085309d
Consensus on #pidgin is that certificate errors and AUTHENTICATION_IMPOSSIBLE
Will Thompson <resiak@pidgin.im>
parents:
21507
diff
changeset
|
617 | case PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT: |
|
0ae51085309d
Consensus on #pidgin is that certificate errors and AUTHENTICATION_IMPOSSIBLE
Will Thompson <resiak@pidgin.im>
parents:
21507
diff
changeset
|
618 | case PURPLE_CONNECTION_ERROR_NAME_IN_USE: |
|
0ae51085309d
Consensus on #pidgin is that certificate errors and AUTHENTICATION_IMPOSSIBLE
Will Thompson <resiak@pidgin.im>
parents:
21507
diff
changeset
|
619 | case PURPLE_CONNECTION_ERROR_INVALID_SETTINGS: |
|
0ae51085309d
Consensus on #pidgin is that certificate errors and AUTHENTICATION_IMPOSSIBLE
Will Thompson <resiak@pidgin.im>
parents:
21507
diff
changeset
|
620 | case PURPLE_CONNECTION_ERROR_OTHER_ERROR: |
| 21279 | 621 | case PURPLE_CONNECTION_ERROR_CERT_NOT_PROVIDED: |
| 622 | case PURPLE_CONNECTION_ERROR_CERT_UNTRUSTED: | |
| 623 | case PURPLE_CONNECTION_ERROR_CERT_EXPIRED: | |
| 624 | case PURPLE_CONNECTION_ERROR_CERT_NOT_ACTIVATED: | |
| 625 | case PURPLE_CONNECTION_ERROR_CERT_HOSTNAME_MISMATCH: | |
| 626 | case PURPLE_CONNECTION_ERROR_CERT_FINGERPRINT_MISMATCH: | |
| 627 | case PURPLE_CONNECTION_ERROR_CERT_SELF_SIGNED: | |
| 628 | case PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR: | |
|
20431
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
629 | return TRUE; |
|
21153
610a45545a40
datallah pointed out that using g_return_if_fail() is preferable to
Will Thompson <resiak@pidgin.im>
parents:
21149
diff
changeset
|
630 | default: |
|
610a45545a40
datallah pointed out that using g_return_if_fail() is preferable to
Will Thompson <resiak@pidgin.im>
parents:
21149
diff
changeset
|
631 | g_return_val_if_reached(TRUE); |
|
20431
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
632 | } |
|
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
633 | } |
|
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
634 | |
|
32679
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
635 | void purple_connection_update_last_received(PurpleConnection *gc) |
|
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
636 | { |
|
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
637 | g_return_if_fail(gc != NULL); |
|
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
638 | |
|
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
639 | gc->last_received = time(NULL); |
|
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
640 | } |
|
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
641 | |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
642 | void |
| 15884 | 643 | purple_connections_disconnect_all(void) |
| 5563 | 644 | { |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
645 | GList *l; |
| 15884 | 646 | PurpleConnection *gc; |
| 5563 | 647 | |
| 15884 | 648 | while ((l = purple_connections_get_all()) != NULL) { |
|
6113
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6111
diff
changeset
|
649 | gc = l->data; |
|
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6111
diff
changeset
|
650 | gc->wants_to_die = TRUE; |
| 15884 | 651 | purple_account_disconnect(gc->account); |
|
6113
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6111
diff
changeset
|
652 | } |
| 5563 | 653 | } |
| 654 | ||
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
655 | GList * |
| 15884 | 656 | purple_connections_get_all(void) |
| 5563 | 657 | { |
| 658 | return connections; | |
| 659 | } | |
| 660 | ||
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
661 | GList * |
| 15884 | 662 | purple_connections_get_connecting(void) |
|
5788
dd6e33a59151
[gaim-migrate @ 6213]
Christian Hammond <chipx86@chipx86.com>
parents:
5784
diff
changeset
|
663 | { |
|
dd6e33a59151
[gaim-migrate @ 6213]
Christian Hammond <chipx86@chipx86.com>
parents:
5784
diff
changeset
|
664 | return connections_connecting; |
|
dd6e33a59151
[gaim-migrate @ 6213]
Christian Hammond <chipx86@chipx86.com>
parents:
5784
diff
changeset
|
665 | } |
|
dd6e33a59151
[gaim-migrate @ 6213]
Christian Hammond <chipx86@chipx86.com>
parents:
5784
diff
changeset
|
666 | |
| 5563 | 667 | void |
| 15884 | 668 | purple_connections_set_ui_ops(PurpleConnectionUiOps *ops) |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
669 | { |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
670 | connection_ui_ops = ops; |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
671 | } |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
672 | |
| 15884 | 673 | PurpleConnectionUiOps * |
| 674 | purple_connections_get_ui_ops(void) | |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
675 | { |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
676 | return connection_ui_ops; |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
677 | } |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
678 | |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
679 | void |
| 15884 | 680 | purple_connections_init(void) |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
681 | { |
| 15884 | 682 | void *handle = purple_connections_get_handle(); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
683 | |
| 15884 | 684 | purple_signal_register(handle, "signing-on", |
| 685 | purple_marshal_VOID__POINTER, NULL, 1, | |
| 686 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 687 | PURPLE_SUBTYPE_CONNECTION)); | |
|
6564
a7a2c1927544
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6533
diff
changeset
|
688 | |
| 15884 | 689 | purple_signal_register(handle, "signed-on", |
| 690 | purple_marshal_VOID__POINTER, NULL, 1, | |
| 691 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 692 | PURPLE_SUBTYPE_CONNECTION)); | |
|
6564
a7a2c1927544
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6533
diff
changeset
|
693 | |
| 15884 | 694 | purple_signal_register(handle, "signing-off", |
| 695 | purple_marshal_VOID__POINTER, NULL, 1, | |
| 696 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 697 | PURPLE_SUBTYPE_CONNECTION)); | |
|
6564
a7a2c1927544
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6533
diff
changeset
|
698 | |
| 15884 | 699 | purple_signal_register(handle, "signed-off", |
| 700 | purple_marshal_VOID__POINTER, NULL, 1, | |
| 701 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 702 | PURPLE_SUBTYPE_CONNECTION)); | |
|
21285
ca8cb8706802
I figured a signal firing on a connection error would be useful.
Will Thompson <resiak@pidgin.im>
parents:
21279
diff
changeset
|
703 | |
|
ca8cb8706802
I figured a signal firing on a connection error would be useful.
Will Thompson <resiak@pidgin.im>
parents:
21279
diff
changeset
|
704 | purple_signal_register(handle, "connection-error", |
|
21576
cba0bab065e9
Register the correct number of values for the "connection-error" signal.
Daniel Atallah <datallah@pidgin.im>
parents:
21509
diff
changeset
|
705 | purple_marshal_VOID__POINTER_INT_POINTER, NULL, 3, |
|
21285
ca8cb8706802
I figured a signal firing on a connection error would be useful.
Will Thompson <resiak@pidgin.im>
parents:
21279
diff
changeset
|
706 | purple_value_new(PURPLE_TYPE_SUBTYPE, |
|
ca8cb8706802
I figured a signal firing on a connection error would be useful.
Will Thompson <resiak@pidgin.im>
parents:
21279
diff
changeset
|
707 | PURPLE_SUBTYPE_CONNECTION), |
|
ca8cb8706802
I figured a signal firing on a connection error would be useful.
Will Thompson <resiak@pidgin.im>
parents:
21279
diff
changeset
|
708 | purple_value_new(PURPLE_TYPE_ENUM), |
|
ca8cb8706802
I figured a signal firing on a connection error would be useful.
Will Thompson <resiak@pidgin.im>
parents:
21279
diff
changeset
|
709 | purple_value_new(PURPLE_TYPE_STRING)); |
|
ca8cb8706802
I figured a signal firing on a connection error would be useful.
Will Thompson <resiak@pidgin.im>
parents:
21279
diff
changeset
|
710 | |
|
30039
9cd7672bae4f
Add an autojoin connection signal
Richard Laager <rlaager@pidgin.im>
parents:
28577
diff
changeset
|
711 | purple_signal_register(handle, "autojoin", |
|
9cd7672bae4f
Add an autojoin connection signal
Richard Laager <rlaager@pidgin.im>
parents:
28577
diff
changeset
|
712 | purple_marshal_BOOLEAN__POINTER, NULL, 1, |
|
9cd7672bae4f
Add an autojoin connection signal
Richard Laager <rlaager@pidgin.im>
parents:
28577
diff
changeset
|
713 | purple_value_new(PURPLE_TYPE_SUBTYPE, |
|
9cd7672bae4f
Add an autojoin connection signal
Richard Laager <rlaager@pidgin.im>
parents:
28577
diff
changeset
|
714 | PURPLE_SUBTYPE_CONNECTION)); |
|
9cd7672bae4f
Add an autojoin connection signal
Richard Laager <rlaager@pidgin.im>
parents:
28577
diff
changeset
|
715 | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
716 | } |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
717 | |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
718 | void |
| 15884 | 719 | purple_connections_uninit(void) |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
720 | { |
| 15884 | 721 | purple_signals_unregister_by_instance(purple_connections_get_handle()); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
722 | } |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
723 | |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
724 | void * |
| 15884 | 725 | purple_connections_get_handle(void) |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
726 | { |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
727 | return &connections_handle; |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
728 | } |