Sun, 21 Aug 2011 07:57:28 +0000
Remove purple_connection_error
| 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" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
34 | #include "log.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
35 | #include "notify.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
36 | #include "prefs.h" |
|
14900
4af8b81519b6
[gaim-migrate @ 17607]
Mark Doliner <markdoliner@pidgin.im>
parents:
14814
diff
changeset
|
37 | #include "proxy.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
38 | #include "request.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
39 | #include "server.h" |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
40 | #include "signals.h" |
|
6106
1dc08be40f0a
[gaim-migrate @ 6567]
Mark Doliner <markdoliner@pidgin.im>
parents:
6076
diff
changeset
|
41 | #include "util.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
42 | |
|
21865
59b1c56633d1
De-magic number the prpl_info->keepalive interval, and document it.
Will Thompson <resiak@pidgin.im>
parents:
21831
diff
changeset
|
43 | #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
|
44 | |
| 5563 | 45 | static GList *connections = NULL; |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
46 | static GList *connections_connecting = NULL; |
| 15884 | 47 | static PurpleConnectionUiOps *connection_ui_ops = NULL; |
| 5563 | 48 | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
49 | static int connections_handle; |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
50 | |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
51 | static gboolean |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
52 | send_keepalive(gpointer data) |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
53 | { |
| 15884 | 54 | 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
|
55 | 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
|
56 | |
|
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 | /* 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
|
58 | * 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
|
59 | */ |
|
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
|
60 | 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
|
61 | 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
|
62 | |
|
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 | 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
|
64 | if (prpl_info->keepalive) |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
65 | prpl_info->keepalive(gc); |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
66 | |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
67 | return TRUE; |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
68 | } |
|
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 | static void |
| 15884 | 71 | update_keepalive(PurpleConnection *gc, gboolean on) |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
72 | { |
| 15884 | 73 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
14545
f8b45a0ddac5
[gaim-migrate @ 17202]
Daniel Atallah <datallah@pidgin.im>
parents:
14254
diff
changeset
|
74 | |
|
f8b45a0ddac5
[gaim-migrate @ 17202]
Daniel Atallah <datallah@pidgin.im>
parents:
14254
diff
changeset
|
75 | if (gc != NULL && gc->prpl != NULL) |
| 15884 | 76 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); |
|
14545
f8b45a0ddac5
[gaim-migrate @ 17202]
Daniel Atallah <datallah@pidgin.im>
parents:
14254
diff
changeset
|
77 | |
|
f8b45a0ddac5
[gaim-migrate @ 17202]
Daniel Atallah <datallah@pidgin.im>
parents:
14254
diff
changeset
|
78 | if (!prpl_info || !prpl_info->keepalive) |
|
f8b45a0ddac5
[gaim-migrate @ 17202]
Daniel Atallah <datallah@pidgin.im>
parents:
14254
diff
changeset
|
79 | return; |
|
f8b45a0ddac5
[gaim-migrate @ 17202]
Daniel Atallah <datallah@pidgin.im>
parents:
14254
diff
changeset
|
80 | |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
81 | if (on && !gc->keepalive) |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
82 | { |
| 15884 | 83 | 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
|
84 | 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
|
85 | } |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
86 | else if (!on && gc->keepalive > 0) |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
87 | { |
| 15884 | 88 | purple_debug_info("connection", "Deactivating keepalive.\n"); |
| 89 | purple_timeout_remove(gc->keepalive); | |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
90 | gc->keepalive = 0; |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
91 | } |
|
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 | |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
94 | void |
| 15884 | 95 | purple_connection_new(PurpleAccount *account, gboolean regist, const char *password) |
| 5563 | 96 | { |
|
24569
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
22336
diff
changeset
|
97 | _purple_connection_new(account, regist, password); |
|
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
22336
diff
changeset
|
98 | } |
|
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
22336
diff
changeset
|
99 | |
|
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
22336
diff
changeset
|
100 | void |
|
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
22336
diff
changeset
|
101 | _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
|
102 | { |
| 15884 | 103 | PurpleConnection *gc; |
| 104 | PurplePlugin *prpl; | |
| 105 | PurplePluginProtocolInfo *prpl_info; | |
| 5563 | 106 | |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
107 | g_return_if_fail(account != NULL); |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
108 | |
| 15884 | 109 | if (!purple_account_is_disconnected(account)) |
|
10755
a336a5d3102d
[gaim-migrate @ 12358]
Mark Doliner <markdoliner@pidgin.im>
parents:
10754
diff
changeset
|
110 | return; |
|
a336a5d3102d
[gaim-migrate @ 12358]
Mark Doliner <markdoliner@pidgin.im>
parents:
10754
diff
changeset
|
111 | |
| 15884 | 112 | prpl = purple_find_prpl(purple_account_get_protocol_id(account)); |
|
10740
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 | if (prpl != NULL) |
| 15884 | 115 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
116 | else { |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
117 | gchar *message; |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
118 | |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
119 | message = g_strdup_printf(_("Missing protocol plugin for %s"), |
| 15884 | 120 | purple_account_get_username(account)); |
| 121 | purple_notify_error(NULL, regist ? _("Registration Error") : | |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
122 | _("Connection Error"), message, NULL); |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
123 | g_free(message); |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
124 | return; |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
125 | } |
|
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 | if (regist) |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
128 | { |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
129 | if (prpl_info->register_user == NULL) |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
130 | return; |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
131 | } |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
132 | else |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
133 | { |
|
10751
e15f4f5927ce
[gaim-migrate @ 12354]
Mark Doliner <markdoliner@pidgin.im>
parents:
10745
diff
changeset
|
134 | if (((password == NULL) || (*password == '\0')) && |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
135 | !(prpl_info->options & OPT_PROTO_NO_PASSWORD) && |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
136 | !(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL)) |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
137 | { |
|
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
|
138 | purple_debug_error("connection", "Cannot connect to account %s without " |
| 15884 | 139 | "a password.\n", purple_account_get_username(account)); |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
140 | return; |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
141 | } |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
142 | } |
| 5563 | 143 | |
| 15884 | 144 | gc = g_new0(PurpleConnection, 1); |
| 145 | PURPLE_DBUS_REGISTER_POINTER(gc, PurpleConnection); | |
|
11146
c56333373e3c
[gaim-migrate @ 13217]
Piotr Zielinski <zielaj@users.sourceforge.net>
parents:
11033
diff
changeset
|
146 | |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
147 | gc->prpl = prpl; |
|
10751
e15f4f5927ce
[gaim-migrate @ 12354]
Mark Doliner <markdoliner@pidgin.im>
parents:
10745
diff
changeset
|
148 | if ((password != NULL) && (*password != '\0')) |
|
e15f4f5927ce
[gaim-migrate @ 12354]
Mark Doliner <markdoliner@pidgin.im>
parents:
10745
diff
changeset
|
149 | gc->password = g_strdup(password); |
| 15884 | 150 | purple_connection_set_account(gc, account); |
| 151 | purple_connection_set_state(gc, PURPLE_CONNECTING); | |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
152 | connections = g_list_append(connections, gc); |
| 15884 | 153 | purple_account_set_connection(account, gc); |
| 5563 | 154 | |
| 15884 | 155 | purple_signal_emit(purple_connections_get_handle(), "signing-on", gc); |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
156 | |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
157 | if (regist) |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
158 | { |
| 15884 | 159 | purple_debug_info("connection", "Registering. gc = %p\n", gc); |
|
10740
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 | /* set this so we don't auto-reconnect after registering */ |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
162 | gc->wants_to_die = TRUE; |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
163 | |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
164 | prpl_info->register_user(account); |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
165 | } |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
166 | else |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
167 | { |
| 15884 | 168 | purple_debug_info("connection", "Connecting. gc = %p\n", gc); |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
169 | |
| 15884 | 170 | purple_signal_emit(purple_accounts_get_handle(), "account-connecting", account); |
|
11837
2f1206084fef
[gaim-migrate @ 14128]
Mark Doliner <markdoliner@pidgin.im>
parents:
11698
diff
changeset
|
171 | prpl_info->login(account); |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
172 | } |
| 5563 | 173 | } |
|
24569
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
22336
diff
changeset
|
174 | void |
|
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
22336
diff
changeset
|
175 | purple_connection_new_unregister(PurpleAccount *account, const char *password, PurpleAccountUnregistrationCb cb, void *user_data) |
|
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
22336
diff
changeset
|
176 | { |
|
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
22336
diff
changeset
|
177 | _purple_connection_new_unregister(account, password, cb, user_data); |
|
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
22336
diff
changeset
|
178 | } |
| 5563 | 179 | |
| 180 | void | |
|
24569
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
22336
diff
changeset
|
181 | _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
|
182 | { |
|
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 | /* 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
|
184 | 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
|
185 | 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
|
186 | PurplePluginProtocolInfo *prpl_info; |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25874
diff
changeset
|
187 | |
|
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
|
188 | g_return_if_fail(account != NULL); |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25874
diff
changeset
|
189 | |
|
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
|
190 | prpl = purple_find_prpl(purple_account_get_protocol_id(account)); |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25874
diff
changeset
|
191 | |
|
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
|
192 | 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
|
193 | 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
|
194 | 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
|
195 | gchar *message; |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25874
diff
changeset
|
196 | |
|
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
|
197 | 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
|
198 | 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
|
199 | 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
|
200 | 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
|
201 | 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
|
202 | } |
|
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
|
203 | |
|
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 | 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
|
205 | 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
|
206 | 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
|
207 | } |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25874
diff
changeset
|
208 | |
|
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
|
209 | 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
|
210 | !(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
|
211 | !(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
|
212 | { |
|
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
|
213 | 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
|
214 | "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
|
215 | 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
|
216 | } |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25874
diff
changeset
|
217 | |
|
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
|
218 | 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
|
219 | PURPLE_DBUS_REGISTER_POINTER(gc, PurpleConnection); |
|
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 | 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
|
222 | 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
|
223 | 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
|
224 | 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
|
225 | 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
|
226 | 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
|
227 | purple_account_set_connection(account, gc); |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25874
diff
changeset
|
228 | |
|
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
|
229 | purple_signal_emit(purple_connections_get_handle(), "signing-on", gc); |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25874
diff
changeset
|
230 | |
|
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
|
231 | purple_debug_info("connection", "Unregistering. gc = %p\n", gc); |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25874
diff
changeset
|
232 | |
|
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
|
233 | 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
|
234 | } |
|
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
|
235 | |
|
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
|
236 | void |
| 15884 | 237 | purple_connection_destroy(PurpleConnection *gc) |
| 5563 | 238 | { |
|
24569
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
22336
diff
changeset
|
239 | _purple_connection_destroy(gc); |
|
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
22336
diff
changeset
|
240 | } |
|
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
22336
diff
changeset
|
241 | |
|
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
22336
diff
changeset
|
242 | void |
|
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
22336
diff
changeset
|
243 | _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
|
244 | { |
| 15884 | 245 | 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
|
246 | GSList *buddies; |
| 15884 | 247 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
11507
1a6c8ccce2a9
[gaim-migrate @ 13752]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11305
diff
changeset
|
248 | gboolean remove = FALSE; |
|
5741
0a52405f402f
[gaim-migrate @ 6165]
Christian Hammond <chipx86@chipx86.com>
parents:
5740
diff
changeset
|
249 | |
| 5563 | 250 | g_return_if_fail(gc != NULL); |
| 251 | ||
| 15884 | 252 | account = purple_connection_get_account(gc); |
|
5926
f0c5bbf16793
[gaim-migrate @ 6366]
Christian Hammond <chipx86@chipx86.com>
parents:
5905
diff
changeset
|
253 | |
| 15884 | 254 | purple_debug_info("connection", "Disconnecting connection %p\n", gc); |
|
10754
d5f1ddb4146f
[gaim-migrate @ 12357]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
255 | |
| 15884 | 256 | if (purple_connection_get_state(gc) != PURPLE_CONNECTING) |
|
11507
1a6c8ccce2a9
[gaim-migrate @ 13752]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11305
diff
changeset
|
257 | remove = TRUE; |
|
5926
f0c5bbf16793
[gaim-migrate @ 6366]
Christian Hammond <chipx86@chipx86.com>
parents:
5905
diff
changeset
|
258 | |
| 15884 | 259 | purple_signal_emit(purple_connections_get_handle(), "signing-off", gc); |
|
5930
cdd2e5397cd3
[gaim-migrate @ 6370]
Christian Hammond <chipx86@chipx86.com>
parents:
5926
diff
changeset
|
260 | |
|
10754
d5f1ddb4146f
[gaim-migrate @ 12357]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
261 | while (gc->buddy_chats) |
|
d5f1ddb4146f
[gaim-migrate @ 12357]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
262 | { |
| 15884 | 263 | PurpleConversation *b = gc->buddy_chats->data; |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
264 | |
|
10754
d5f1ddb4146f
[gaim-migrate @ 12357]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
265 | gc->buddy_chats = g_slist_remove(gc->buddy_chats, b); |
| 15884 | 266 | purple_conv_chat_left(PURPLE_CONV_CHAT(b)); |
|
10754
d5f1ddb4146f
[gaim-migrate @ 12357]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
267 | } |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
268 | |
|
10754
d5f1ddb4146f
[gaim-migrate @ 12357]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
269 | update_keepalive(gc, FALSE); |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
270 | |
| 15884 | 271 | purple_proxy_connect_cancel_with_handle(gc); |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
272 | |
| 15884 | 273 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); |
|
14900
4af8b81519b6
[gaim-migrate @ 17607]
Mark Doliner <markdoliner@pidgin.im>
parents:
14814
diff
changeset
|
274 | if (prpl_info->close) |
|
4af8b81519b6
[gaim-migrate @ 17607]
Mark Doliner <markdoliner@pidgin.im>
parents:
14814
diff
changeset
|
275 | (prpl_info->close)(gc); |
| 5563 | 276 | |
|
14814
479ac60fb641
[gaim-migrate @ 17509]
Daniel Atallah <datallah@pidgin.im>
parents:
14669
diff
changeset
|
277 | /* Clear out the proto data that was freed in the prpl close method*/ |
| 15884 | 278 | 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
|
279 | 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
|
280 | 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
|
281 | 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
|
282 | buddies = g_slist_delete_link(buddies, buddies); |
|
14814
479ac60fb641
[gaim-migrate @ 17509]
Daniel Atallah <datallah@pidgin.im>
parents:
14669
diff
changeset
|
283 | } |
|
479ac60fb641
[gaim-migrate @ 17509]
Daniel Atallah <datallah@pidgin.im>
parents:
14669
diff
changeset
|
284 | |
|
10754
d5f1ddb4146f
[gaim-migrate @ 12357]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
285 | connections = g_list_remove(connections, gc); |
| 5563 | 286 | |
| 15884 | 287 | purple_connection_set_state(gc, PURPLE_DISCONNECTED); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
288 | |
|
11507
1a6c8ccce2a9
[gaim-migrate @ 13752]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11305
diff
changeset
|
289 | if (remove) |
| 15884 | 290 | purple_blist_remove_account(account); |
|
11507
1a6c8ccce2a9
[gaim-migrate @ 13752]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11305
diff
changeset
|
291 | |
| 15884 | 292 | purple_signal_emit(purple_connections_get_handle(), "signed-off", gc); |
|
5615
2eb715cbbd9b
[gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents:
5581
diff
changeset
|
293 | |
| 15884 | 294 | purple_account_request_close_with_account(account); |
| 295 | purple_request_close_with_handle(gc); | |
| 296 | purple_notify_close_with_handle(gc); | |
| 5563 | 297 | |
| 15884 | 298 | purple_debug_info("connection", "Destroying connection %p\n", gc); |
|
10742
2783135f0ecf
[gaim-migrate @ 12344]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
299 | |
| 15884 | 300 | purple_account_set_connection(account, NULL); |
|
10742
2783135f0ecf
[gaim-migrate @ 12344]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
301 | |
|
13976
2543396bd00e
[gaim-migrate @ 16414]
Mark Doliner <markdoliner@pidgin.im>
parents:
13508
diff
changeset
|
302 | g_free(gc->password); |
|
2543396bd00e
[gaim-migrate @ 16414]
Mark Doliner <markdoliner@pidgin.im>
parents:
13508
diff
changeset
|
303 | g_free(gc->display_name); |
|
9848
708a47f26faa
[gaim-migrate @ 10726]
Dave West <kat@users.sourceforge.net>
parents:
9699
diff
changeset
|
304 | |
|
27336
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
305 | if (gc->disconnect_timeout > 0) |
| 15884 | 306 | purple_timeout_remove(gc->disconnect_timeout); |
|
6029
85d6afa168fb
[gaim-migrate @ 6479]
Mark Doliner <markdoliner@pidgin.im>
parents:
6018
diff
changeset
|
307 | |
| 15884 | 308 | PURPLE_DBUS_UNREGISTER_POINTER(gc); |
|
10742
2783135f0ecf
[gaim-migrate @ 12344]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
309 | g_free(gc); |
|
6029
85d6afa168fb
[gaim-migrate @ 6479]
Mark Doliner <markdoliner@pidgin.im>
parents:
6018
diff
changeset
|
310 | } |
|
85d6afa168fb
[gaim-migrate @ 6479]
Mark Doliner <markdoliner@pidgin.im>
parents:
6018
diff
changeset
|
311 | |
| 5563 | 312 | /* |
|
8130
58e4e51f514b
[gaim-migrate @ 8835]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
313 | * d:)->-< |
| 5563 | 314 | * |
| 315 | * d:O-\-< | |
|
8130
58e4e51f514b
[gaim-migrate @ 8835]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
316 | * |
| 5563 | 317 | * d:D-/-< |
| 318 | * | |
| 319 | * d8D->-< DANCE! | |
| 320 | */ | |
| 321 | ||
| 322 | void | |
| 15884 | 323 | purple_connection_set_state(PurpleConnection *gc, PurpleConnectionState state) |
| 5563 | 324 | { |
| 15884 | 325 | PurpleConnectionUiOps *ops; |
|
5885
223ac977eed2
[gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents:
5883
diff
changeset
|
326 | |
| 5563 | 327 | g_return_if_fail(gc != NULL); |
| 328 | ||
|
5784
4c9046760b5b
[gaim-migrate @ 6209]
Christian Hammond <chipx86@chipx86.com>
parents:
5741
diff
changeset
|
329 | if (gc->state == state) |
|
4c9046760b5b
[gaim-migrate @ 6209]
Christian Hammond <chipx86@chipx86.com>
parents:
5741
diff
changeset
|
330 | return; |
|
4c9046760b5b
[gaim-migrate @ 6209]
Christian Hammond <chipx86@chipx86.com>
parents:
5741
diff
changeset
|
331 | |
| 5563 | 332 | gc->state = state; |
| 333 | ||
| 15884 | 334 | ops = purple_connections_get_ui_ops(); |
|
5885
223ac977eed2
[gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents:
5883
diff
changeset
|
335 | |
| 15884 | 336 | if (gc->state == PURPLE_CONNECTING) { |
|
5905
62a6bdbc09b7
[gaim-migrate @ 6337]
Robert McQueen <robot101@debian.org>
parents:
5885
diff
changeset
|
337 | connections_connecting = g_list_append(connections_connecting, gc); |
|
62a6bdbc09b7
[gaim-migrate @ 6337]
Robert McQueen <robot101@debian.org>
parents:
5885
diff
changeset
|
338 | } |
|
62a6bdbc09b7
[gaim-migrate @ 6337]
Robert McQueen <robot101@debian.org>
parents:
5885
diff
changeset
|
339 | else { |
|
5885
223ac977eed2
[gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents:
5883
diff
changeset
|
340 | connections_connecting = g_list_remove(connections_connecting, gc); |
|
5905
62a6bdbc09b7
[gaim-migrate @ 6337]
Robert McQueen <robot101@debian.org>
parents:
5885
diff
changeset
|
341 | } |
|
5885
223ac977eed2
[gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents:
5883
diff
changeset
|
342 | |
| 15884 | 343 | if (gc->state == PURPLE_CONNECTED) { |
| 344 | PurpleAccount *account; | |
| 345 | PurplePresence *presence; | |
|
10052
329dad7e2da3
[gaim-migrate @ 11013]
Dave West <kat@users.sourceforge.net>
parents:
9944
diff
changeset
|
346 | |
| 15884 | 347 | account = purple_connection_get_account(gc); |
| 348 | presence = purple_account_get_presence(account); | |
| 5563 | 349 | |
| 350 | /* Set the time the account came online */ | |
| 15884 | 351 | purple_presence_set_login_time(presence, time(NULL)); |
| 5563 | 352 | |
|
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
|
353 | if (purple_prefs_get_bool("/purple/logging/log_system")) |
|
11698
afbf0d8bdacf
[gaim-migrate @ 13989]
Mark Doliner <markdoliner@pidgin.im>
parents:
11562
diff
changeset
|
354 | { |
| 15884 | 355 | PurpleLog *log = purple_account_get_log(account, TRUE); |
|
13508
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
356 | |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
357 | if (log != NULL) |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
358 | { |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
359 | char *msg = g_strdup_printf(_("+++ %s signed on"), |
| 15884 | 360 | purple_account_get_username(account)); |
| 361 | purple_log_write(log, PURPLE_MESSAGE_SYSTEM, | |
| 362 | purple_account_get_username(account), | |
| 363 | purple_presence_get_login_time(presence), | |
|
13508
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
364 | msg); |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
365 | g_free(msg); |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
366 | } |
|
10301
fd24ab69574a
[gaim-migrate @ 11486]
Mark Doliner <markdoliner@pidgin.im>
parents:
10193
diff
changeset
|
367 | } |
|
fd24ab69574a
[gaim-migrate @ 11486]
Mark Doliner <markdoliner@pidgin.im>
parents:
10193
diff
changeset
|
368 | |
| 5563 | 369 | if (ops != NULL && ops->connected != NULL) |
| 370 | ops->connected(gc); | |
| 371 | ||
| 15884 | 372 | purple_blist_add_account(account); |
| 5563 | 373 | |
| 15884 | 374 | 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
|
375 | 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
|
376 | |
| 5563 | 377 | serv_set_permit_deny(gc); |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
378 | |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
379 | update_keepalive(gc, TRUE); |
| 5563 | 380 | } |
| 15884 | 381 | else if (gc->state == PURPLE_DISCONNECTED) { |
| 382 | PurpleAccount *account = purple_connection_get_account(gc); | |
| 8573 | 383 | |
|
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
|
384 | if (purple_prefs_get_bool("/purple/logging/log_system")) |
|
11698
afbf0d8bdacf
[gaim-migrate @ 13989]
Mark Doliner <markdoliner@pidgin.im>
parents:
11562
diff
changeset
|
385 | { |
| 15884 | 386 | PurpleLog *log = purple_account_get_log(account, FALSE); |
|
13508
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
387 | |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
388 | if (log != NULL) |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
389 | { |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
390 | char *msg = g_strdup_printf(_("+++ %s signed off"), |
| 15884 | 391 | purple_account_get_username(account)); |
| 392 | purple_log_write(log, PURPLE_MESSAGE_SYSTEM, | |
| 393 | purple_account_get_username(account), time(NULL), | |
|
13508
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
394 | msg); |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
395 | g_free(msg); |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
396 | } |
| 8573 | 397 | } |
| 398 | ||
| 15884 | 399 | purple_account_destroy_log(account); |
| 8573 | 400 | |
|
5885
223ac977eed2
[gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents:
5883
diff
changeset
|
401 | if (ops != NULL && ops->disconnected != NULL) |
| 9190 | 402 | ops->disconnected(gc); |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
403 | } |
| 5563 | 404 | } |
| 405 | ||
| 406 | void | |
| 15884 | 407 | purple_connection_set_account(PurpleConnection *gc, PurpleAccount *account) |
| 5563 | 408 | { |
| 409 | g_return_if_fail(gc != NULL); | |
| 410 | g_return_if_fail(account != NULL); | |
| 411 | ||
| 412 | gc->account = account; | |
| 413 | } | |
| 414 | ||
| 415 | void | |
| 15884 | 416 | purple_connection_set_display_name(PurpleConnection *gc, const char *name) |
| 5563 | 417 | { |
| 418 | g_return_if_fail(gc != NULL); | |
| 419 | ||
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14035
diff
changeset
|
420 | g_free(gc->display_name); |
|
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14035
diff
changeset
|
421 | gc->display_name = g_strdup(name); |
| 5563 | 422 | } |
| 423 | ||
|
24937
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
424 | void |
|
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
425 | 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
|
426 | 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
|
427 | |
|
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
428 | 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
|
429 | } |
|
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
430 | |
| 15884 | 431 | PurpleConnectionState |
| 432 | purple_connection_get_state(const PurpleConnection *gc) | |
| 5563 | 433 | { |
| 15884 | 434 | g_return_val_if_fail(gc != NULL, PURPLE_DISCONNECTED); |
| 5563 | 435 | |
| 436 | return gc->state; | |
| 437 | } | |
| 438 | ||
| 15884 | 439 | PurpleAccount * |
| 440 | purple_connection_get_account(const PurpleConnection *gc) | |
| 5563 | 441 | { |
| 442 | g_return_val_if_fail(gc != NULL, NULL); | |
| 443 | ||
| 444 | return gc->account; | |
| 445 | } | |
| 446 | ||
|
22336
ac905bb0a8ec
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22324
diff
changeset
|
447 | PurplePlugin * |
|
ac905bb0a8ec
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22324
diff
changeset
|
448 | 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
|
449 | { |
|
ac905bb0a8ec
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22324
diff
changeset
|
450 | 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
|
451 | |
|
ac905bb0a8ec
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22324
diff
changeset
|
452 | 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
|
453 | } |
|
ac905bb0a8ec
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22324
diff
changeset
|
454 | |
| 5563 | 455 | const char * |
| 15884 | 456 | purple_connection_get_password(const PurpleConnection *gc) |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
457 | { |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
458 | g_return_val_if_fail(gc != NULL, NULL); |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
459 | |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
460 | return gc->password ? gc->password : gc->account->password; |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
461 | } |
|
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 | const char * |
| 15884 | 464 | purple_connection_get_display_name(const PurpleConnection *gc) |
| 5563 | 465 | { |
| 466 | g_return_val_if_fail(gc != NULL, NULL); | |
| 467 | ||
| 468 | return gc->display_name; | |
| 469 | } | |
| 470 | ||
|
24937
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
471 | void * |
|
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
472 | 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
|
473 | 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
|
474 | |
|
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
475 | 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
|
476 | } |
|
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
477 | |
| 5563 | 478 | void |
| 15884 | 479 | purple_connection_update_progress(PurpleConnection *gc, const char *text, |
| 5563 | 480 | size_t step, size_t count) |
| 481 | { | |
| 15884 | 482 | PurpleConnectionUiOps *ops; |
| 5563 | 483 | |
| 484 | g_return_if_fail(gc != NULL); | |
| 485 | g_return_if_fail(text != NULL); | |
| 486 | g_return_if_fail(step < count); | |
| 487 | g_return_if_fail(count > 1); | |
| 488 | ||
| 15884 | 489 | ops = purple_connections_get_ui_ops(); |
| 5563 | 490 | |
| 491 | if (ops != NULL && ops->connect_progress != NULL) | |
| 492 | ops->connect_progress(gc, text, step, count); | |
| 493 | } | |
| 494 | ||
| 495 | void | |
| 15884 | 496 | purple_connection_notice(PurpleConnection *gc, const char *text) |
|
5571
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
497 | { |
| 15884 | 498 | PurpleConnectionUiOps *ops; |
|
5571
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
499 | |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
500 | g_return_if_fail(gc != NULL); |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
501 | g_return_if_fail(text != NULL); |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
502 | |
| 15884 | 503 | ops = purple_connections_get_ui_ops(); |
|
5571
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
504 | |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
505 | if (ops != NULL && ops->notice != NULL) |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
506 | ops->notice(gc, text); |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
507 | } |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
508 | |
|
12412
8abe3226695e
[gaim-migrate @ 14719]
Richard Laager <rlaager@pidgin.im>
parents:
12272
diff
changeset
|
509 | static gboolean |
| 15884 | 510 | purple_connection_disconnect_cb(gpointer data) |
|
10742
2783135f0ecf
[gaim-migrate @ 12344]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
511 | { |
|
27336
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
512 | PurpleAccount *account; |
|
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
513 | PurpleConnection *gc; |
|
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
514 | char *password; |
|
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
515 | |
|
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
516 | account = data; |
|
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
517 | 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
|
518 | |
|
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
|
519 | 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
|
520 | 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
|
521 | |
|
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
522 | password = g_strdup(purple_account_get_password(account)); |
| 15884 | 523 | purple_account_disconnect(account); |
| 524 | purple_account_set_password(account, password); | |
| 11562 | 525 | g_free(password); |
|
27336
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
526 | |
|
10742
2783135f0ecf
[gaim-migrate @ 12344]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
527 | return FALSE; |
|
2783135f0ecf
[gaim-migrate @ 12344]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
528 | } |
|
2783135f0ecf
[gaim-migrate @ 12344]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
529 | |
|
5571
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
530 | void |
|
20430
bb30dff3da21
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <resiak@pidgin.im>
parents:
19897
diff
changeset
|
531 | purple_connection_error_reason (PurpleConnection *gc, |
| 21279 | 532 | PurpleConnectionError reason, |
|
20430
bb30dff3da21
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <resiak@pidgin.im>
parents:
19897
diff
changeset
|
533 | const char *description) |
|
bb30dff3da21
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <resiak@pidgin.im>
parents:
19897
diff
changeset
|
534 | { |
| 15884 | 535 | PurpleConnectionUiOps *ops; |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
536 | |
|
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
537 | g_return_if_fail(gc != NULL); |
| 21279 | 538 | /* This sanity check relies on PURPLE_CONNECTION_ERROR_OTHER_ERROR |
| 539 | * being the last member of the PurpleConnectionError enum in | |
| 540 | * connection.h; if other reasons are added after it, this check should | |
| 541 | * be updated. | |
|
21278
19f6ce8ee4ad
rlaager suggested using the last element of the PurpleDisconnectReason enum
Will Thompson <resiak@pidgin.im>
parents:
21154
diff
changeset
|
542 | */ |
| 21279 | 543 | 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
|
544 | purple_debug_error("connection", |
|
19f6ce8ee4ad
rlaager suggested using the last element of the PurpleDisconnectReason enum
Will Thompson <resiak@pidgin.im>
parents:
21154
diff
changeset
|
545 | "purple_connection_error_reason: reason %u isn't a " |
|
19f6ce8ee4ad
rlaager suggested using the last element of the PurpleDisconnectReason enum
Will Thompson <resiak@pidgin.im>
parents:
21154
diff
changeset
|
546 | "valid reason\n", reason); |
| 21279 | 547 | 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 | } |
|
15848
44463a06e833
Change connection.c:gaim_connection_error() to still work even if the
Mark Doliner <markdoliner@pidgin.im>
parents:
15537
diff
changeset
|
549 | |
|
20430
bb30dff3da21
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <resiak@pidgin.im>
parents:
19897
diff
changeset
|
550 | if (description == NULL) { |
|
25456
22f5daf76fe4
Slightly improve this debug error message
Mark Doliner <markdoliner@pidgin.im>
parents:
24569
diff
changeset
|
551 | purple_debug_error("connection", "purple_connection_error_reason called with NULL description\n"); |
|
20430
bb30dff3da21
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <resiak@pidgin.im>
parents:
19897
diff
changeset
|
552 | 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
|
553 | } |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
554 | |
| 6393 | 555 | /* 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
|
556 | if (gc->disconnect_timeout > 0) |
| 6393 | 557 | return; |
| 558 | ||
| 21279 | 559 | 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
|
560 | |
|
28091
03d2cecdb234
Log the reason for disconnection to the debug log, so that we might
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
27336
diff
changeset
|
561 | 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
|
562 | 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
|
563 | |
| 15884 | 564 | ops = purple_connections_get_ui_ops(); |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
565 | |
|
32153
121f15699f88
Rename the report_disconnect_reason cb function to report_disconnect
Mark Doliner <markdoliner@pidgin.im>
parents:
32152
diff
changeset
|
566 | 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
|
567 | ops->report_disconnect(gc, reason, description); |
| 5727 | 568 | |
|
21285
ca8cb8706802
I figured a signal firing on a connection error would be useful.
Will Thompson <resiak@pidgin.im>
parents:
21279
diff
changeset
|
569 | 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
|
570 | gc, reason, description); |
| 5727 | 571 | |
| 15884 | 572 | gc->disconnect_timeout = purple_timeout_add(0, purple_connection_disconnect_cb, |
| 573 | purple_connection_get_account(gc)); | |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
574 | } |
|
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
575 | |
|
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
576 | void |
|
20443
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
577 | 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
|
578 | PurpleSslErrorType ssl_error) |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
579 | { |
| 21279 | 580 | PurpleConnectionError reason; |
|
20443
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
581 | |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
582 | switch (ssl_error) { |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
583 | case PURPLE_SSL_HANDSHAKE_FAILED: |
|
22162
1e0f1dbe89da
Adjust some network error fatalities and things
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21865
diff
changeset
|
584 | reason = PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR; |
|
1e0f1dbe89da
Adjust some network error fatalities and things
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21865
diff
changeset
|
585 | break; |
|
20443
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
586 | case PURPLE_SSL_CONNECT_FAILED: |
|
22162
1e0f1dbe89da
Adjust some network error fatalities and things
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21865
diff
changeset
|
587 | 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
|
588 | break; |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
589 | case PURPLE_SSL_CERTIFICATE_INVALID: |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
590 | /* 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
|
591 | 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
|
592 | break; |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
593 | default: |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
594 | 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
|
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 | } |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
597 | |
| 21279 | 598 | purple_connection_error_reason (gc, reason, |
| 599 | 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
|
600 | } |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
601 | |
|
20431
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
602 | gboolean |
| 21279 | 603 | 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
|
604 | { |
|
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
605 | switch (reason) |
|
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
606 | { |
| 21279 | 607 | case PURPLE_CONNECTION_ERROR_NETWORK_ERROR: |
|
22162
1e0f1dbe89da
Adjust some network error fatalities and things
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21865
diff
changeset
|
608 | 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
|
609 | return FALSE; |
|
0ae51085309d
Consensus on #pidgin is that certificate errors and AUTHENTICATION_IMPOSSIBLE
Will Thompson <resiak@pidgin.im>
parents:
21507
diff
changeset
|
610 | 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
|
611 | case PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED: |
| 21279 | 612 | 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
|
613 | 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
|
614 | 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
|
615 | 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
|
616 | case PURPLE_CONNECTION_ERROR_OTHER_ERROR: |
| 21279 | 617 | case PURPLE_CONNECTION_ERROR_CERT_NOT_PROVIDED: |
| 618 | case PURPLE_CONNECTION_ERROR_CERT_UNTRUSTED: | |
| 619 | case PURPLE_CONNECTION_ERROR_CERT_EXPIRED: | |
| 620 | case PURPLE_CONNECTION_ERROR_CERT_NOT_ACTIVATED: | |
| 621 | case PURPLE_CONNECTION_ERROR_CERT_HOSTNAME_MISMATCH: | |
| 622 | case PURPLE_CONNECTION_ERROR_CERT_FINGERPRINT_MISMATCH: | |
| 623 | case PURPLE_CONNECTION_ERROR_CERT_SELF_SIGNED: | |
| 624 | 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
|
625 | 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
|
626 | default: |
|
610a45545a40
datallah pointed out that using g_return_if_fail() is preferable to
Will Thompson <resiak@pidgin.im>
parents:
21149
diff
changeset
|
627 | 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
|
628 | } |
|
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
629 | } |
|
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
630 | |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
631 | void |
| 15884 | 632 | purple_connections_disconnect_all(void) |
| 5563 | 633 | { |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
634 | GList *l; |
| 15884 | 635 | PurpleConnection *gc; |
| 5563 | 636 | |
| 15884 | 637 | while ((l = purple_connections_get_all()) != NULL) { |
|
6113
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6111
diff
changeset
|
638 | gc = l->data; |
|
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6111
diff
changeset
|
639 | gc->wants_to_die = TRUE; |
| 15884 | 640 | purple_account_disconnect(gc->account); |
|
6113
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6111
diff
changeset
|
641 | } |
| 5563 | 642 | } |
| 643 | ||
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
644 | GList * |
| 15884 | 645 | purple_connections_get_all(void) |
| 5563 | 646 | { |
| 647 | return connections; | |
| 648 | } | |
| 649 | ||
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
650 | GList * |
| 15884 | 651 | purple_connections_get_connecting(void) |
|
5788
dd6e33a59151
[gaim-migrate @ 6213]
Christian Hammond <chipx86@chipx86.com>
parents:
5784
diff
changeset
|
652 | { |
|
dd6e33a59151
[gaim-migrate @ 6213]
Christian Hammond <chipx86@chipx86.com>
parents:
5784
diff
changeset
|
653 | return connections_connecting; |
|
dd6e33a59151
[gaim-migrate @ 6213]
Christian Hammond <chipx86@chipx86.com>
parents:
5784
diff
changeset
|
654 | } |
|
dd6e33a59151
[gaim-migrate @ 6213]
Christian Hammond <chipx86@chipx86.com>
parents:
5784
diff
changeset
|
655 | |
| 5563 | 656 | void |
| 15884 | 657 | purple_connections_set_ui_ops(PurpleConnectionUiOps *ops) |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
658 | { |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
659 | connection_ui_ops = ops; |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
660 | } |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
661 | |
| 15884 | 662 | PurpleConnectionUiOps * |
| 663 | purple_connections_get_ui_ops(void) | |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
664 | { |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
665 | return connection_ui_ops; |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
666 | } |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
667 | |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
668 | void |
| 15884 | 669 | purple_connections_init(void) |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
670 | { |
| 15884 | 671 | void *handle = purple_connections_get_handle(); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
672 | |
| 15884 | 673 | purple_signal_register(handle, "signing-on", |
| 674 | purple_marshal_VOID__POINTER, NULL, 1, | |
| 675 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 676 | PURPLE_SUBTYPE_CONNECTION)); | |
|
6564
a7a2c1927544
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6533
diff
changeset
|
677 | |
| 15884 | 678 | purple_signal_register(handle, "signed-on", |
| 679 | purple_marshal_VOID__POINTER, NULL, 1, | |
| 680 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 681 | PURPLE_SUBTYPE_CONNECTION)); | |
|
6564
a7a2c1927544
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6533
diff
changeset
|
682 | |
| 15884 | 683 | purple_signal_register(handle, "signing-off", |
| 684 | purple_marshal_VOID__POINTER, NULL, 1, | |
| 685 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 686 | PURPLE_SUBTYPE_CONNECTION)); | |
|
6564
a7a2c1927544
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6533
diff
changeset
|
687 | |
| 15884 | 688 | purple_signal_register(handle, "signed-off", |
| 689 | purple_marshal_VOID__POINTER, NULL, 1, | |
| 690 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 691 | 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
|
692 | |
|
ca8cb8706802
I figured a signal firing on a connection error would be useful.
Will Thompson <resiak@pidgin.im>
parents:
21279
diff
changeset
|
693 | 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
|
694 | 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
|
695 | 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
|
696 | 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
|
697 | 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
|
698 | 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
|
699 | |
|
30039
9cd7672bae4f
Add an autojoin connection signal
Richard Laager <rlaager@pidgin.im>
parents:
28577
diff
changeset
|
700 | purple_signal_register(handle, "autojoin", |
|
9cd7672bae4f
Add an autojoin connection signal
Richard Laager <rlaager@pidgin.im>
parents:
28577
diff
changeset
|
701 | purple_marshal_BOOLEAN__POINTER, NULL, 1, |
|
9cd7672bae4f
Add an autojoin connection signal
Richard Laager <rlaager@pidgin.im>
parents:
28577
diff
changeset
|
702 | purple_value_new(PURPLE_TYPE_SUBTYPE, |
|
9cd7672bae4f
Add an autojoin connection signal
Richard Laager <rlaager@pidgin.im>
parents:
28577
diff
changeset
|
703 | PURPLE_SUBTYPE_CONNECTION)); |
|
9cd7672bae4f
Add an autojoin connection signal
Richard Laager <rlaager@pidgin.im>
parents:
28577
diff
changeset
|
704 | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
705 | } |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
706 | |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
707 | void |
| 15884 | 708 | purple_connections_uninit(void) |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
709 | { |
| 15884 | 710 | purple_signals_unregister_by_instance(purple_connections_get_handle()); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
711 | } |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
712 | |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
713 | void * |
| 15884 | 714 | purple_connections_get_handle(void) |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
715 | { |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
716 | return &connections_handle; |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
717 | } |