Mercurial > pidgin.yaz
annotate libpurple/account.c @ 28471:cbc06e756ead
Removed a strace space...
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Fri, 28 Aug 2009 17:27:02 +0000 |
parents | 3896cbf6336a |
children | caa94dfa37f1 94f85ba7e5a9 |
rev | line source |
---|---|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2 * @file account.c Account API |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * @ingroup core |
20074
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19696
diff
changeset
|
4 */ |
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19696
diff
changeset
|
5 |
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19696
diff
changeset
|
6 /* purple |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * |
15823 | 8 * Purple is the legal property of its developers, whose names are too numerous |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * to list here. Please refer to the COPYRIGHT file distributed with this |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * source distribution. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
22 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 * along with this program; if not, write to the Free Software |
19680
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19604
diff
changeset
|
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
25 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 #include "internal.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 #include "account.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 #include "core.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 #include "dbus-maybe.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 #include "debug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #include "network.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 #include "notify.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 #include "pounce.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #include "prefs.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 #include "privacy.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 #include "prpl.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 #include "request.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 #include "server.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 #include "signals.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 #include "status.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 #include "util.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 #include "xmlnode.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 |
21366
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
44 typedef struct |
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
45 { |
21377
872068d10eab
Mark pointed out that PurpleConnectionErrorPair is not a very good name for the
Will Thompson <will.thompson@collabora.co.uk>
parents:
21374
diff
changeset
|
46 PurpleConnectionErrorInfo *current_error; |
21366
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
47 } PurpleAccountPrivate; |
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
48 |
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
49 #define PURPLE_ACCOUNT_GET_PRIVATE(account) \ |
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
50 ((PurpleAccountPrivate *) (account->priv)) |
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
51 |
15823 | 52 /* TODO: Should use PurpleValue instead of this? What about "ui"? */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 typedef struct |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
54 { |
15823 | 55 PurplePrefType type; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
56 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 char *ui; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
59 union |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
60 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 int integer; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 char *string; |
20354
01101467094f
applied changes from 7a436ba53de6adebccf4e920ca62d544e13b1094
Luke Schierer <lschiere@pidgin.im>
parents:
20251
diff
changeset
|
63 gboolean boolean; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
64 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
65 } value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
66 |
15823 | 67 } PurpleAccountSetting; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
68 |
15478
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
69 typedef struct |
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
70 { |
15823 | 71 PurpleAccountRequestType type; |
72 PurpleAccount *account; | |
15478
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
73 void *ui_handle; |
20178
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
74 char *user; |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
75 gpointer userdata; |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
76 PurpleAccountRequestAuthorizationCb auth_cb; |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
77 PurpleAccountRequestAuthorizationCb deny_cb; |
24644
98ec72f8f3cc
Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24607
diff
changeset
|
78 guint ref; |
15823 | 79 } PurpleAccountRequestInfo; |
80 | |
81 static PurpleAccountUiOps *account_ui_ops = NULL; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
82 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
83 static GList *accounts = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
84 static guint save_timer = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 static gboolean accounts_loaded = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
86 |
15478
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
87 static GList *handles = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
88 |
21393
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
89 static void set_current_error(PurpleAccount *account, |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
90 PurpleConnectionErrorInfo *new_err); |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
91 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 /********************************************************************* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 * Writing to disk * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
94 *********************************************************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
96 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
97 setting_to_xmlnode(gpointer key, gpointer value, gpointer user_data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
98 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
99 const char *name; |
15823 | 100 PurpleAccountSetting *setting; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 xmlnode *node, *child; |
26967
8290e36a5a73
A patch from Scott Wolchok to replace snprintf() with g_snprintf() and
Richard Laager <rlaager@wiktel.com>
parents:
26845
diff
changeset
|
102 char buf[21]; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
103 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
104 name = (const char *)key; |
15823 | 105 setting = (PurpleAccountSetting *)value; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 node = (xmlnode *)user_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
107 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 child = xmlnode_new_child(node, "setting"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
109 xmlnode_set_attrib(child, "name", name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
110 |
15823 | 111 if (setting->type == PURPLE_PREF_INT) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 xmlnode_set_attrib(child, "type", "int"); |
26967
8290e36a5a73
A patch from Scott Wolchok to replace snprintf() with g_snprintf() and
Richard Laager <rlaager@wiktel.com>
parents:
26845
diff
changeset
|
113 g_snprintf(buf, sizeof(buf), "%d", setting->value.integer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
114 xmlnode_insert_data(child, buf, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
115 } |
15823 | 116 else if (setting->type == PURPLE_PREF_STRING && setting->value.string != NULL) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 xmlnode_set_attrib(child, "type", "string"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 xmlnode_insert_data(child, setting->value.string, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
119 } |
15823 | 120 else if (setting->type == PURPLE_PREF_BOOLEAN) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
121 xmlnode_set_attrib(child, "type", "bool"); |
26967
8290e36a5a73
A patch from Scott Wolchok to replace snprintf() with g_snprintf() and
Richard Laager <rlaager@wiktel.com>
parents:
26845
diff
changeset
|
122 g_snprintf(buf, sizeof(buf), "%d", setting->value.boolean); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 xmlnode_insert_data(child, buf, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
125 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
126 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
128 ui_setting_to_xmlnode(gpointer key, gpointer value, gpointer user_data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
130 const char *ui; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
131 GHashTable *table; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
132 xmlnode *node, *child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
133 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
134 ui = (const char *)key; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
135 table = (GHashTable *)value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
136 node = (xmlnode *)user_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
137 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
138 if (g_hash_table_size(table) > 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
139 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
140 child = xmlnode_new_child(node, "settings"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
141 xmlnode_set_attrib(child, "ui", ui); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
142 g_hash_table_foreach(table, setting_to_xmlnode, child); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
143 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
144 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
145 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
146 static xmlnode * |
15823 | 147 status_attr_to_xmlnode(const PurpleStatus *status, const PurpleStatusType *type, const PurpleStatusAttr *attr) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
148 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
149 xmlnode *node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
150 const char *id; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
151 char *value = NULL; |
15823 | 152 PurpleStatusAttr *default_attr; |
153 PurpleValue *default_value; | |
154 PurpleType attr_type; | |
155 PurpleValue *attr_value; | |
156 | |
157 id = purple_status_attr_get_id(attr); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 g_return_val_if_fail(id, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 |
15823 | 160 attr_value = purple_status_get_attr_value(status, id); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 g_return_val_if_fail(attr_value, NULL); |
15823 | 162 attr_type = purple_value_get_type(attr_value); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
164 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 * If attr_value is a different type than it should be |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 * then don't write it to the file. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
167 */ |
15823 | 168 default_attr = purple_status_type_get_attr(type, id); |
169 default_value = purple_status_attr_get_value(default_attr); | |
170 if (attr_type != purple_value_get_type(default_value)) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
171 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
172 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
173 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
174 * If attr_value is the same as the default for this status |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
175 * then there is no need to write it to the file. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
176 */ |
15823 | 177 if (attr_type == PURPLE_TYPE_STRING) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
178 { |
15823 | 179 const char *string_value = purple_value_get_string(attr_value); |
180 const char *default_string_value = purple_value_get_string(default_value); | |
25385
a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents:
25368
diff
changeset
|
181 if (purple_strequal(string_value, default_string_value)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
182 return NULL; |
15823 | 183 value = g_strdup(purple_value_get_string(attr_value)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
184 } |
15823 | 185 else if (attr_type == PURPLE_TYPE_INT) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
186 { |
15823 | 187 int int_value = purple_value_get_int(attr_value); |
188 if (int_value == purple_value_get_int(default_value)) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
189 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
190 value = g_strdup_printf("%d", int_value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 } |
15823 | 192 else if (attr_type == PURPLE_TYPE_BOOLEAN) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 { |
15823 | 194 gboolean boolean_value = purple_value_get_boolean(attr_value); |
195 if (boolean_value == purple_value_get_boolean(default_value)) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
196 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
197 value = g_strdup(boolean_value ? |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
198 "true" : "false"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
199 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
201 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
202 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
205 g_return_val_if_fail(value, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 node = xmlnode_new("attribute"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
208 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 xmlnode_set_attrib(node, "id", id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 xmlnode_set_attrib(node, "value", value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
211 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
212 g_free(value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
213 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
214 return node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
215 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
216 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
217 static xmlnode * |
15823 | 218 status_attrs_to_xmlnode(const PurpleStatus *status) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
219 { |
15823 | 220 PurpleStatusType *type = purple_status_get_type(status); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
221 xmlnode *node, *child; |
18118
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18063
diff
changeset
|
222 GList *attrs, *attr; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
223 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
224 node = xmlnode_new("attributes"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
225 |
15823 | 226 attrs = purple_status_type_get_attrs(type); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
227 for (attr = attrs; attr != NULL; attr = attr->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
228 { |
15823 | 229 child = status_attr_to_xmlnode(status, type, (const PurpleStatusAttr *)attr->data); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 if (child) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
231 xmlnode_insert_child(node, child); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
232 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
233 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 return node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
235 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
236 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
237 static xmlnode * |
15823 | 238 status_to_xmlnode(const PurpleStatus *status) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
239 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
240 xmlnode *node, *child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 node = xmlnode_new("status"); |
15823 | 243 xmlnode_set_attrib(node, "type", purple_status_get_id(status)); |
244 if (purple_status_get_name(status) != NULL) | |
245 xmlnode_set_attrib(node, "name", purple_status_get_name(status)); | |
246 xmlnode_set_attrib(node, "active", purple_status_is_active(status) ? "true" : "false"); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
248 child = status_attrs_to_xmlnode(status); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
249 xmlnode_insert_child(node, child); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
250 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
251 return node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
252 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
253 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
254 static xmlnode * |
15823 | 255 statuses_to_xmlnode(const PurplePresence *presence) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
256 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
257 xmlnode *node, *child; |
24973
ff883620d9d4
Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24644
diff
changeset
|
258 GList *statuses; |
ff883620d9d4
Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24644
diff
changeset
|
259 PurpleStatus *status; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
260 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
261 node = xmlnode_new("statuses"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
262 |
15823 | 263 statuses = purple_presence_get_statuses(presence); |
24973
ff883620d9d4
Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24644
diff
changeset
|
264 for (; statuses != NULL; statuses = statuses->next) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
265 { |
24973
ff883620d9d4
Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24644
diff
changeset
|
266 status = statuses->data; |
ff883620d9d4
Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24644
diff
changeset
|
267 if (purple_status_type_is_saveable(purple_status_get_type(status))) |
ff883620d9d4
Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24644
diff
changeset
|
268 { |
ff883620d9d4
Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24644
diff
changeset
|
269 child = status_to_xmlnode(status); |
ff883620d9d4
Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24644
diff
changeset
|
270 xmlnode_insert_child(node, child); |
ff883620d9d4
Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24644
diff
changeset
|
271 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
272 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
273 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 return node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
275 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
276 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
277 static xmlnode * |
15823 | 278 proxy_settings_to_xmlnode(PurpleProxyInfo *proxy_info) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
279 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
280 xmlnode *node, *child; |
15823 | 281 PurpleProxyType proxy_type; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 const char *value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
283 int int_value; |
26967
8290e36a5a73
A patch from Scott Wolchok to replace snprintf() with g_snprintf() and
Richard Laager <rlaager@wiktel.com>
parents:
26845
diff
changeset
|
284 char buf[21]; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
285 |
15823 | 286 proxy_type = purple_proxy_info_get_type(proxy_info); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
287 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
288 node = xmlnode_new("proxy"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
289 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
290 child = xmlnode_new_child(node, "type"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
291 xmlnode_insert_data(child, |
15823 | 292 (proxy_type == PURPLE_PROXY_USE_GLOBAL ? "global" : |
293 proxy_type == PURPLE_PROXY_NONE ? "none" : | |
294 proxy_type == PURPLE_PROXY_HTTP ? "http" : | |
295 proxy_type == PURPLE_PROXY_SOCKS4 ? "socks4" : | |
296 proxy_type == PURPLE_PROXY_SOCKS5 ? "socks5" : | |
297 proxy_type == PURPLE_PROXY_USE_ENVVAR ? "envvar" : "unknown"), -1); | |
298 | |
299 if ((value = purple_proxy_info_get_host(proxy_info)) != NULL) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
300 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
301 child = xmlnode_new_child(node, "host"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
302 xmlnode_insert_data(child, value, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
303 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
304 |
15823 | 305 if ((int_value = purple_proxy_info_get_port(proxy_info)) != 0) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
306 { |
26967
8290e36a5a73
A patch from Scott Wolchok to replace snprintf() with g_snprintf() and
Richard Laager <rlaager@wiktel.com>
parents:
26845
diff
changeset
|
307 g_snprintf(buf, sizeof(buf), "%d", int_value); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
308 child = xmlnode_new_child(node, "port"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
309 xmlnode_insert_data(child, buf, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
310 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
311 |
15823 | 312 if ((value = purple_proxy_info_get_username(proxy_info)) != NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
313 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
314 child = xmlnode_new_child(node, "username"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
315 xmlnode_insert_data(child, value, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
316 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
317 |
15823 | 318 if ((value = purple_proxy_info_get_password(proxy_info)) != NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
319 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 child = xmlnode_new_child(node, "password"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 xmlnode_insert_data(child, value, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
323 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 return node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
326 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
327 static xmlnode * |
21393
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
328 current_error_to_xmlnode(PurpleConnectionErrorInfo *err) |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
329 { |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
330 xmlnode *node, *child; |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
331 char type_str[3]; |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
332 |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
333 node = xmlnode_new("current_error"); |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
334 |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
335 if(err == NULL) |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
336 return node; |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
337 |
21846
717176f247ab
Don't bother making transient connection errors persist across a restart.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21813
diff
changeset
|
338 /* It doesn't make sense to have transient errors persist across a |
717176f247ab
Don't bother making transient connection errors persist across a restart.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21813
diff
changeset
|
339 * restart. |
717176f247ab
Don't bother making transient connection errors persist across a restart.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21813
diff
changeset
|
340 */ |
717176f247ab
Don't bother making transient connection errors persist across a restart.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21813
diff
changeset
|
341 if(!purple_connection_error_is_fatal (err->type)) |
717176f247ab
Don't bother making transient connection errors persist across a restart.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21813
diff
changeset
|
342 return node; |
717176f247ab
Don't bother making transient connection errors persist across a restart.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21813
diff
changeset
|
343 |
21393
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
344 child = xmlnode_new_child(node, "type"); |
26967
8290e36a5a73
A patch from Scott Wolchok to replace snprintf() with g_snprintf() and
Richard Laager <rlaager@wiktel.com>
parents:
26845
diff
changeset
|
345 g_snprintf(type_str, sizeof(type_str), "%u", err->type); |
21393
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
346 xmlnode_insert_data(child, type_str, -1); |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
347 |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
348 child = xmlnode_new_child(node, "description"); |
21813
d62d7412eca4
Ensure that an error's description actually is UTF-8 before writing it out to
Will Thompson <will.thompson@collabora.co.uk>
parents:
21792
diff
changeset
|
349 if(err->description) { |
d62d7412eca4
Ensure that an error's description actually is UTF-8 before writing it out to
Will Thompson <will.thompson@collabora.co.uk>
parents:
21792
diff
changeset
|
350 char *utf8ized = purple_utf8_try_convert(err->description); |
d62d7412eca4
Ensure that an error's description actually is UTF-8 before writing it out to
Will Thompson <will.thompson@collabora.co.uk>
parents:
21792
diff
changeset
|
351 if(utf8ized == NULL) |
d62d7412eca4
Ensure that an error's description actually is UTF-8 before writing it out to
Will Thompson <will.thompson@collabora.co.uk>
parents:
21792
diff
changeset
|
352 utf8ized = purple_utf8_salvage(err->description); |
d62d7412eca4
Ensure that an error's description actually is UTF-8 before writing it out to
Will Thompson <will.thompson@collabora.co.uk>
parents:
21792
diff
changeset
|
353 xmlnode_insert_data(child, utf8ized, -1); |
d62d7412eca4
Ensure that an error's description actually is UTF-8 before writing it out to
Will Thompson <will.thompson@collabora.co.uk>
parents:
21792
diff
changeset
|
354 g_free(utf8ized); |
d62d7412eca4
Ensure that an error's description actually is UTF-8 before writing it out to
Will Thompson <will.thompson@collabora.co.uk>
parents:
21792
diff
changeset
|
355 } |
21393
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
356 |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
357 return node; |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
358 } |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
359 |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
360 static xmlnode * |
15823 | 361 account_to_xmlnode(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
362 { |
21393
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
363 PurpleAccountPrivate *priv = PURPLE_ACCOUNT_GET_PRIVATE(account); |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
364 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
365 xmlnode *node, *child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
366 const char *tmp; |
15823 | 367 PurplePresence *presence; |
368 PurpleProxyInfo *proxy_info; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
369 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
370 node = xmlnode_new("account"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
371 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
372 child = xmlnode_new_child(node, "protocol"); |
15823 | 373 xmlnode_insert_data(child, purple_account_get_protocol_id(account), -1); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
374 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
375 child = xmlnode_new_child(node, "name"); |
15823 | 376 xmlnode_insert_data(child, purple_account_get_username(account), -1); |
377 | |
378 if (purple_account_get_remember_password(account) && | |
379 ((tmp = purple_account_get_password(account)) != NULL)) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
380 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
381 child = xmlnode_new_child(node, "password"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
382 xmlnode_insert_data(child, tmp, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
383 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
384 |
15823 | 385 if ((tmp = purple_account_get_alias(account)) != NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
386 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
387 child = xmlnode_new_child(node, "alias"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
388 xmlnode_insert_data(child, tmp, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
389 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
390 |
15823 | 391 if ((presence = purple_account_get_presence(account)) != NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
392 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
393 child = statuses_to_xmlnode(presence); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
394 xmlnode_insert_child(node, child); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
395 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
396 |
15823 | 397 if ((tmp = purple_account_get_user_info(account)) != NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
398 { |
15823 | 399 /* TODO: Do we need to call purple_str_strip_char(tmp, '\r') here? */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
400 child = xmlnode_new_child(node, "userinfo"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
401 xmlnode_insert_data(child, tmp, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
402 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
403 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
404 if (g_hash_table_size(account->settings) > 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
405 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
406 child = xmlnode_new_child(node, "settings"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
407 g_hash_table_foreach(account->settings, setting_to_xmlnode, child); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
408 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
409 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
410 if (g_hash_table_size(account->ui_settings) > 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
411 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
412 g_hash_table_foreach(account->ui_settings, ui_setting_to_xmlnode, node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
413 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
414 |
15823 | 415 if ((proxy_info = purple_account_get_proxy_info(account)) != NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
416 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
417 child = proxy_settings_to_xmlnode(proxy_info); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
418 xmlnode_insert_child(node, child); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
419 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
420 |
21393
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
421 child = current_error_to_xmlnode(priv->current_error); |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
422 xmlnode_insert_child(node, child); |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
423 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
424 return node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
425 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
426 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
427 static xmlnode * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
428 accounts_to_xmlnode(void) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
429 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
430 xmlnode *node, *child; |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
431 GList *cur; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
432 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
433 node = xmlnode_new("account"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
434 xmlnode_set_attrib(node, "version", "1.0"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
435 |
15823 | 436 for (cur = purple_accounts_get_all(); cur != NULL; cur = cur->next) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
437 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
438 child = account_to_xmlnode(cur->data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
439 xmlnode_insert_child(node, child); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
440 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
441 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
442 return node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
443 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
444 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
445 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
446 sync_accounts(void) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
447 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
448 xmlnode *node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
449 char *data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
450 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
451 if (!accounts_loaded) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
452 { |
15823 | 453 purple_debug_error("account", "Attempted to save accounts before " |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
454 "they were read!\n"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
455 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
456 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
457 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
458 node = accounts_to_xmlnode(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
459 data = xmlnode_to_formatted_str(node, NULL); |
15823 | 460 purple_util_write_data_to_file("accounts.xml", data, -1); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
461 g_free(data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
462 xmlnode_free(node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
463 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
464 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
465 static gboolean |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
466 save_cb(gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
467 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
468 sync_accounts(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
469 save_timer = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
470 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
471 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
472 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
473 static void |
22007
c38d72677c8a
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@wiktel.com>
parents:
21937
diff
changeset
|
474 schedule_accounts_save(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
475 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
476 if (save_timer == 0) |
18006
f2d8658b3a86
merge of '62e9d17cd37551991c5040ce6ca48e6d7578dde3'
Richard Laager <rlaager@wiktel.com>
parents:
17095
diff
changeset
|
477 save_timer = purple_timeout_add_seconds(5, save_cb, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
478 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
479 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
480 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
481 /********************************************************************* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
482 * Reading from disk * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
483 *********************************************************************/ |
27402
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
484 static void |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
485 migrate_yahoo_japan(PurpleAccount *account) |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
486 { |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
487 /* detect a Yahoo! JAPAN account that existed prior to 2.6.0 and convert it |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
488 * to use the new prpl-yahoojp. Also remove the account-specific settings |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
489 * we no longer need */ |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
490 |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
491 if(purple_strequal(purple_account_get_protocol_id(account), "prpl-yahoo")) { |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
492 if(purple_account_get_bool(account, "yahoojp", FALSE)) { |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
493 const char *serverjp = purple_account_get_string(account, "serverjp", NULL); |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
494 const char *xferjp_host = purple_account_get_string(account, "xferjp_host", NULL); |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
495 |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
496 g_return_if_fail(serverjp != NULL); |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
497 g_return_if_fail(xferjp_host != NULL); |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
498 |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
499 purple_account_set_string(account, "server", serverjp); |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
500 purple_account_set_string(account, "xfer_host", xferjp_host); |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
501 |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
502 purple_account_set_protocol_id(account, "prpl-yahoojp"); |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
503 } |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
504 |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
505 /* these should always be nuked */ |
27403
76a13febd641
I forgot to remove the old bool setting for Yahoo! JAPAN.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27402
diff
changeset
|
506 purple_account_remove_setting(account, "yahoojp"); |
27402
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
507 purple_account_remove_setting(account, "serverjp"); |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
508 purple_account_remove_setting(account, "xferjp_host"); |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
509 |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
510 } |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
511 |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
512 return; |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
513 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
514 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
515 static void |
15823 | 516 parse_settings(xmlnode *node, PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
517 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
518 const char *ui; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
519 xmlnode *child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
520 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
521 /* Get the UI string, if these are UI settings */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
522 ui = xmlnode_get_attrib(node, "ui"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
523 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
524 /* Read settings, one by one */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
525 for (child = xmlnode_get_child(node, "setting"); child != NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
526 child = xmlnode_get_next_twin(child)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
527 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
528 const char *name, *str_type; |
15823 | 529 PurplePrefType type; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
530 char *data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
531 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
532 name = xmlnode_get_attrib(child, "name"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
533 if (name == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
534 /* Ignore this setting */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
535 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
536 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
537 str_type = xmlnode_get_attrib(child, "type"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
538 if (str_type == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
539 /* Ignore this setting */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
540 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
541 |
25385
a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents:
25368
diff
changeset
|
542 if (purple_strequal(str_type, "string")) |
15823 | 543 type = PURPLE_PREF_STRING; |
25385
a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents:
25368
diff
changeset
|
544 else if (purple_strequal(str_type, "int")) |
15823 | 545 type = PURPLE_PREF_INT; |
25385
a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents:
25368
diff
changeset
|
546 else if (purple_strequal(str_type, "bool")) |
15823 | 547 type = PURPLE_PREF_BOOLEAN; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
548 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
549 /* Ignore this setting */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
550 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
551 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
552 data = xmlnode_get_data(child); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
553 if (data == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
554 /* Ignore this setting */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
555 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
556 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
557 if (ui == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
558 { |
15823 | 559 if (type == PURPLE_PREF_STRING) |
560 purple_account_set_string(account, name, data); | |
561 else if (type == PURPLE_PREF_INT) | |
562 purple_account_set_int(account, name, atoi(data)); | |
563 else if (type == PURPLE_PREF_BOOLEAN) | |
564 purple_account_set_bool(account, name, | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
565 (*data == '0' ? FALSE : TRUE)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
566 } else { |
15823 | 567 if (type == PURPLE_PREF_STRING) |
568 purple_account_set_ui_string(account, ui, name, data); | |
569 else if (type == PURPLE_PREF_INT) | |
570 purple_account_set_ui_int(account, ui, name, atoi(data)); | |
571 else if (type == PURPLE_PREF_BOOLEAN) | |
572 purple_account_set_ui_bool(account, ui, name, | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
573 (*data == '0' ? FALSE : TRUE)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
574 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
575 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
576 g_free(data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
577 } |
27402
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
578 |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
579 /* we do this here because we need access to account settings to determine |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
580 * if we can/should migrate an old Yahoo! JAPAN account */ |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
581 migrate_yahoo_japan(account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
582 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
583 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
584 static GList * |
15823 | 585 parse_status_attrs(xmlnode *node, PurpleStatus *status) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
586 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
587 GList *list = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
588 xmlnode *child; |
15823 | 589 PurpleValue *attr_value; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
590 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
591 for (child = xmlnode_get_child(node, "attribute"); child != NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
592 child = xmlnode_get_next_twin(child)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
593 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
594 const char *id = xmlnode_get_attrib(child, "id"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
595 const char *value = xmlnode_get_attrib(child, "value"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
596 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
597 if (!id || !*id || !value || !*value) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
598 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
599 |
15823 | 600 attr_value = purple_status_get_attr_value(status, id); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
601 if (!attr_value) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
602 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
603 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
604 list = g_list_append(list, (char *)id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
605 |
15823 | 606 switch (purple_value_get_type(attr_value)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
607 { |
15823 | 608 case PURPLE_TYPE_STRING: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
609 list = g_list_append(list, (char *)value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
610 break; |
15823 | 611 case PURPLE_TYPE_INT: |
612 case PURPLE_TYPE_BOOLEAN: | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
613 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
614 int v; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
615 if (sscanf(value, "%d", &v) == 1) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
616 list = g_list_append(list, GINT_TO_POINTER(v)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
617 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
618 list = g_list_remove(list, id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
619 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
620 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
621 default: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
622 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
623 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
624 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
625 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
626 return list; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
627 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
628 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
629 static void |
15823 | 630 parse_status(xmlnode *node, PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
631 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
632 gboolean active = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
633 const char *data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
634 const char *type; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
635 xmlnode *child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
636 GList *attrs = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
637 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
638 /* Get the active/inactive state */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
639 data = xmlnode_get_attrib(node, "active"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
640 if (data == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
641 return; |
17095
7ade887fd3f6
Replace strcasecmp() calls with glib equivalents.
Richard Laager <rlaager@wiktel.com>
parents:
16639
diff
changeset
|
642 if (g_ascii_strcasecmp(data, "true") == 0) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
643 active = TRUE; |
17095
7ade887fd3f6
Replace strcasecmp() calls with glib equivalents.
Richard Laager <rlaager@wiktel.com>
parents:
16639
diff
changeset
|
644 else if (g_ascii_strcasecmp(data, "false") == 0) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
645 active = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
646 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
647 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
648 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
649 /* Get the type of the status */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
650 type = xmlnode_get_attrib(node, "type"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
651 if (type == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
652 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
653 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
654 /* Read attributes into a GList */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
655 child = xmlnode_get_child(node, "attributes"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
656 if (child != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
657 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
658 attrs = parse_status_attrs(child, |
15823 | 659 purple_account_get_status(account, type)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
660 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
661 |
15823 | 662 purple_account_set_status_list(account, type, active, attrs); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
663 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
664 g_list_free(attrs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
665 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
666 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
667 static void |
15823 | 668 parse_statuses(xmlnode *node, PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
669 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
670 xmlnode *child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
671 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
672 for (child = xmlnode_get_child(node, "status"); child != NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
673 child = xmlnode_get_next_twin(child)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
674 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
675 parse_status(child, account); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
676 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
677 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
678 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
679 static void |
15823 | 680 parse_proxy_info(xmlnode *node, PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
681 { |
15823 | 682 PurpleProxyInfo *proxy_info; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
683 xmlnode *child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
684 char *data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
685 |
15823 | 686 proxy_info = purple_proxy_info_new(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
687 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
688 /* Use the global proxy settings, by default */ |
15823 | 689 purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_USE_GLOBAL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
690 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
691 /* Read proxy type */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
692 child = xmlnode_get_child(node, "type"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
693 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
694 { |
25385
a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents:
25368
diff
changeset
|
695 if (purple_strequal(data, "global")) |
15823 | 696 purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_USE_GLOBAL); |
25385
a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents:
25368
diff
changeset
|
697 else if (purple_strequal(data, "none")) |
15823 | 698 purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_NONE); |
25385
a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents:
25368
diff
changeset
|
699 else if (purple_strequal(data, "http")) |
15823 | 700 purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_HTTP); |
25385
a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents:
25368
diff
changeset
|
701 else if (purple_strequal(data, "socks4")) |
15823 | 702 purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_SOCKS4); |
25385
a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents:
25368
diff
changeset
|
703 else if (purple_strequal(data, "socks5")) |
15823 | 704 purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_SOCKS5); |
25385
a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents:
25368
diff
changeset
|
705 else if (purple_strequal(data, "envvar")) |
15823 | 706 purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_USE_ENVVAR); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
707 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
708 { |
15823 | 709 purple_debug_error("account", "Invalid proxy type found when " |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
710 "loading account information for %s\n", |
15823 | 711 purple_account_get_username(account)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
712 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
713 g_free(data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
714 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
715 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
716 /* Read proxy host */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
717 child = xmlnode_get_child(node, "host"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
718 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
719 { |
15823 | 720 purple_proxy_info_set_host(proxy_info, data); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
721 g_free(data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
722 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
723 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
724 /* Read proxy port */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
725 child = xmlnode_get_child(node, "port"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
726 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
727 { |
15823 | 728 purple_proxy_info_set_port(proxy_info, atoi(data)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
729 g_free(data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
730 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
731 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
732 /* Read proxy username */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
733 child = xmlnode_get_child(node, "username"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
734 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
735 { |
15823 | 736 purple_proxy_info_set_username(proxy_info, data); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
737 g_free(data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
738 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
739 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
740 /* Read proxy password */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
741 child = xmlnode_get_child(node, "password"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
742 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
743 { |
15823 | 744 purple_proxy_info_set_password(proxy_info, data); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
745 g_free(data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
746 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
747 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
748 /* If there are no values set then proxy_info NULL */ |
15823 | 749 if ((purple_proxy_info_get_type(proxy_info) == PURPLE_PROXY_USE_GLOBAL) && |
750 (purple_proxy_info_get_host(proxy_info) == NULL) && | |
751 (purple_proxy_info_get_port(proxy_info) == 0) && | |
752 (purple_proxy_info_get_username(proxy_info) == NULL) && | |
753 (purple_proxy_info_get_password(proxy_info) == NULL)) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
754 { |
15823 | 755 purple_proxy_info_destroy(proxy_info); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
756 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
757 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
758 |
15823 | 759 purple_account_set_proxy_info(account, proxy_info); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
760 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
761 |
21393
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
762 static void |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
763 parse_current_error(xmlnode *node, PurpleAccount *account) |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
764 { |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
765 guint type; |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
766 char *type_str = NULL, *description = NULL; |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
767 xmlnode *child; |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
768 PurpleConnectionErrorInfo *current_error = NULL; |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
769 |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
770 child = xmlnode_get_child(node, "type"); |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
771 if (child == NULL || (type_str = xmlnode_get_data(child)) == NULL) |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
772 return; |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
773 type = atoi(type_str); |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
774 g_free(type_str); |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
775 |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
776 if (type > PURPLE_CONNECTION_ERROR_OTHER_ERROR) |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
777 { |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
778 purple_debug_error("account", |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
779 "Invalid PurpleConnectionError value %d found when " |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
780 "loading account information for %s\n", |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
781 type, purple_account_get_username(account)); |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
782 type = PURPLE_CONNECTION_ERROR_OTHER_ERROR; |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
783 } |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
784 |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
785 child = xmlnode_get_child(node, "description"); |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
786 if (child) |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
787 description = xmlnode_get_data(child); |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
788 if (description == NULL) |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
789 description = g_strdup(""); |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
790 |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
791 current_error = g_new0(PurpleConnectionErrorInfo, 1); |
22500
89a036334991
Register and unregister the PurpleConnectionErrorInfo pointers with dbus, I
Etan Reisner <pidgin@unreliablesource.net>
parents:
22231
diff
changeset
|
792 PURPLE_DBUS_REGISTER_POINTER(current_error, PurpleConnectionErrorInfo); |
21393
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
793 current_error->type = type; |
22108
e21cdaffbcdb
Plug a small leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22054
diff
changeset
|
794 current_error->description = description; |
21393
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
795 |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
796 set_current_error(account, current_error); |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
797 } |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
798 |
15823 | 799 static PurpleAccount * |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
800 parse_account(xmlnode *node) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
801 { |
15823 | 802 PurpleAccount *ret; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
803 xmlnode *child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
804 char *protocol_id = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
805 char *name = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
806 char *data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
807 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
808 child = xmlnode_get_child(node, "protocol"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
809 if (child != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
810 protocol_id = xmlnode_get_data(child); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
811 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
812 child = xmlnode_get_child(node, "name"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
813 if (child != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
814 name = xmlnode_get_data(child); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
815 if (name == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
816 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
817 /* Do we really need to do this? */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
818 child = xmlnode_get_child(node, "username"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
819 if (child != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
820 name = xmlnode_get_data(child); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
821 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
822 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
823 if ((protocol_id == NULL) || (name == NULL)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
824 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
825 g_free(protocol_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
826 g_free(name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
827 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
828 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
829 |
15823 | 830 ret = purple_account_new(name, _purple_oscar_convert(name, protocol_id)); /* XXX: */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
831 g_free(name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
832 g_free(protocol_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
833 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
834 /* Read the password */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
835 child = xmlnode_get_child(node, "password"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
836 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
837 { |
15823 | 838 purple_account_set_remember_password(ret, TRUE); |
839 purple_account_set_password(ret, data); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
840 g_free(data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
841 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
842 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
843 /* Read the alias */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
844 child = xmlnode_get_child(node, "alias"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
845 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
846 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
847 if (*data != '\0') |
15823 | 848 purple_account_set_alias(ret, data); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
849 g_free(data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
850 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
851 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
852 /* Read the statuses */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
853 child = xmlnode_get_child(node, "statuses"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
854 if (child != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
855 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
856 parse_statuses(child, ret); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
857 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
858 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
859 /* Read the userinfo */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
860 child = xmlnode_get_child(node, "userinfo"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
861 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
862 { |
15823 | 863 purple_account_set_user_info(ret, data); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
864 g_free(data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
865 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
866 |
16390
4fc51a87ce42
Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@wiktel.com>
parents:
16068
diff
changeset
|
867 /* Read an old buddyicon */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
868 child = xmlnode_get_child(node, "buddyicon"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
869 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
870 { |
16482
3be560001d26
Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@wiktel.com>
parents:
16390
diff
changeset
|
871 const char *dirname = purple_buddy_icons_get_cache_dir(); |
3be560001d26
Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@wiktel.com>
parents:
16390
diff
changeset
|
872 char *filename = g_build_filename(dirname, data, NULL); |
3be560001d26
Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@wiktel.com>
parents:
16390
diff
changeset
|
873 gchar *contents; |
3be560001d26
Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@wiktel.com>
parents:
16390
diff
changeset
|
874 gsize len; |
3be560001d26
Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@wiktel.com>
parents:
16390
diff
changeset
|
875 |
3be560001d26
Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@wiktel.com>
parents:
16390
diff
changeset
|
876 if (g_file_get_contents(filename, &contents, &len, NULL)) |
3be560001d26
Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@wiktel.com>
parents:
16390
diff
changeset
|
877 { |
3be560001d26
Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@wiktel.com>
parents:
16390
diff
changeset
|
878 purple_buddy_icons_set_account_icon(ret, (guchar *)contents, len); |
3be560001d26
Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@wiktel.com>
parents:
16390
diff
changeset
|
879 } |
16598
66f0cda796e1
Part of the patch in ticket #383
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16505
diff
changeset
|
880 else |
66f0cda796e1
Part of the patch in ticket #383
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16505
diff
changeset
|
881 { |
66f0cda796e1
Part of the patch in ticket #383
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16505
diff
changeset
|
882 /* Try to see if the icon got left behind in the old cache. */ |
66f0cda796e1
Part of the patch in ticket #383
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16505
diff
changeset
|
883 g_free(filename); |
66f0cda796e1
Part of the patch in ticket #383
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16505
diff
changeset
|
884 filename = g_build_filename(g_get_home_dir(), ".gaim", "icons", data, NULL); |
66f0cda796e1
Part of the patch in ticket #383
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16505
diff
changeset
|
885 if (g_file_get_contents(filename, &contents, &len, NULL)) { |
66f0cda796e1
Part of the patch in ticket #383
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16505
diff
changeset
|
886 purple_buddy_icons_set_account_icon(ret, (guchar*)contents, len); |
66f0cda796e1
Part of the patch in ticket #383
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16505
diff
changeset
|
887 } |
66f0cda796e1
Part of the patch in ticket #383
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16505
diff
changeset
|
888 } |
16482
3be560001d26
Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@wiktel.com>
parents:
16390
diff
changeset
|
889 |
3be560001d26
Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@wiktel.com>
parents:
16390
diff
changeset
|
890 g_free(filename); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
891 g_free(data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
892 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
893 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
894 /* Read settings (both core and UI) */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
895 for (child = xmlnode_get_child(node, "settings"); child != NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
896 child = xmlnode_get_next_twin(child)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
897 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
898 parse_settings(child, ret); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
899 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
900 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
901 /* Read proxy */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
902 child = xmlnode_get_child(node, "proxy"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
903 if (child != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
904 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
905 parse_proxy_info(child, ret); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
906 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
907 |
21393
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
908 /* Read current error */ |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
909 child = xmlnode_get_child(node, "current_error"); |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
910 if (child != NULL) |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
911 { |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
912 parse_current_error(child, ret); |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
913 } |
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
914 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
915 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
916 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
917 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
918 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
919 load_accounts(void) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
920 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
921 xmlnode *node, *child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
922 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
923 accounts_loaded = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
924 |
15823 | 925 node = purple_util_read_xml_from_file("accounts.xml", _("accounts")); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
926 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
927 if (node == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
928 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
929 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
930 for (child = xmlnode_get_child(node, "account"); child != NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
931 child = xmlnode_get_next_twin(child)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
932 { |
15823 | 933 PurpleAccount *new_acct; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
934 new_acct = parse_account(child); |
15823 | 935 purple_accounts_add(new_acct); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
936 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
937 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
938 xmlnode_free(node); |
16505
1d1ddf972ac8
Ref the filenames for account buddy icons on load.
Richard Laager <rlaager@wiktel.com>
parents:
16483
diff
changeset
|
939 |
16639
f9c369b4291c
Fix up the private function calls to be prefixed with an underscore.
Richard Laager <rlaager@wiktel.com>
parents:
16598
diff
changeset
|
940 _purple_buddy_icons_account_loaded_cb(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
941 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
942 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
943 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
944 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
945 delete_setting(void *data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
946 { |
15823 | 947 PurpleAccountSetting *setting = (PurpleAccountSetting *)data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
948 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
949 g_free(setting->ui); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
950 |
15823 | 951 if (setting->type == PURPLE_PREF_STRING) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
952 g_free(setting->value.string); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
953 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
954 g_free(setting); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
955 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
956 |
15823 | 957 PurpleAccount * |
958 purple_account_new(const char *username, const char *protocol_id) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
959 { |
15823 | 960 PurpleAccount *account = NULL; |
21366
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
961 PurpleAccountPrivate *priv = NULL; |
15823 | 962 PurplePlugin *prpl = NULL; |
963 PurplePluginProtocolInfo *prpl_info = NULL; | |
964 PurpleStatusType *status_type; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
965 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
966 g_return_val_if_fail(username != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
967 g_return_val_if_fail(protocol_id != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
968 |
15823 | 969 account = purple_accounts_find(username, protocol_id); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
970 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
971 if (account != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
972 return account; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
973 |
15823 | 974 account = g_new0(PurpleAccount, 1); |
975 PURPLE_DBUS_REGISTER_POINTER(account, PurpleAccount); | |
21366
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
976 priv = g_new0(PurpleAccountPrivate, 1); |
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
977 account->priv = priv; |
15823 | 978 |
979 purple_account_set_username(account, username); | |
980 | |
981 purple_account_set_protocol_id(account, protocol_id); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
982 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
983 account->settings = g_hash_table_new_full(g_str_hash, g_str_equal, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
984 g_free, delete_setting); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
985 account->ui_settings = g_hash_table_new_full(g_str_hash, g_str_equal, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
986 g_free, (GDestroyNotify)g_hash_table_destroy); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
987 account->system_log = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
988 /* 0 is not a valid privacy setting */ |
15823 | 989 account->perm_deny = PURPLE_PRIVACY_ALLOW_ALL; |
990 | |
26845
76a1598ecf1c
Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents:
26776
diff
changeset
|
991 purple_signal_emit(purple_accounts_get_handle(), "account-created", account); |
76a1598ecf1c
Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents:
26776
diff
changeset
|
992 |
15823 | 993 prpl = purple_find_prpl(protocol_id); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
994 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
995 if (prpl == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
996 return account; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
997 |
15823 | 998 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
999 if (prpl_info != NULL && prpl_info->status_types != NULL) |
15823 | 1000 purple_account_set_status_types(account, prpl_info->status_types(account)); |
1001 | |
1002 account->presence = purple_presence_new_for_account(account); | |
1003 | |
1004 status_type = purple_account_get_status_type_with_primitive(account, PURPLE_STATUS_AVAILABLE); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1005 if (status_type != NULL) |
15823 | 1006 purple_presence_set_status_active(account->presence, |
1007 purple_status_type_get_id(status_type), | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1008 TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1009 else |
15823 | 1010 purple_presence_set_status_active(account->presence, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1011 "offline", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1012 TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1013 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1014 return account; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1015 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1016 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1017 void |
15823 | 1018 purple_account_destroy(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1019 { |
21366
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
1020 PurpleAccountPrivate *priv = NULL; |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
1021 GList *l; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1022 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1023 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1024 |
15823 | 1025 purple_debug_info("account", "Destroying account %p\n", account); |
26845
76a1598ecf1c
Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents:
26776
diff
changeset
|
1026 purple_signal_emit(purple_accounts_get_handle(), "account-destroying", account); |
15823 | 1027 |
1028 for (l = purple_get_conversations(); l != NULL; l = l->next) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1029 { |
15823 | 1030 PurpleConversation *conv = (PurpleConversation *)l->data; |
1031 | |
1032 if (purple_conversation_get_account(conv) == account) | |
1033 purple_conversation_set_account(conv, NULL); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1034 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1035 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1036 g_free(account->username); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1037 g_free(account->alias); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1038 g_free(account->password); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1039 g_free(account->user_info); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1040 g_free(account->buddy_icon_path); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1041 g_free(account->protocol_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1042 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1043 g_hash_table_destroy(account->settings); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1044 g_hash_table_destroy(account->ui_settings); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1045 |
15823 | 1046 purple_account_set_status_types(account, NULL); |
1047 | |
1048 purple_presence_destroy(account->presence); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1049 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1050 if(account->system_log) |
15823 | 1051 purple_log_free(account->system_log); |
1052 | |
21366
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
1053 priv = PURPLE_ACCOUNT_GET_PRIVATE(account); |
22500
89a036334991
Register and unregister the PurpleConnectionErrorInfo pointers with dbus, I
Etan Reisner <pidgin@unreliablesource.net>
parents:
22231
diff
changeset
|
1054 PURPLE_DBUS_UNREGISTER_POINTER(priv->current_error); |
21366
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
1055 g_free(priv->current_error); |
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
1056 g_free(priv); |
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
1057 |
15823 | 1058 PURPLE_DBUS_UNREGISTER_POINTER(account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1059 g_free(account); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1060 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1061 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1062 void |
17607
ca0b86f3dbd2
Implemented a callback for a successful registration, supplying the username and password to the application when available, in the way explained by Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17593
diff
changeset
|
1063 purple_account_set_register_callback(PurpleAccount *account, PurpleAccountRegistrationCb cb, void *user_data) |
ca0b86f3dbd2
Implemented a callback for a successful registration, supplying the username and password to the application when available, in the way explained by Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17593
diff
changeset
|
1064 { |
ca0b86f3dbd2
Implemented a callback for a successful registration, supplying the username and password to the application when available, in the way explained by Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17593
diff
changeset
|
1065 g_return_if_fail(account != NULL); |
20152
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
1066 |
17607
ca0b86f3dbd2
Implemented a callback for a successful registration, supplying the username and password to the application when available, in the way explained by Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17593
diff
changeset
|
1067 account->registration_cb = cb; |
ca0b86f3dbd2
Implemented a callback for a successful registration, supplying the username and password to the application when available, in the way explained by Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17593
diff
changeset
|
1068 account->registration_cb_user_data = user_data; |
ca0b86f3dbd2
Implemented a callback for a successful registration, supplying the username and password to the application when available, in the way explained by Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17593
diff
changeset
|
1069 } |
ca0b86f3dbd2
Implemented a callback for a successful registration, supplying the username and password to the application when available, in the way explained by Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17593
diff
changeset
|
1070 |
ca0b86f3dbd2
Implemented a callback for a successful registration, supplying the username and password to the application when available, in the way explained by Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17593
diff
changeset
|
1071 void |
15823 | 1072 purple_account_register(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1073 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1074 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1075 |
15823 | 1076 purple_debug_info("account", "Registering account %s\n", |
1077 purple_account_get_username(account)); | |
1078 | |
24292
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
23963
diff
changeset
|
1079 _purple_connection_new(account, TRUE, purple_account_get_password(account)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1080 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1081 |
18703
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1082 void |
18920
2a9d60d7af82
Implemented a callback for unregistering, mirroring the registration callback. Since this is a new API, I can do it properly by passing it right in the unregister function call, instead of having a separate function for setting it.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18703
diff
changeset
|
1083 purple_account_unregister(PurpleAccount *account, PurpleAccountUnregistrationCb cb, void *user_data) |
18703
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1084 { |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1085 g_return_if_fail(account != NULL); |
20152
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
1086 |
18703
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1087 purple_debug_info("account", "Unregistering account %s\n", |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1088 purple_account_get_username(account)); |
20152
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
1089 |
24292
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
23963
diff
changeset
|
1090 _purple_connection_new_unregister(account, purple_account_get_password(account), cb, user_data); |
18703
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1091 } |
033b128f7c21
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1092 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1093 static void |
15823 | 1094 request_password_ok_cb(PurpleAccount *account, PurpleRequestFields *fields) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1095 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1096 const char *entry; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1097 gboolean remember; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1098 |
15823 | 1099 entry = purple_request_fields_get_string(fields, "password"); |
1100 remember = purple_request_fields_get_bool(fields, "remember"); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1101 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1102 if (!entry || !*entry) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1103 { |
15823 | 1104 purple_notify_error(account, NULL, _("Password is required to sign on."), NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1105 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1106 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1107 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1108 if(remember) |
20152
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
1109 purple_account_set_remember_password(account, TRUE); |
15823 | 1110 |
1111 purple_account_set_password(account, entry); | |
1112 | |
24292
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
23963
diff
changeset
|
1113 _purple_connection_new(account, FALSE, entry); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1114 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1115 |
20152
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
1116 static void |
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
1117 request_password_cancel_cb(PurpleAccount *account, PurpleRequestFields *fields) |
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
1118 { |
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
1119 /* Disable the account as the user has canceled connecting */ |
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
1120 purple_account_set_enabled(account, purple_core_get_ui(), FALSE); |
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
1121 } |
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
1122 |
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
1123 |
16068
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1124 void |
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1125 purple_account_request_password(PurpleAccount *account, GCallback ok_cb, |
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1126 GCallback cancel_cb, void *user_data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1127 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1128 gchar *primary; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1129 const gchar *username; |
15823 | 1130 PurpleRequestFieldGroup *group; |
1131 PurpleRequestField *field; | |
1132 PurpleRequestFields *fields; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1133 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1134 /* Close any previous password request windows */ |
15823 | 1135 purple_request_close_with_handle(account); |
1136 | |
1137 username = purple_account_get_username(account); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1138 primary = g_strdup_printf(_("Enter password for %s (%s)"), username, |
15823 | 1139 purple_account_get_protocol_name(account)); |
1140 | |
1141 fields = purple_request_fields_new(); | |
1142 group = purple_request_field_group_new(NULL); | |
1143 purple_request_fields_add_group(fields, group); | |
1144 | |
1145 field = purple_request_field_string_new("password", _("Enter Password"), NULL, FALSE); | |
1146 purple_request_field_string_set_masked(field, TRUE); | |
1147 purple_request_field_set_required(field, TRUE); | |
1148 purple_request_field_group_add_field(group, field); | |
1149 | |
1150 field = purple_request_field_bool_new("remember", _("Save password"), FALSE); | |
1151 purple_request_field_group_add_field(group, field); | |
1152 | |
1153 purple_request_fields(account, | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1154 NULL, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1155 primary, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1156 NULL, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1157 fields, |
16068
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1158 _("OK"), ok_cb, |
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1159 _("Cancel"), cancel_cb, |
16442
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16068
diff
changeset
|
1160 account, NULL, NULL, |
16068
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1161 user_data); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1162 g_free(primary); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1163 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1164 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1165 void |
15823 | 1166 purple_account_connect(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1167 { |
15823 | 1168 PurplePlugin *prpl; |
26749
a3595b330671
Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <pidgin@unreliablesource.net>
parents:
25415
diff
changeset
|
1169 const char *password, *username; |
15823 | 1170 PurplePluginProtocolInfo *prpl_info; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1171 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1172 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1173 |
26749
a3595b330671
Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <pidgin@unreliablesource.net>
parents:
25415
diff
changeset
|
1174 username = purple_account_get_username(account); |
a3595b330671
Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <pidgin@unreliablesource.net>
parents:
25415
diff
changeset
|
1175 |
a3595b330671
Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <pidgin@unreliablesource.net>
parents:
25415
diff
changeset
|
1176 if (!purple_account_get_enabled(account, purple_core_get_ui())) { |
a3595b330671
Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <pidgin@unreliablesource.net>
parents:
25415
diff
changeset
|
1177 purple_debug_info("account", |
a3595b330671
Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <pidgin@unreliablesource.net>
parents:
25415
diff
changeset
|
1178 "Account %s not enabled, not connecting.\n", |
a3595b330671
Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <pidgin@unreliablesource.net>
parents:
25415
diff
changeset
|
1179 username); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1180 return; |
26749
a3595b330671
Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <pidgin@unreliablesource.net>
parents:
25415
diff
changeset
|
1181 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1182 |
15823 | 1183 prpl = purple_find_prpl(purple_account_get_protocol_id(account)); |
26749
a3595b330671
Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <pidgin@unreliablesource.net>
parents:
25415
diff
changeset
|
1184 if (prpl == NULL) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1185 gchar *message; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1186 |
26749
a3595b330671
Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <pidgin@unreliablesource.net>
parents:
25415
diff
changeset
|
1187 message = g_strdup_printf(_("Missing protocol plugin for %s"), username); |
15823 | 1188 purple_notify_error(account, _("Connection Error"), message, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1189 g_free(message); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1190 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1191 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1192 |
26749
a3595b330671
Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <pidgin@unreliablesource.net>
parents:
25415
diff
changeset
|
1193 purple_debug_info("account", "Connecting to account %s.\n", username); |
a3595b330671
Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <pidgin@unreliablesource.net>
parents:
25415
diff
changeset
|
1194 |
15823 | 1195 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
1196 password = purple_account_get_password(account); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1197 if ((password == NULL) && |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1198 !(prpl_info->options & OPT_PROTO_NO_PASSWORD) && |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1199 !(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL)) |
20152
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
1200 purple_account_request_password(account, G_CALLBACK(request_password_ok_cb), G_CALLBACK(request_password_cancel_cb), account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1201 else |
24292
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
23963
diff
changeset
|
1202 _purple_connection_new(account, FALSE, password); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1203 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1204 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1205 void |
15823 | 1206 purple_account_disconnect(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1207 { |
15823 | 1208 PurpleConnection *gc; |
28442
3896cbf6336a
Display the username in the debug log when disconnecting an account.
Paul Aurich <paul@darkrain42.org>
parents:
28035
diff
changeset
|
1209 const char *username; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1210 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1211 g_return_if_fail(account != NULL); |
15823 | 1212 g_return_if_fail(!purple_account_is_disconnected(account)); |
1213 | |
28442
3896cbf6336a
Display the username in the debug log when disconnecting an account.
Paul Aurich <paul@darkrain42.org>
parents:
28035
diff
changeset
|
1214 username = purple_account_get_username(account); |
3896cbf6336a
Display the username in the debug log when disconnecting an account.
Paul Aurich <paul@darkrain42.org>
parents:
28035
diff
changeset
|
1215 purple_debug_info("account", "Disconnecting account %s (%p)\n", |
3896cbf6336a
Display the username in the debug log when disconnecting an account.
Paul Aurich <paul@darkrain42.org>
parents:
28035
diff
changeset
|
1216 username ? username : "(null)", account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1217 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1218 account->disconnecting = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1219 |
15823 | 1220 gc = purple_account_get_connection(account); |
24292
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
23963
diff
changeset
|
1221 _purple_connection_destroy(gc); |
15823 | 1222 if (!purple_account_get_remember_password(account)) |
1223 purple_account_set_password(account, NULL); | |
1224 purple_account_set_connection(account, NULL); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1225 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1226 account->disconnecting = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1227 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1228 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1229 void |
15823 | 1230 purple_account_notify_added(PurpleAccount *account, const char *remote_user, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1231 const char *id, const char *alias, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1232 const char *message) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1233 { |
15823 | 1234 PurpleAccountUiOps *ui_ops; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1235 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1236 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1237 g_return_if_fail(remote_user != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1238 |
15823 | 1239 ui_ops = purple_accounts_get_ui_ops(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1240 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1241 if (ui_ops != NULL && ui_ops->notify_added != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1242 ui_ops->notify_added(account, remote_user, id, alias, message); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1243 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1244 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1245 void |
15823 | 1246 purple_account_request_add(PurpleAccount *account, const char *remote_user, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1247 const char *id, const char *alias, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1248 const char *message) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1249 { |
15823 | 1250 PurpleAccountUiOps *ui_ops; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1251 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1252 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1253 g_return_if_fail(remote_user != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1254 |
15823 | 1255 ui_ops = purple_accounts_get_ui_ops(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1256 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1257 if (ui_ops != NULL && ui_ops->request_add != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1258 ui_ops->request_add(account, remote_user, id, alias, message); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1259 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1260 |
24644
98ec72f8f3cc
Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24607
diff
changeset
|
1261 static PurpleAccountRequestInfo * |
98ec72f8f3cc
Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24607
diff
changeset
|
1262 purple_account_request_info_unref(PurpleAccountRequestInfo *info) |
98ec72f8f3cc
Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24607
diff
changeset
|
1263 { |
98ec72f8f3cc
Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24607
diff
changeset
|
1264 if (--info->ref) |
98ec72f8f3cc
Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24607
diff
changeset
|
1265 return info; |
98ec72f8f3cc
Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24607
diff
changeset
|
1266 |
98ec72f8f3cc
Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24607
diff
changeset
|
1267 /* TODO: This will leak info->user_data, but there is no callback to just clean that up */ |
98ec72f8f3cc
Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24607
diff
changeset
|
1268 g_free(info->user); |
98ec72f8f3cc
Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24607
diff
changeset
|
1269 g_free(info); |
98ec72f8f3cc
Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24607
diff
changeset
|
1270 return NULL; |
98ec72f8f3cc
Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24607
diff
changeset
|
1271 } |
98ec72f8f3cc
Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24607
diff
changeset
|
1272 |
15478
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1273 static void |
15823 | 1274 purple_account_request_close_info(PurpleAccountRequestInfo *info) |
15478
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1275 { |
15823 | 1276 PurpleAccountUiOps *ops; |
1277 | |
1278 ops = purple_accounts_get_ui_ops(); | |
15478
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1279 |
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1280 if (ops != NULL && ops->close_account_request != NULL) |
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1281 ops->close_account_request(info->ui_handle); |
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1282 |
24644
98ec72f8f3cc
Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24607
diff
changeset
|
1283 purple_account_request_info_unref(info); |
15478
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1284 } |
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1285 |
20152
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
1286 void |
15823 | 1287 purple_account_request_close_with_account(PurpleAccount *account) |
15478
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1288 { |
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1289 GList *l, *l_next; |
20152
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
1290 |
15478
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1291 g_return_if_fail(account != NULL); |
20152
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
1292 |
15478
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1293 for (l = handles; l != NULL; l = l_next) { |
15823 | 1294 PurpleAccountRequestInfo *info = l->data; |
20152
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
1295 |
15478
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1296 l_next = l->next; |
20152
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
1297 |
15478
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1298 if (info->account == account) { |
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1299 handles = g_list_remove(handles, info); |
15823 | 1300 purple_account_request_close_info(info); |
15478
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1301 } |
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1302 } |
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1303 } |
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1304 |
20152
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
1305 void |
15823 | 1306 purple_account_request_close(void *ui_handle) |
15478
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1307 { |
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1308 GList *l, *l_next; |
20152
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
1309 |
15478
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1310 g_return_if_fail(ui_handle != NULL); |
20152
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
1311 |
15478
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1312 for (l = handles; l != NULL; l = l_next) { |
15823 | 1313 PurpleAccountRequestInfo *info = l->data; |
20152
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
1314 |
15478
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1315 l_next = l->next; |
20152
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
1316 |
15478
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1317 if (info->ui_handle == ui_handle) { |
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1318 handles = g_list_remove(handles, info); |
15823 | 1319 purple_account_request_close_info(info); |
15478
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1320 } |
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1321 } |
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1322 } |
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1323 |
20178
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1324 static void |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1325 request_auth_cb(void *data) |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1326 { |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1327 PurpleAccountRequestInfo *info = data; |
22054
658785fe1992
This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22007
diff
changeset
|
1328 |
658785fe1992
This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22007
diff
changeset
|
1329 handles = g_list_remove(handles, info); |
658785fe1992
This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22007
diff
changeset
|
1330 |
20178
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1331 info->auth_cb(info->userdata); |
22054
658785fe1992
This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22007
diff
changeset
|
1332 |
20178
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1333 purple_signal_emit(purple_accounts_get_handle(), |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1334 "account-authorization-granted", info->account, info->user); |
22054
658785fe1992
This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22007
diff
changeset
|
1335 |
24644
98ec72f8f3cc
Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24607
diff
changeset
|
1336 purple_account_request_info_unref(info); |
20178
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1337 } |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1338 |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1339 static void |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1340 request_deny_cb(void *data) |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1341 { |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1342 PurpleAccountRequestInfo *info = data; |
22054
658785fe1992
This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22007
diff
changeset
|
1343 |
658785fe1992
This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22007
diff
changeset
|
1344 handles = g_list_remove(handles, info); |
658785fe1992
This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22007
diff
changeset
|
1345 |
20178
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1346 info->deny_cb(info->userdata); |
22054
658785fe1992
This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22007
diff
changeset
|
1347 |
20178
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1348 purple_signal_emit(purple_accounts_get_handle(), |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1349 "account-authorization-denied", info->account, info->user); |
22054
658785fe1992
This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22007
diff
changeset
|
1350 |
24644
98ec72f8f3cc
Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24607
diff
changeset
|
1351 purple_account_request_info_unref(info); |
20178
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1352 } |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1353 |
15478
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1354 void * |
15823 | 1355 purple_account_request_authorization(PurpleAccount *account, const char *remote_user, |
19195
1ca6c4b234ab
Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18452
diff
changeset
|
1356 const char *id, const char *alias, const char *message, gboolean on_list, |
1ca6c4b234ab
Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18452
diff
changeset
|
1357 PurpleAccountRequestAuthorizationCb auth_cb, PurpleAccountRequestAuthorizationCb deny_cb, void *user_data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1358 { |
15823 | 1359 PurpleAccountUiOps *ui_ops; |
1360 PurpleAccountRequestInfo *info; | |
20178
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1361 int plugin_return; |
15478
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1362 |
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1363 g_return_val_if_fail(account != NULL, NULL); |
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1364 g_return_val_if_fail(remote_user != NULL, NULL); |
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1365 |
15823 | 1366 ui_ops = purple_accounts_get_ui_ops(); |
15478
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1367 |
20178
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1368 plugin_return = GPOINTER_TO_INT( |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1369 purple_signal_emit_return_1(purple_accounts_get_handle(), |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1370 "account-authorization-requested", account, remote_user)); |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1371 |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1372 if (plugin_return > 0) { |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1373 auth_cb(user_data); |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1374 return NULL; |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1375 } else if (plugin_return < 0) { |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1376 deny_cb(user_data); |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1377 return NULL; |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1378 } |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1379 |
15478
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1380 if (ui_ops != NULL && ui_ops->request_authorize != NULL) { |
15823 | 1381 info = g_new0(PurpleAccountRequestInfo, 1); |
1382 info->type = PURPLE_ACCOUNT_REQUEST_AUTHORIZATION; | |
15478
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1383 info->account = account; |
20178
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1384 info->auth_cb = auth_cb; |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1385 info->deny_cb = deny_cb; |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1386 info->userdata = user_data; |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1387 info->user = g_strdup(remote_user); |
24644
98ec72f8f3cc
Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24607
diff
changeset
|
1388 info->ref = 2; /* We hold an extra ref to make sure info remains valid |
98ec72f8f3cc
Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24607
diff
changeset
|
1389 if any of the callbacks are called synchronously. We |
98ec72f8f3cc
Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24607
diff
changeset
|
1390 unref it after the function call */ |
98ec72f8f3cc
Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24607
diff
changeset
|
1391 |
15478
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1392 info->ui_handle = ui_ops->request_authorize(account, remote_user, id, alias, message, |
20178
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1393 on_list, request_auth_cb, request_deny_cb, info); |
19195
1ca6c4b234ab
Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18452
diff
changeset
|
1394 |
24644
98ec72f8f3cc
Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24607
diff
changeset
|
1395 info = purple_account_request_info_unref(info); |
98ec72f8f3cc
Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24607
diff
changeset
|
1396 if (info) { |
98ec72f8f3cc
Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24607
diff
changeset
|
1397 handles = g_list_append(handles, info); |
98ec72f8f3cc
Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24607
diff
changeset
|
1398 return info->ui_handle; |
98ec72f8f3cc
Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24607
diff
changeset
|
1399 } |
15478
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1400 } |
20152
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
1401 |
15478
cb3800fabd76
The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15421
diff
changeset
|
1402 return NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1403 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1404 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1405 static void |
15823 | 1406 change_password_cb(PurpleAccount *account, PurpleRequestFields *fields) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1407 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1408 const char *orig_pass, *new_pass_1, *new_pass_2; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1409 |
15823 | 1410 orig_pass = purple_request_fields_get_string(fields, "password"); |
1411 new_pass_1 = purple_request_fields_get_string(fields, "new_password_1"); | |
1412 new_pass_2 = purple_request_fields_get_string(fields, "new_password_2"); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1413 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1414 if (g_utf8_collate(new_pass_1, new_pass_2)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1415 { |
15823 | 1416 purple_notify_error(account, NULL, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1417 _("New passwords do not match."), NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1418 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1419 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1420 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1421 |
22694
7097bbac4234
Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents:
22503
diff
changeset
|
1422 if ((purple_request_fields_is_field_required(fields, "password") && |
7097bbac4234
Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents:
22503
diff
changeset
|
1423 (orig_pass == NULL || *orig_pass == '\0')) || |
7097bbac4234
Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents:
22503
diff
changeset
|
1424 (purple_request_fields_is_field_required(fields, "new_password_1") && |
7097bbac4234
Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents:
22503
diff
changeset
|
1425 (new_pass_1 == NULL || *new_pass_1 == '\0')) || |
7097bbac4234
Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents:
22503
diff
changeset
|
1426 (purple_request_fields_is_field_required(fields, "new_password_2") && |
7097bbac4234
Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents:
22503
diff
changeset
|
1427 (new_pass_2 == NULL || *new_pass_2 == '\0'))) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1428 { |
15823 | 1429 purple_notify_error(account, NULL, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1430 _("Fill out all fields completely."), NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1431 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1432 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1433 |
15823 | 1434 purple_account_change_password(account, orig_pass, new_pass_1); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1435 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1436 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1437 void |
15823 | 1438 purple_account_request_change_password(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1439 { |
15823 | 1440 PurpleRequestFields *fields; |
1441 PurpleRequestFieldGroup *group; | |
1442 PurpleRequestField *field; | |
22694
7097bbac4234
Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents:
22503
diff
changeset
|
1443 PurpleConnection *gc; |
7097bbac4234
Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents:
22503
diff
changeset
|
1444 PurplePlugin *prpl = NULL; |
7097bbac4234
Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents:
22503
diff
changeset
|
1445 PurplePluginProtocolInfo *prpl_info = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1446 char primary[256]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1447 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1448 g_return_if_fail(account != NULL); |
15823 | 1449 g_return_if_fail(purple_account_is_connected(account)); |
1450 | |
22694
7097bbac4234
Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents:
22503
diff
changeset
|
1451 gc = purple_account_get_connection(account); |
7097bbac4234
Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents:
22503
diff
changeset
|
1452 if (gc != NULL) |
7097bbac4234
Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents:
22503
diff
changeset
|
1453 prpl = purple_connection_get_prpl(gc); |
7097bbac4234
Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents:
22503
diff
changeset
|
1454 if (prpl != NULL) |
7097bbac4234
Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents:
22503
diff
changeset
|
1455 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
7097bbac4234
Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents:
22503
diff
changeset
|
1456 |
15823 | 1457 fields = purple_request_fields_new(); |
1458 | |
1459 group = purple_request_field_group_new(NULL); | |
1460 purple_request_fields_add_group(fields, group); | |
1461 | |
1462 field = purple_request_field_string_new("password", _("Original password"), | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1463 NULL, FALSE); |
15823 | 1464 purple_request_field_string_set_masked(field, TRUE); |
22694
7097bbac4234
Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents:
22503
diff
changeset
|
1465 if (!(prpl_info && (prpl_info->options | OPT_PROTO_PASSWORD_OPTIONAL))) |
7097bbac4234
Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents:
22503
diff
changeset
|
1466 purple_request_field_set_required(field, TRUE); |
15823 | 1467 purple_request_field_group_add_field(group, field); |
1468 | |
1469 field = purple_request_field_string_new("new_password_1", | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1470 _("New password"), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1471 NULL, FALSE); |
15823 | 1472 purple_request_field_string_set_masked(field, TRUE); |
22694
7097bbac4234
Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents:
22503
diff
changeset
|
1473 if (!(prpl_info && (prpl_info->options | OPT_PROTO_PASSWORD_OPTIONAL))) |
7097bbac4234
Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents:
22503
diff
changeset
|
1474 purple_request_field_set_required(field, TRUE); |
15823 | 1475 purple_request_field_group_add_field(group, field); |
1476 | |
1477 field = purple_request_field_string_new("new_password_2", | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1478 _("New password (again)"), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1479 NULL, FALSE); |
15823 | 1480 purple_request_field_string_set_masked(field, TRUE); |
22694
7097bbac4234
Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents:
22503
diff
changeset
|
1481 if (!(prpl_info && (prpl_info->options | OPT_PROTO_PASSWORD_OPTIONAL))) |
7097bbac4234
Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents:
22503
diff
changeset
|
1482 purple_request_field_set_required(field, TRUE); |
15823 | 1483 purple_request_field_group_add_field(group, field); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1484 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1485 g_snprintf(primary, sizeof(primary), _("Change password for %s"), |
15823 | 1486 purple_account_get_username(account)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1487 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1488 /* I'm sticking this somewhere in the code: bologna */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1489 |
15823 | 1490 purple_request_fields(purple_account_get_connection(account), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1491 NULL, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1492 primary, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1493 _("Please enter your current password and your " |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1494 "new password."), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1495 fields, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1496 _("OK"), G_CALLBACK(change_password_cb), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1497 _("Cancel"), NULL, |
16442
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16068
diff
changeset
|
1498 account, NULL, NULL, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1499 account); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1500 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1501 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1502 static void |
15823 | 1503 set_user_info_cb(PurpleAccount *account, const char *user_info) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1504 { |
15823 | 1505 PurpleConnection *gc; |
1506 | |
1507 purple_account_set_user_info(account, user_info); | |
1508 gc = purple_account_get_connection(account); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1509 serv_set_info(gc, user_info); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1510 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1511 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1512 void |
15823 | 1513 purple_account_request_change_user_info(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1514 { |
15823 | 1515 PurpleConnection *gc; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1516 char primary[256]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1517 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1518 g_return_if_fail(account != NULL); |
15823 | 1519 g_return_if_fail(purple_account_is_connected(account)); |
1520 | |
1521 gc = purple_account_get_connection(account); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1522 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1523 g_snprintf(primary, sizeof(primary), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1524 _("Change user information for %s"), |
15823 | 1525 purple_account_get_username(account)); |
1526 | |
1527 purple_request_input(gc, _("Set User Info"), primary, NULL, | |
1528 purple_account_get_user_info(account), | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1529 TRUE, FALSE, ((gc != NULL) && |
15823 | 1530 (gc->flags & PURPLE_CONNECTION_HTML) ? "html" : NULL), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1531 _("Save"), G_CALLBACK(set_user_info_cb), |
16442
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16068
diff
changeset
|
1532 _("Cancel"), NULL, |
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16068
diff
changeset
|
1533 account, NULL, NULL, |
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16068
diff
changeset
|
1534 account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1535 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1536 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1537 void |
15823 | 1538 purple_account_set_username(PurpleAccount *account, const char *username) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1539 { |
28035
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27450
diff
changeset
|
1540 PurpleBlistUiOps *blist_ops; |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27450
diff
changeset
|
1541 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1542 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1543 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1544 g_free(account->username); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1545 account->username = g_strdup(username); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1546 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1547 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1548 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1549 /* if the name changes, we should re-write the buddy list |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1550 * to disk with the new name */ |
28035
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27450
diff
changeset
|
1551 blist_ops = purple_blist_get_ui_ops(); |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27450
diff
changeset
|
1552 if (blist_ops != NULL && blist_ops->save_account != NULL) |
14ce47859540
Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents:
27450
diff
changeset
|
1553 blist_ops->save_account(account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1554 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1555 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1556 void |
15823 | 1557 purple_account_set_password(PurpleAccount *account, const char *password) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1558 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1559 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1560 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1561 g_free(account->password); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1562 account->password = g_strdup(password); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1563 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1564 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1565 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1566 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1567 void |
15823 | 1568 purple_account_set_alias(PurpleAccount *account, const char *alias) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1569 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1570 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1571 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1572 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1573 * Do nothing if alias and account->alias are both NULL. Or if |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1574 * they're the exact same string. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1575 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1576 if (alias == account->alias) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1577 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1578 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1579 if ((!alias && account->alias) || (alias && !account->alias) || |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1580 g_utf8_collate(account->alias, alias)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1581 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1582 char *old = account->alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1583 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1584 account->alias = g_strdup(alias); |
15823 | 1585 purple_signal_emit(purple_accounts_get_handle(), "account-alias-changed", |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1586 account, old); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1587 g_free(old); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1588 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1589 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1590 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1591 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1592 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1593 void |
15823 | 1594 purple_account_set_user_info(PurpleAccount *account, const char *user_info) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1595 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1596 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1597 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1598 g_free(account->user_info); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1599 account->user_info = g_strdup(user_info); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1600 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1601 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1602 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1603 |
15823 | 1604 void purple_account_set_buddy_icon_path(PurpleAccount *account, const char *path) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1605 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1606 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1607 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1608 g_free(account->buddy_icon_path); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1609 account->buddy_icon_path = g_strdup(path); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1610 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1611 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1612 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1613 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1614 void |
15823 | 1615 purple_account_set_protocol_id(PurpleAccount *account, const char *protocol_id) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1616 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1617 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1618 g_return_if_fail(protocol_id != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1619 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1620 g_free(account->protocol_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1621 account->protocol_id = g_strdup(protocol_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1622 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1623 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1624 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1625 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1626 void |
15823 | 1627 purple_account_set_connection(PurpleAccount *account, PurpleConnection *gc) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1628 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1629 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1630 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1631 account->gc = gc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1632 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1633 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1634 void |
15823 | 1635 purple_account_set_remember_password(PurpleAccount *account, gboolean value) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1636 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1637 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1638 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1639 account->remember_pass = value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1640 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1641 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1642 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1643 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1644 void |
15823 | 1645 purple_account_set_check_mail(PurpleAccount *account, gboolean value) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1646 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1647 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1648 |
15823 | 1649 purple_account_set_bool(account, "check-mail", value); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1650 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1651 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1652 void |
15823 | 1653 purple_account_set_enabled(PurpleAccount *account, const char *ui, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1654 gboolean value) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1655 { |
15823 | 1656 PurpleConnection *gc; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1657 gboolean was_enabled = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1658 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1659 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1660 g_return_if_fail(ui != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1661 |
15823 | 1662 was_enabled = purple_account_get_enabled(account, ui); |
1663 | |
1664 purple_account_set_ui_bool(account, ui, "auto-login", value); | |
1665 gc = purple_account_get_connection(account); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1666 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1667 if(was_enabled && !value) |
15823 | 1668 purple_signal_emit(purple_accounts_get_handle(), "account-disabled", account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1669 else if(!was_enabled && value) |
15823 | 1670 purple_signal_emit(purple_accounts_get_handle(), "account-enabled", account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1671 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1672 if ((gc != NULL) && (gc->wants_to_die == TRUE)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1673 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1674 |
15823 | 1675 if (value && purple_presence_is_online(account->presence)) |
1676 purple_account_connect(account); | |
1677 else if (!value && !purple_account_is_disconnected(account)) | |
1678 purple_account_disconnect(account); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1679 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1680 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1681 void |
15823 | 1682 purple_account_set_proxy_info(PurpleAccount *account, PurpleProxyInfo *info) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1683 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1684 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1685 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1686 if (account->proxy_info != NULL) |
15823 | 1687 purple_proxy_info_destroy(account->proxy_info); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1688 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1689 account->proxy_info = info; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1690 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1691 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1692 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1693 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1694 void |
15823 | 1695 purple_account_set_status_types(PurpleAccount *account, GList *status_types) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1696 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1697 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1698 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1699 /* Out with the old... */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1700 if (account->status_types != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1701 { |
15823 | 1702 g_list_foreach(account->status_types, (GFunc)purple_status_type_destroy, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1703 g_list_free(account->status_types); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1704 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1705 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1706 /* In with the new... */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1707 account->status_types = status_types; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1708 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1709 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1710 void |
15823 | 1711 purple_account_set_status(PurpleAccount *account, const char *status_id, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1712 gboolean active, ...) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1713 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1714 GList *attrs = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1715 const gchar *id; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1716 gpointer data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1717 va_list args; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1718 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1719 va_start(args, active); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1720 while ((id = va_arg(args, const char *)) != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1721 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1722 attrs = g_list_append(attrs, (char *)id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1723 data = va_arg(args, void *); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1724 attrs = g_list_append(attrs, data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1725 } |
15823 | 1726 purple_account_set_status_list(account, status_id, active, attrs); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1727 g_list_free(attrs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1728 va_end(args); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1729 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1730 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1731 void |
15823 | 1732 purple_account_set_status_list(PurpleAccount *account, const char *status_id, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1733 gboolean active, GList *attrs) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1734 { |
15823 | 1735 PurpleStatus *status; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1736 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1737 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1738 g_return_if_fail(status_id != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1739 |
15823 | 1740 status = purple_account_get_status(account, status_id); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1741 if (status == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1742 { |
15823 | 1743 purple_debug_error("account", |
21937
8daec0ca3218
Infinitesimally better debug message
Mark Doliner <mark@kingant.net>
parents:
21846
diff
changeset
|
1744 "Invalid status ID '%s' for account %s (%s)\n", |
15823 | 1745 status_id, purple_account_get_username(account), |
1746 purple_account_get_protocol_id(account)); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1747 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1748 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1749 |
15823 | 1750 if (active || purple_status_is_independent(status)) |
1751 purple_status_set_active_with_attrs_list(status, active, attrs); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1752 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1753 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1754 * Our current statuses are saved to accounts.xml (so that when we |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1755 * reconnect, we go back to the previous status). |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1756 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1757 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1758 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1759 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1760 void |
15823 | 1761 purple_account_clear_settings(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1762 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1763 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1764 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1765 g_hash_table_destroy(account->settings); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1766 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1767 account->settings = g_hash_table_new_full(g_str_hash, g_str_equal, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1768 g_free, delete_setting); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1769 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1770 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1771 void |
27402
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
1772 purple_account_remove_setting(PurpleAccount *account, const char *setting) |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
1773 { |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
1774 g_return_if_fail(account != NULL); |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
1775 g_return_if_fail(setting != NULL); |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
1776 |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
1777 g_hash_table_remove(account->settings, setting); |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
1778 } |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
1779 |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
1780 void |
15823 | 1781 purple_account_set_int(PurpleAccount *account, const char *name, int value) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1782 { |
15823 | 1783 PurpleAccountSetting *setting; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1784 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1785 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1786 g_return_if_fail(name != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1787 |
15823 | 1788 setting = g_new0(PurpleAccountSetting, 1); |
1789 | |
1790 setting->type = PURPLE_PREF_INT; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1791 setting->value.integer = value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1792 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1793 g_hash_table_insert(account->settings, g_strdup(name), setting); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1794 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1795 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1796 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1797 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1798 void |
15823 | 1799 purple_account_set_string(PurpleAccount *account, const char *name, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1800 const char *value) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1801 { |
15823 | 1802 PurpleAccountSetting *setting; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1803 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1804 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1805 g_return_if_fail(name != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1806 |
15823 | 1807 setting = g_new0(PurpleAccountSetting, 1); |
1808 | |
1809 setting->type = PURPLE_PREF_STRING; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1810 setting->value.string = g_strdup(value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1811 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1812 g_hash_table_insert(account->settings, g_strdup(name), setting); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1813 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1814 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1815 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1816 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1817 void |
15823 | 1818 purple_account_set_bool(PurpleAccount *account, const char *name, gboolean value) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1819 { |
15823 | 1820 PurpleAccountSetting *setting; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1821 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1822 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1823 g_return_if_fail(name != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1824 |
15823 | 1825 setting = g_new0(PurpleAccountSetting, 1); |
1826 | |
1827 setting->type = PURPLE_PREF_BOOLEAN; | |
20354
01101467094f
applied changes from 7a436ba53de6adebccf4e920ca62d544e13b1094
Luke Schierer <lschiere@pidgin.im>
parents:
20251
diff
changeset
|
1828 setting->value.boolean = value; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1829 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1830 g_hash_table_insert(account->settings, g_strdup(name), setting); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1831 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1832 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1833 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1834 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1835 static GHashTable * |
15823 | 1836 get_ui_settings_table(PurpleAccount *account, const char *ui) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1837 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1838 GHashTable *table; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1839 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1840 table = g_hash_table_lookup(account->ui_settings, ui); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1841 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1842 if (table == NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1843 table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1844 delete_setting); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1845 g_hash_table_insert(account->ui_settings, g_strdup(ui), table); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1846 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1847 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1848 return table; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1849 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1850 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1851 void |
15823 | 1852 purple_account_set_ui_int(PurpleAccount *account, const char *ui, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1853 const char *name, int value) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1854 { |
15823 | 1855 PurpleAccountSetting *setting; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1856 GHashTable *table; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1857 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1858 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1859 g_return_if_fail(ui != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1860 g_return_if_fail(name != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1861 |
15823 | 1862 setting = g_new0(PurpleAccountSetting, 1); |
1863 | |
1864 setting->type = PURPLE_PREF_INT; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1865 setting->ui = g_strdup(ui); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1866 setting->value.integer = value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1867 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1868 table = get_ui_settings_table(account, ui); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1869 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1870 g_hash_table_insert(table, g_strdup(name), setting); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1871 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1872 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1873 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1874 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1875 void |
15823 | 1876 purple_account_set_ui_string(PurpleAccount *account, const char *ui, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1877 const char *name, const char *value) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1878 { |
15823 | 1879 PurpleAccountSetting *setting; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1880 GHashTable *table; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1881 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1882 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1883 g_return_if_fail(ui != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1884 g_return_if_fail(name != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1885 |
15823 | 1886 setting = g_new0(PurpleAccountSetting, 1); |
1887 | |
1888 setting->type = PURPLE_PREF_STRING; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1889 setting->ui = g_strdup(ui); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1890 setting->value.string = g_strdup(value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1891 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1892 table = get_ui_settings_table(account, ui); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1893 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1894 g_hash_table_insert(table, g_strdup(name), setting); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1895 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1896 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1897 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1898 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1899 void |
15823 | 1900 purple_account_set_ui_bool(PurpleAccount *account, const char *ui, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1901 const char *name, gboolean value) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1902 { |
15823 | 1903 PurpleAccountSetting *setting; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1904 GHashTable *table; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1905 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1906 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1907 g_return_if_fail(ui != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1908 g_return_if_fail(name != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1909 |
15823 | 1910 setting = g_new0(PurpleAccountSetting, 1); |
1911 | |
1912 setting->type = PURPLE_PREF_BOOLEAN; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1913 setting->ui = g_strdup(ui); |
20354
01101467094f
applied changes from 7a436ba53de6adebccf4e920ca62d544e13b1094
Luke Schierer <lschiere@pidgin.im>
parents:
20251
diff
changeset
|
1914 setting->value.boolean = value; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1915 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1916 table = get_ui_settings_table(account, ui); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1917 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1918 g_hash_table_insert(table, g_strdup(name), setting); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1919 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1920 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1921 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1922 |
15823 | 1923 static PurpleConnectionState |
1924 purple_account_get_state(const PurpleAccount *account) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1925 { |
15823 | 1926 PurpleConnection *gc; |
1927 | |
1928 g_return_val_if_fail(account != NULL, PURPLE_DISCONNECTED); | |
1929 | |
1930 gc = purple_account_get_connection(account); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1931 if (!gc) |
15823 | 1932 return PURPLE_DISCONNECTED; |
1933 | |
1934 return purple_connection_get_state(gc); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1935 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1936 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1937 gboolean |
15823 | 1938 purple_account_is_connected(const PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1939 { |
15823 | 1940 return (purple_account_get_state(account) == PURPLE_CONNECTED); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1941 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1942 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1943 gboolean |
15823 | 1944 purple_account_is_connecting(const PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1945 { |
15823 | 1946 return (purple_account_get_state(account) == PURPLE_CONNECTING); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1947 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1948 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1949 gboolean |
15823 | 1950 purple_account_is_disconnected(const PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1951 { |
15823 | 1952 return (purple_account_get_state(account) == PURPLE_DISCONNECTED); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1953 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1954 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1955 const char * |
15823 | 1956 purple_account_get_username(const PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1957 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1958 g_return_val_if_fail(account != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1959 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1960 return account->username; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1961 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1962 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1963 const char * |
15823 | 1964 purple_account_get_password(const PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1965 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1966 g_return_val_if_fail(account != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1967 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1968 return account->password; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1969 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1970 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1971 const char * |
15823 | 1972 purple_account_get_alias(const PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1973 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1974 g_return_val_if_fail(account != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1975 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1976 return account->alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1977 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1978 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1979 const char * |
15823 | 1980 purple_account_get_user_info(const PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1981 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1982 g_return_val_if_fail(account != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1983 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1984 return account->user_info; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1985 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1986 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1987 const char * |
15823 | 1988 purple_account_get_buddy_icon_path(const PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1989 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1990 g_return_val_if_fail(account != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1991 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1992 return account->buddy_icon_path; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1993 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1994 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1995 const char * |
15823 | 1996 purple_account_get_protocol_id(const PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1997 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1998 g_return_val_if_fail(account != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1999 return account->protocol_id; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2000 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2001 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2002 const char * |
15823 | 2003 purple_account_get_protocol_name(const PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2004 { |
15823 | 2005 PurplePlugin *p; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2006 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2007 g_return_val_if_fail(account != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2008 |
15823 | 2009 p = purple_find_prpl(purple_account_get_protocol_id(account)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2010 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2011 return ((p && p->info->name) ? _(p->info->name) : _("Unknown")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2012 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2013 |
15823 | 2014 PurpleConnection * |
2015 purple_account_get_connection(const PurpleAccount *account) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2016 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2017 g_return_val_if_fail(account != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2018 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2019 return account->gc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2020 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2021 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2022 gboolean |
15823 | 2023 purple_account_get_remember_password(const PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2024 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2025 g_return_val_if_fail(account != NULL, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2026 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2027 return account->remember_pass; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2028 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2029 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2030 gboolean |
15823 | 2031 purple_account_get_check_mail(const PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2032 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2033 g_return_val_if_fail(account != NULL, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2034 |
15823 | 2035 return purple_account_get_bool(account, "check-mail", FALSE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2036 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2037 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2038 gboolean |
15823 | 2039 purple_account_get_enabled(const PurpleAccount *account, const char *ui) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2040 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2041 g_return_val_if_fail(account != NULL, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2042 g_return_val_if_fail(ui != NULL, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2043 |
15823 | 2044 return purple_account_get_ui_bool(account, ui, "auto-login", FALSE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2045 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2046 |
15823 | 2047 PurpleProxyInfo * |
2048 purple_account_get_proxy_info(const PurpleAccount *account) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2049 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2050 g_return_val_if_fail(account != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2051 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2052 return account->proxy_info; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2053 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2054 |
15823 | 2055 PurpleStatus * |
2056 purple_account_get_active_status(const PurpleAccount *account) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2057 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2058 g_return_val_if_fail(account != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2059 |
15823 | 2060 return purple_presence_get_active_status(account->presence); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2061 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2062 |
15823 | 2063 PurpleStatus * |
2064 purple_account_get_status(const PurpleAccount *account, const char *status_id) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2065 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2066 g_return_val_if_fail(account != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2067 g_return_val_if_fail(status_id != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2068 |
15823 | 2069 return purple_presence_get_status(account->presence, status_id); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2070 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2071 |
15823 | 2072 PurpleStatusType * |
2073 purple_account_get_status_type(const PurpleAccount *account, const char *id) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2074 { |
18118
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18063
diff
changeset
|
2075 GList *l; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2076 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2077 g_return_val_if_fail(account != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2078 g_return_val_if_fail(id != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2079 |
15823 | 2080 for (l = purple_account_get_status_types(account); l != NULL; l = l->next) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2081 { |
15823 | 2082 PurpleStatusType *status_type = (PurpleStatusType *)l->data; |
2083 | |
25385
a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents:
25368
diff
changeset
|
2084 if (purple_strequal(purple_status_type_get_id(status_type), id)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2085 return status_type; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2086 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2087 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2088 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2089 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2090 |
15823 | 2091 PurpleStatusType * |
2092 purple_account_get_status_type_with_primitive(const PurpleAccount *account, PurpleStatusPrimitive primitive) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2093 { |
18118
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18063
diff
changeset
|
2094 GList *l; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2095 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2096 g_return_val_if_fail(account != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2097 |
15823 | 2098 for (l = purple_account_get_status_types(account); l != NULL; l = l->next) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2099 { |
15823 | 2100 PurpleStatusType *status_type = (PurpleStatusType *)l->data; |
2101 | |
2102 if (purple_status_type_get_primitive(status_type) == primitive) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2103 return status_type; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2104 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2105 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2106 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2107 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2108 |
15823 | 2109 PurplePresence * |
2110 purple_account_get_presence(const PurpleAccount *account) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2111 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2112 g_return_val_if_fail(account != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2113 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2114 return account->presence; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2115 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2116 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2117 gboolean |
15823 | 2118 purple_account_is_status_active(const PurpleAccount *account, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2119 const char *status_id) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2120 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2121 g_return_val_if_fail(account != NULL, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2122 g_return_val_if_fail(status_id != NULL, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2123 |
15823 | 2124 return purple_presence_is_status_active(account->presence, status_id); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2125 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2126 |
18118
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18063
diff
changeset
|
2127 GList * |
15823 | 2128 purple_account_get_status_types(const PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2129 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2130 g_return_val_if_fail(account != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2131 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2132 return account->status_types; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2133 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2134 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2135 int |
15823 | 2136 purple_account_get_int(const PurpleAccount *account, const char *name, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2137 int default_value) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2138 { |
15823 | 2139 PurpleAccountSetting *setting; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2140 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2141 g_return_val_if_fail(account != NULL, default_value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2142 g_return_val_if_fail(name != NULL, default_value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2143 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2144 setting = g_hash_table_lookup(account->settings, name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2145 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2146 if (setting == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2147 return default_value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2148 |
15823 | 2149 g_return_val_if_fail(setting->type == PURPLE_PREF_INT, default_value); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2150 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2151 return setting->value.integer; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2152 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2153 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2154 const char * |
15823 | 2155 purple_account_get_string(const PurpleAccount *account, const char *name, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2156 const char *default_value) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2157 { |
15823 | 2158 PurpleAccountSetting *setting; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2159 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2160 g_return_val_if_fail(account != NULL, default_value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2161 g_return_val_if_fail(name != NULL, default_value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2162 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2163 setting = g_hash_table_lookup(account->settings, name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2164 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2165 if (setting == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2166 return default_value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2167 |
15823 | 2168 g_return_val_if_fail(setting->type == PURPLE_PREF_STRING, default_value); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2169 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2170 return setting->value.string; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2171 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2172 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2173 gboolean |
15823 | 2174 purple_account_get_bool(const PurpleAccount *account, const char *name, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2175 gboolean default_value) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2176 { |
15823 | 2177 PurpleAccountSetting *setting; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2178 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2179 g_return_val_if_fail(account != NULL, default_value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2180 g_return_val_if_fail(name != NULL, default_value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2181 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2182 setting = g_hash_table_lookup(account->settings, name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2183 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2184 if (setting == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2185 return default_value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2186 |
15823 | 2187 g_return_val_if_fail(setting->type == PURPLE_PREF_BOOLEAN, default_value); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2188 |
20354
01101467094f
applied changes from 7a436ba53de6adebccf4e920ca62d544e13b1094
Luke Schierer <lschiere@pidgin.im>
parents:
20251
diff
changeset
|
2189 return setting->value.boolean; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2190 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2191 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2192 int |
15823 | 2193 purple_account_get_ui_int(const PurpleAccount *account, const char *ui, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2194 const char *name, int default_value) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2195 { |
15823 | 2196 PurpleAccountSetting *setting; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2197 GHashTable *table; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2198 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2199 g_return_val_if_fail(account != NULL, default_value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2200 g_return_val_if_fail(ui != NULL, default_value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2201 g_return_val_if_fail(name != NULL, default_value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2202 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2203 if ((table = g_hash_table_lookup(account->ui_settings, ui)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2204 return default_value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2205 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2206 if ((setting = g_hash_table_lookup(table, name)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2207 return default_value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2208 |
15823 | 2209 g_return_val_if_fail(setting->type == PURPLE_PREF_INT, default_value); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2210 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2211 return setting->value.integer; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2212 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2213 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2214 const char * |
15823 | 2215 purple_account_get_ui_string(const PurpleAccount *account, const char *ui, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2216 const char *name, const char *default_value) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2217 { |
15823 | 2218 PurpleAccountSetting *setting; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2219 GHashTable *table; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2220 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2221 g_return_val_if_fail(account != NULL, default_value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2222 g_return_val_if_fail(ui != NULL, default_value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2223 g_return_val_if_fail(name != NULL, default_value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2224 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2225 if ((table = g_hash_table_lookup(account->ui_settings, ui)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2226 return default_value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2227 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2228 if ((setting = g_hash_table_lookup(table, name)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2229 return default_value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2230 |
15823 | 2231 g_return_val_if_fail(setting->type == PURPLE_PREF_STRING, default_value); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2232 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2233 return setting->value.string; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2234 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2235 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2236 gboolean |
15823 | 2237 purple_account_get_ui_bool(const PurpleAccount *account, const char *ui, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2238 const char *name, gboolean default_value) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2239 { |
15823 | 2240 PurpleAccountSetting *setting; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2241 GHashTable *table; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2242 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2243 g_return_val_if_fail(account != NULL, default_value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2244 g_return_val_if_fail(ui != NULL, default_value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2245 g_return_val_if_fail(name != NULL, default_value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2246 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2247 if ((table = g_hash_table_lookup(account->ui_settings, ui)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2248 return default_value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2249 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2250 if ((setting = g_hash_table_lookup(table, name)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2251 return default_value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2252 |
15823 | 2253 g_return_val_if_fail(setting->type == PURPLE_PREF_BOOLEAN, default_value); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2254 |
20354
01101467094f
applied changes from 7a436ba53de6adebccf4e920ca62d544e13b1094
Luke Schierer <lschiere@pidgin.im>
parents:
20251
diff
changeset
|
2255 return setting->value.boolean; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2256 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2257 |
15823 | 2258 PurpleLog * |
2259 purple_account_get_log(PurpleAccount *account, gboolean create) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2260 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2261 g_return_val_if_fail(account != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2262 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2263 if(!account->system_log && create){ |
15823 | 2264 PurplePresence *presence; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2265 int login_time; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2266 |
15823 | 2267 presence = purple_account_get_presence(account); |
2268 login_time = purple_presence_get_login_time(presence); | |
2269 | |
2270 account->system_log = purple_log_new(PURPLE_LOG_SYSTEM, | |
2271 purple_account_get_username(account), account, NULL, | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2272 (login_time != 0) ? login_time : time(NULL), NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2273 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2274 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2275 return account->system_log; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2276 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2277 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2278 void |
15823 | 2279 purple_account_destroy_log(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2280 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2281 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2282 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2283 if(account->system_log){ |
15823 | 2284 purple_log_free(account->system_log); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2285 account->system_log = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2286 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2287 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2288 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2289 void |
15823 | 2290 purple_account_add_buddy(PurpleAccount *account, PurpleBuddy *buddy) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2291 { |
15823 | 2292 PurplePluginProtocolInfo *prpl_info = NULL; |
2293 PurpleConnection *gc = purple_account_get_connection(account); | |
22231
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2294 PurplePlugin *prpl = NULL; |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2295 |
22231
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2296 if (gc != NULL) |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2297 prpl = purple_connection_get_prpl(gc); |
22231
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2298 |
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2299 if (prpl != NULL) |
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2300 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2301 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2302 if (prpl_info != NULL && prpl_info->add_buddy != NULL) |
15823 | 2303 prpl_info->add_buddy(gc, buddy, purple_buddy_get_group(buddy)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2304 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2305 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2306 void |
15823 | 2307 purple_account_add_buddies(PurpleAccount *account, GList *buddies) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2308 { |
15823 | 2309 PurplePluginProtocolInfo *prpl_info = NULL; |
2310 PurpleConnection *gc = purple_account_get_connection(account); | |
22231
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2311 PurplePlugin *prpl = NULL; |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2312 |
22231
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2313 if (gc != NULL) |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2314 prpl = purple_connection_get_prpl(gc); |
22231
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2315 |
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2316 if (prpl != NULL) |
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2317 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2318 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2319 if (prpl_info) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2320 GList *cur, *groups = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2321 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2322 /* Make a list of what group each buddy is in */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2323 for (cur = buddies; cur != NULL; cur = cur->next) { |
25301
41485746e2b9
A couple of minor fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25299
diff
changeset
|
2324 PurpleBuddy *buddy = cur->data; |
41485746e2b9
A couple of minor fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25299
diff
changeset
|
2325 groups = g_list_append(groups, purple_buddy_get_group(buddy)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2326 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2327 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2328 if (prpl_info->add_buddies != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2329 prpl_info->add_buddies(gc, buddies, groups); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2330 else if (prpl_info->add_buddy != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2331 GList *curb = buddies, *curg = groups; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2332 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2333 while ((curb != NULL) && (curg != NULL)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2334 prpl_info->add_buddy(gc, curb->data, curg->data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2335 curb = curb->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2336 curg = curg->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2337 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2338 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2339 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2340 g_list_free(groups); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2341 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2342 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2343 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2344 void |
15823 | 2345 purple_account_remove_buddy(PurpleAccount *account, PurpleBuddy *buddy, |
2346 PurpleGroup *group) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2347 { |
15823 | 2348 PurplePluginProtocolInfo *prpl_info = NULL; |
2349 PurpleConnection *gc = purple_account_get_connection(account); | |
22231
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2350 PurplePlugin *prpl = NULL; |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2351 |
22231
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2352 if (gc != NULL) |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2353 prpl = purple_connection_get_prpl(gc); |
22231
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2354 |
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2355 if (prpl != NULL) |
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2356 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2357 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2358 if (prpl_info && prpl_info->remove_buddy) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2359 prpl_info->remove_buddy(gc, buddy, group); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2360 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2361 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2362 void |
15823 | 2363 purple_account_remove_buddies(PurpleAccount *account, GList *buddies, GList *groups) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2364 { |
15823 | 2365 PurplePluginProtocolInfo *prpl_info = NULL; |
2366 PurpleConnection *gc = purple_account_get_connection(account); | |
22231
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2367 PurplePlugin *prpl = NULL; |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2368 |
22231
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2369 if (gc != NULL) |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2370 prpl = purple_connection_get_prpl(gc); |
22231
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2371 |
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2372 if (prpl != NULL) |
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2373 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2374 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2375 if (prpl_info) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2376 if (prpl_info->remove_buddies) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2377 prpl_info->remove_buddies(gc, buddies, groups); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2378 else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2379 GList *curb = buddies; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2380 GList *curg = groups; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2381 while ((curb != NULL) && (curg != NULL)) { |
15823 | 2382 purple_account_remove_buddy(account, curb->data, curg->data); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2383 curb = curb->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2384 curg = curg->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2385 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2386 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2387 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2388 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2389 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2390 void |
15823 | 2391 purple_account_remove_group(PurpleAccount *account, PurpleGroup *group) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2392 { |
15823 | 2393 PurplePluginProtocolInfo *prpl_info = NULL; |
2394 PurpleConnection *gc = purple_account_get_connection(account); | |
22231
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2395 PurplePlugin *prpl = NULL; |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2396 |
22231
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2397 if (gc != NULL) |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2398 prpl = purple_connection_get_prpl(gc); |
22231
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2399 |
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2400 if (prpl != NULL) |
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2401 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2402 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2403 if (prpl_info && prpl_info->remove_group) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2404 prpl_info->remove_group(gc, group); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2405 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2406 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2407 void |
15823 | 2408 purple_account_change_password(PurpleAccount *account, const char *orig_pw, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2409 const char *new_pw) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2410 { |
15823 | 2411 PurplePluginProtocolInfo *prpl_info = NULL; |
2412 PurpleConnection *gc = purple_account_get_connection(account); | |
22231
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2413 PurplePlugin *prpl = NULL; |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2414 |
15823 | 2415 purple_account_set_password(account, new_pw); |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2416 |
22231
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2417 if (gc != NULL) |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2418 prpl = purple_connection_get_prpl(gc); |
22231
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2419 |
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2420 if (prpl != NULL) |
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2421 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2422 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2423 if (prpl_info && prpl_info->change_passwd) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2424 prpl_info->change_passwd(gc, orig_pw, new_pw); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2425 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2426 |
15823 | 2427 gboolean purple_account_supports_offline_message(PurpleAccount *account, PurpleBuddy *buddy) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2428 { |
15823 | 2429 PurpleConnection *gc; |
22231
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2430 PurplePluginProtocolInfo *prpl_info = NULL; |
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2431 PurplePlugin *prpl = NULL; |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2432 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2433 g_return_val_if_fail(account, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2434 g_return_val_if_fail(buddy, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2435 |
15823 | 2436 gc = purple_account_get_connection(account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2437 if (gc == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2438 return FALSE; |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2439 |
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2440 prpl = purple_connection_get_prpl(gc); |
22231
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2441 |
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2442 if (prpl != NULL) |
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2443 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2444 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2445 if (!prpl_info || !prpl_info->offline_message) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2446 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2447 return prpl_info->offline_message(buddy); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2448 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2449 |
21366
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2450 static void |
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2451 signed_on_cb(PurpleConnection *gc, |
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2452 gpointer unused) |
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2453 { |
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2454 PurpleAccount *account = purple_connection_get_account(gc); |
21390
aa52a0a224be
Add purple_account_clear_current_error(), which does what it says on the tin.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21379
diff
changeset
|
2455 purple_account_clear_current_error(account); |
21366
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2456 } |
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2457 |
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2458 static void |
22500
89a036334991
Register and unregister the PurpleConnectionErrorInfo pointers with dbus, I
Etan Reisner <pidgin@unreliablesource.net>
parents:
22231
diff
changeset
|
2459 set_current_error(PurpleAccount *account, PurpleConnectionErrorInfo *new_err) |
21391
4b1088076c50
Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents:
21390
diff
changeset
|
2460 { |
22328
5fd8b4b4c6bd
I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents:
22231
diff
changeset
|
2461 PurpleAccountPrivate *priv; |
5fd8b4b4c6bd
I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents:
22231
diff
changeset
|
2462 PurpleConnectionErrorInfo *old_err; |
5fd8b4b4c6bd
I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents:
22231
diff
changeset
|
2463 |
5fd8b4b4c6bd
I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents:
22231
diff
changeset
|
2464 g_return_if_fail(account != NULL); |
5fd8b4b4c6bd
I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents:
22231
diff
changeset
|
2465 |
5fd8b4b4c6bd
I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents:
22231
diff
changeset
|
2466 priv = PURPLE_ACCOUNT_GET_PRIVATE(account); |
5fd8b4b4c6bd
I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents:
22231
diff
changeset
|
2467 old_err = priv->current_error; |
21391
4b1088076c50
Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents:
21390
diff
changeset
|
2468 |
4b1088076c50
Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents:
21390
diff
changeset
|
2469 if(new_err == old_err) |
4b1088076c50
Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents:
21390
diff
changeset
|
2470 return; |
4b1088076c50
Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents:
21390
diff
changeset
|
2471 |
4b1088076c50
Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents:
21390
diff
changeset
|
2472 priv->current_error = new_err; |
4b1088076c50
Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents:
21390
diff
changeset
|
2473 |
4b1088076c50
Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents:
21390
diff
changeset
|
2474 purple_signal_emit(purple_accounts_get_handle(), |
4b1088076c50
Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents:
21390
diff
changeset
|
2475 "account-error-changed", |
4b1088076c50
Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents:
21390
diff
changeset
|
2476 account, old_err, new_err); |
21393
6f3f3ed7bd7f
Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21391
diff
changeset
|
2477 schedule_accounts_save(); |
21391
4b1088076c50
Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents:
21390
diff
changeset
|
2478 |
4b1088076c50
Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents:
21390
diff
changeset
|
2479 if(old_err) |
4b1088076c50
Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents:
21390
diff
changeset
|
2480 g_free(old_err->description); |
4b1088076c50
Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents:
21390
diff
changeset
|
2481 |
22500
89a036334991
Register and unregister the PurpleConnectionErrorInfo pointers with dbus, I
Etan Reisner <pidgin@unreliablesource.net>
parents:
22231
diff
changeset
|
2482 PURPLE_DBUS_UNREGISTER_POINTER(old_err); |
21391
4b1088076c50
Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents:
21390
diff
changeset
|
2483 g_free(old_err); |
4b1088076c50
Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents:
21390
diff
changeset
|
2484 } |
4b1088076c50
Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents:
21390
diff
changeset
|
2485 |
4b1088076c50
Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents:
21390
diff
changeset
|
2486 static void |
21366
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2487 connection_error_cb(PurpleConnection *gc, |
21391
4b1088076c50
Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents:
21390
diff
changeset
|
2488 PurpleConnectionError type, |
4b1088076c50
Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents:
21390
diff
changeset
|
2489 const gchar *description, |
21366
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2490 gpointer unused) |
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2491 { |
22328
5fd8b4b4c6bd
I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents:
22231
diff
changeset
|
2492 PurpleAccount *account; |
5fd8b4b4c6bd
I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents:
22231
diff
changeset
|
2493 PurpleConnectionErrorInfo *err; |
5fd8b4b4c6bd
I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents:
22231
diff
changeset
|
2494 |
5fd8b4b4c6bd
I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents:
22231
diff
changeset
|
2495 account = purple_connection_get_account(gc); |
5fd8b4b4c6bd
I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents:
22231
diff
changeset
|
2496 |
5fd8b4b4c6bd
I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents:
22231
diff
changeset
|
2497 g_return_if_fail(account != NULL); |
5fd8b4b4c6bd
I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents:
22231
diff
changeset
|
2498 |
5fd8b4b4c6bd
I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents:
22231
diff
changeset
|
2499 err = g_new0(PurpleConnectionErrorInfo, 1); |
22503
e62b3625cc54
Add this back, the merge lost it.
Etan Reisner <pidgin@unreliablesource.net>
parents:
22501
diff
changeset
|
2500 PURPLE_DBUS_REGISTER_POINTER(err, PurpleConnectionErrorInfo); |
21391
4b1088076c50
Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents:
21390
diff
changeset
|
2501 |
4b1088076c50
Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents:
21390
diff
changeset
|
2502 err->type = type; |
4b1088076c50
Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents:
21390
diff
changeset
|
2503 err->description = g_strdup(description); |
4b1088076c50
Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents:
21390
diff
changeset
|
2504 |
4b1088076c50
Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents:
21390
diff
changeset
|
2505 set_current_error(account, err); |
21366
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2506 } |
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2507 |
21377
872068d10eab
Mark pointed out that PurpleConnectionErrorPair is not a very good name for the
Will Thompson <will.thompson@collabora.co.uk>
parents:
21374
diff
changeset
|
2508 const PurpleConnectionErrorInfo * |
21366
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2509 purple_account_get_current_error(PurpleAccount *account) |
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2510 { |
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2511 PurpleAccountPrivate *priv = PURPLE_ACCOUNT_GET_PRIVATE(account); |
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2512 return priv->current_error; |
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2513 } |
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2514 |
21419
9fe16ecaa4ab
Propagating ipp to im.pidgin.cpw.resiak.disconnectreason caused
Will Thompson <will.thompson@collabora.co.uk>
parents:
21418
diff
changeset
|
2515 void |
9fe16ecaa4ab
Propagating ipp to im.pidgin.cpw.resiak.disconnectreason caused
Will Thompson <will.thompson@collabora.co.uk>
parents:
21418
diff
changeset
|
2516 purple_account_clear_current_error(PurpleAccount *account) |
21390
aa52a0a224be
Add purple_account_clear_current_error(), which does what it says on the tin.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21379
diff
changeset
|
2517 { |
21419
9fe16ecaa4ab
Propagating ipp to im.pidgin.cpw.resiak.disconnectreason caused
Will Thompson <will.thompson@collabora.co.uk>
parents:
21418
diff
changeset
|
2518 set_current_error(account, NULL); |
21390
aa52a0a224be
Add purple_account_clear_current_error(), which does what it says on the tin.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21379
diff
changeset
|
2519 } |
21419
9fe16ecaa4ab
Propagating ipp to im.pidgin.cpw.resiak.disconnectreason caused
Will Thompson <will.thompson@collabora.co.uk>
parents:
21418
diff
changeset
|
2520 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2521 void |
15823 | 2522 purple_accounts_add(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2523 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2524 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2525 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2526 if (g_list_find(accounts, account) != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2527 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2528 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2529 accounts = g_list_append(accounts, account); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2530 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2531 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2532 |
15823 | 2533 purple_signal_emit(purple_accounts_get_handle(), "account-added", account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2534 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2535 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2536 void |
15823 | 2537 purple_accounts_remove(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2538 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2539 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2540 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2541 accounts = g_list_remove(accounts, account); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2542 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2543 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2544 |
21379
30a532b14003
Document exactly how long the PurpleConnectionErrorInfo pointers given out by
Will Thompson <will.thompson@collabora.co.uk>
parents:
21377
diff
changeset
|
2545 /* Clearing the error ensures that account-error-changed is emitted, |
30a532b14003
Document exactly how long the PurpleConnectionErrorInfo pointers given out by
Will Thompson <will.thompson@collabora.co.uk>
parents:
21377
diff
changeset
|
2546 * which is the end of the guarantee that the the error's pointer is |
30a532b14003
Document exactly how long the PurpleConnectionErrorInfo pointers given out by
Will Thompson <will.thompson@collabora.co.uk>
parents:
21377
diff
changeset
|
2547 * valid. |
30a532b14003
Document exactly how long the PurpleConnectionErrorInfo pointers given out by
Will Thompson <will.thompson@collabora.co.uk>
parents:
21377
diff
changeset
|
2548 */ |
21390
aa52a0a224be
Add purple_account_clear_current_error(), which does what it says on the tin.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21379
diff
changeset
|
2549 purple_account_clear_current_error(account); |
15823 | 2550 purple_signal_emit(purple_accounts_get_handle(), "account-removed", account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2551 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2552 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2553 void |
15823 | 2554 purple_accounts_delete(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2555 { |
15823 | 2556 PurpleBlistNode *gnode, *cnode, *bnode; |
18452
45865fb3f4f9
Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18118
diff
changeset
|
2557 GList *iter; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2558 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2559 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2560 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2561 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2562 * Disable the account before blowing it out of the water. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2563 * Conceptually it probably makes more sense to disable the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2564 * account for all UIs rather than the just the current UI, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2565 * but it doesn't really matter. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2566 */ |
15823 | 2567 purple_account_set_enabled(account, purple_core_get_ui(), FALSE); |
2568 | |
2569 purple_notify_close_with_handle(account); | |
2570 purple_request_close_with_handle(account); | |
2571 | |
2572 purple_accounts_remove(account); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2573 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2574 /* Remove this account's buddies */ |
25299
5ebfa814b9e8
Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents:
24292
diff
changeset
|
2575 for (gnode = purple_blist_get_root(); |
5ebfa814b9e8
Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents:
24292
diff
changeset
|
2576 gnode != NULL; |
5ebfa814b9e8
Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents:
24292
diff
changeset
|
2577 gnode = purple_blist_node_get_sibling_next(gnode)) |
5ebfa814b9e8
Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents:
24292
diff
changeset
|
2578 { |
15823 | 2579 if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2580 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2581 |
25299
5ebfa814b9e8
Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents:
24292
diff
changeset
|
2582 cnode = purple_blist_node_get_first_child(gnode); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2583 while (cnode) { |
25299
5ebfa814b9e8
Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents:
24292
diff
changeset
|
2584 PurpleBlistNode *cnode_next = purple_blist_node_get_sibling_next(cnode); |
15823 | 2585 |
2586 if(PURPLE_BLIST_NODE_IS_CONTACT(cnode)) { | |
25299
5ebfa814b9e8
Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents:
24292
diff
changeset
|
2587 bnode = purple_blist_node_get_first_child(cnode); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2588 while (bnode) { |
25299
5ebfa814b9e8
Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents:
24292
diff
changeset
|
2589 PurpleBlistNode *bnode_next = purple_blist_node_get_sibling_next(bnode); |
15823 | 2590 |
2591 if (PURPLE_BLIST_NODE_IS_BUDDY(bnode)) { | |
2592 PurpleBuddy *b = (PurpleBuddy *)bnode; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2593 |
25299
5ebfa814b9e8
Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents:
24292
diff
changeset
|
2594 if (purple_buddy_get_account(b) == account) |
15823 | 2595 purple_blist_remove_buddy(b); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2596 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2597 bnode = bnode_next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2598 } |
15823 | 2599 } else if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) { |
2600 PurpleChat *c = (PurpleChat *)cnode; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2601 |
25299
5ebfa814b9e8
Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents:
24292
diff
changeset
|
2602 if (purple_chat_get_account(c) == account) |
15823 | 2603 purple_blist_remove_chat(c); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2604 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2605 cnode = cnode_next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2606 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2607 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2608 |
18452
45865fb3f4f9
Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18118
diff
changeset
|
2609 /* Remove any open conversation for this account */ |
45865fb3f4f9
Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18118
diff
changeset
|
2610 for (iter = purple_get_conversations(); iter; ) { |
45865fb3f4f9
Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18118
diff
changeset
|
2611 PurpleConversation *conv = iter->data; |
45865fb3f4f9
Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18118
diff
changeset
|
2612 iter = iter->next; |
45865fb3f4f9
Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18118
diff
changeset
|
2613 if (purple_conversation_get_account(conv) == account) |
45865fb3f4f9
Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18118
diff
changeset
|
2614 purple_conversation_destroy(conv); |
45865fb3f4f9
Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18118
diff
changeset
|
2615 } |
45865fb3f4f9
Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18118
diff
changeset
|
2616 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2617 /* Remove this account's pounces */ |
15823 | 2618 purple_pounce_destroy_all_by_account(account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2619 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2620 /* This will cause the deletion of an old buddy icon. */ |
16390
4fc51a87ce42
Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@wiktel.com>
parents:
16068
diff
changeset
|
2621 purple_buddy_icons_set_account_icon(account, NULL, 0); |
15823 | 2622 |
2623 purple_account_destroy(account); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2624 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2625 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2626 void |
15823 | 2627 purple_accounts_reorder(PurpleAccount *account, gint new_index) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2628 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2629 gint index; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2630 GList *l; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2631 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2632 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2633 g_return_if_fail(new_index <= g_list_length(accounts)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2634 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2635 index = g_list_index(accounts, account); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2636 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2637 if (index == -1) { |
15823 | 2638 purple_debug_error("account", |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2639 "Unregistered account (%s) discovered during reorder!\n", |
15823 | 2640 purple_account_get_username(account)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2641 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2642 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2643 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2644 l = g_list_nth(accounts, index); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2645 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2646 if (new_index > index) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2647 new_index--; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2648 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2649 /* Remove the old one. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2650 accounts = g_list_delete_link(accounts, l); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2651 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2652 /* Insert it where it should go. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2653 accounts = g_list_insert(accounts, account, new_index); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2654 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2655 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2656 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2657 |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
2658 GList * |
15823 | 2659 purple_accounts_get_all(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2660 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2661 return accounts; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2662 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2663 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2664 GList * |
15823 | 2665 purple_accounts_get_all_active(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2666 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2667 GList *list = NULL; |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
2668 GList *all = purple_accounts_get_all(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2669 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2670 while (all != NULL) { |
15823 | 2671 PurpleAccount *account = all->data; |
2672 | |
2673 if (purple_account_get_enabled(account, purple_core_get_ui())) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2674 list = g_list_append(list, account); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2675 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2676 all = all->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2677 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2678 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2679 return list; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2680 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2681 |
15823 | 2682 PurpleAccount * |
2683 purple_accounts_find(const char *name, const char *protocol_id) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2684 { |
15823 | 2685 PurpleAccount *account = NULL; |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
2686 GList *l; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2687 char *who; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2688 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2689 g_return_val_if_fail(name != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2690 |
15823 | 2691 for (l = purple_accounts_get_all(); l != NULL; l = l->next) { |
2692 account = (PurpleAccount *)l->data; | |
25385
a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents:
25368
diff
changeset
|
2693 if (protocol_id && !purple_strequal(account->protocol_id, protocol_id)) |
23963
d1797f30960f
An optimization for purple_accounts_find() to eliminate a malloc/free per
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22694
diff
changeset
|
2694 continue; |
15823 | 2695 |
21792
f5d8acf1c5f4
Normalize the names appropriately when searching for accounts. This should
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21778
diff
changeset
|
2696 who = g_strdup(purple_normalize(account, name)); |
25385
a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents:
25368
diff
changeset
|
2697 if (purple_strequal(purple_normalize(account, purple_account_get_username(account)), who)) { |
21792
f5d8acf1c5f4
Normalize the names appropriately when searching for accounts. This should
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21778
diff
changeset
|
2698 g_free(who); |
23963
d1797f30960f
An optimization for purple_accounts_find() to eliminate a malloc/free per
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22694
diff
changeset
|
2699 return account; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2700 } |
21792
f5d8acf1c5f4
Normalize the names appropriately when searching for accounts. This should
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21778
diff
changeset
|
2701 g_free(who); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2702 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2703 |
23963
d1797f30960f
An optimization for purple_accounts_find() to eliminate a malloc/free per
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22694
diff
changeset
|
2704 return NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2705 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2706 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2707 void |
15823 | 2708 purple_accounts_restore_current_statuses() |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2709 { |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
2710 GList *l; |
15823 | 2711 PurpleAccount *account; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2712 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2713 /* If we're not connected to the Internet right now, we bail on this */ |
15823 | 2714 if (!purple_network_is_available()) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2715 { |
27313
627d23bfdb05
Increase the logging level of some debugging messages that seemed to be a
mauro.brasil@tqi.com.br
parents:
26967
diff
changeset
|
2716 purple_debug_warning("account", "Network not connected; skipping reconnect\n"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2717 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2718 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2719 |
15823 | 2720 for (l = purple_accounts_get_all(); l != NULL; l = l->next) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2721 { |
15823 | 2722 account = (PurpleAccount *)l->data; |
2723 if (purple_account_get_enabled(account, purple_core_get_ui()) && | |
2724 (purple_presence_is_online(account->presence))) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2725 { |
15823 | 2726 purple_account_connect(account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2727 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2728 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2729 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2730 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2731 void |
15823 | 2732 purple_accounts_set_ui_ops(PurpleAccountUiOps *ops) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2733 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2734 account_ui_ops = ops; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2735 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2736 |
15823 | 2737 PurpleAccountUiOps * |
2738 purple_accounts_get_ui_ops(void) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2739 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2740 return account_ui_ops; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2741 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2742 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2743 void * |
15823 | 2744 purple_accounts_get_handle(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2745 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2746 static int handle; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2747 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2748 return &handle; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2749 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2750 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2751 void |
15823 | 2752 purple_accounts_init(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2753 { |
15823 | 2754 void *handle = purple_accounts_get_handle(); |
21366
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2755 void *conn_handle = purple_connections_get_handle(); |
15823 | 2756 |
2757 purple_signal_register(handle, "account-connecting", | |
2758 purple_marshal_VOID__POINTER, NULL, 1, | |
2759 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2760 PURPLE_SUBTYPE_ACCOUNT)); | |
2761 | |
2762 purple_signal_register(handle, "account-disabled", | |
2763 purple_marshal_VOID__POINTER, NULL, 1, | |
2764 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2765 PURPLE_SUBTYPE_ACCOUNT)); | |
2766 | |
2767 purple_signal_register(handle, "account-enabled", | |
2768 purple_marshal_VOID__POINTER, NULL, 1, | |
2769 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2770 PURPLE_SUBTYPE_ACCOUNT)); | |
2771 | |
2772 purple_signal_register(handle, "account-setting-info", | |
2773 purple_marshal_VOID__POINTER_POINTER, NULL, 2, | |
2774 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2775 PURPLE_SUBTYPE_ACCOUNT), | |
2776 purple_value_new(PURPLE_TYPE_STRING)); | |
2777 | |
2778 purple_signal_register(handle, "account-set-info", | |
2779 purple_marshal_VOID__POINTER_POINTER, NULL, 2, | |
2780 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2781 PURPLE_SUBTYPE_ACCOUNT), | |
2782 purple_value_new(PURPLE_TYPE_STRING)); | |
2783 | |
26845
76a1598ecf1c
Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents:
26776
diff
changeset
|
2784 purple_signal_register(handle, "account-created", |
76a1598ecf1c
Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents:
26776
diff
changeset
|
2785 purple_marshal_VOID__POINTER, NULL, 1, |
76a1598ecf1c
Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents:
26776
diff
changeset
|
2786 purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_ACCOUNT)); |
76a1598ecf1c
Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents:
26776
diff
changeset
|
2787 |
76a1598ecf1c
Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents:
26776
diff
changeset
|
2788 purple_signal_register(handle, "account-destroying", |
76a1598ecf1c
Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents:
26776
diff
changeset
|
2789 purple_marshal_VOID__POINTER, NULL, 1, |
76a1598ecf1c
Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents:
26776
diff
changeset
|
2790 purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_ACCOUNT)); |
76a1598ecf1c
Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents:
26776
diff
changeset
|
2791 |
15823 | 2792 purple_signal_register(handle, "account-added", |
2793 purple_marshal_VOID__POINTER, NULL, 1, | |
2794 purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_ACCOUNT)); | |
2795 | |
2796 purple_signal_register(handle, "account-removed", | |
2797 purple_marshal_VOID__POINTER, NULL, 1, | |
2798 purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_ACCOUNT)); | |
2799 | |
2800 purple_signal_register(handle, "account-status-changed", | |
2801 purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, | |
2802 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2803 PURPLE_SUBTYPE_ACCOUNT), | |
2804 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2805 PURPLE_SUBTYPE_STATUS), | |
2806 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2807 PURPLE_SUBTYPE_STATUS)); | |
2808 | |
26776
83e6e710cbf3
Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <paul@darkrain42.org>
parents:
26622
diff
changeset
|
2809 purple_signal_register(handle, "account-actions-changed", |
83e6e710cbf3
Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <paul@darkrain42.org>
parents:
26622
diff
changeset
|
2810 purple_marshal_VOID__POINTER, NULL, 1, |
83e6e710cbf3
Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <paul@darkrain42.org>
parents:
26622
diff
changeset
|
2811 purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_ACCOUNT)); |
83e6e710cbf3
Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <paul@darkrain42.org>
parents:
26622
diff
changeset
|
2812 |
15823 | 2813 purple_signal_register(handle, "account-alias-changed", |
2814 purple_marshal_VOID__POINTER_POINTER, NULL, 2, | |
2815 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2816 PURPLE_SUBTYPE_ACCOUNT), | |
2817 purple_value_new(PURPLE_TYPE_STRING)); | |
20152
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
2818 |
20178
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
2819 purple_signal_register(handle, "account-authorization-requested", |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
2820 purple_marshal_INT__POINTER_POINTER, |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
2821 purple_value_new(PURPLE_TYPE_INT), 2, |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
2822 purple_value_new(PURPLE_TYPE_SUBTYPE, |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
2823 PURPLE_SUBTYPE_ACCOUNT), |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
2824 purple_value_new(PURPLE_TYPE_STRING)); |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
2825 |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
2826 purple_signal_register(handle, "account-authorization-denied", |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
2827 purple_marshal_VOID__POINTER_POINTER, NULL, 2, |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
2828 purple_value_new(PURPLE_TYPE_SUBTYPE, |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
2829 PURPLE_SUBTYPE_ACCOUNT), |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
2830 purple_value_new(PURPLE_TYPE_STRING)); |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
2831 |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
2832 purple_signal_register(handle, "account-authorization-granted", |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
2833 purple_marshal_VOID__POINTER_POINTER, NULL, 2, |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
2834 purple_value_new(PURPLE_TYPE_SUBTYPE, |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
2835 PURPLE_SUBTYPE_ACCOUNT), |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
2836 purple_value_new(PURPLE_TYPE_STRING)); |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
2837 |
21366
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2838 purple_signal_register(handle, "account-error-changed", |
21373
cbf197042bad
Add the old error to the account-error-changed signal.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21370
diff
changeset
|
2839 purple_marshal_VOID__POINTER_POINTER_POINTER, |
cbf197042bad
Add the old error to the account-error-changed signal.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21370
diff
changeset
|
2840 NULL, 3, |
21366
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2841 purple_value_new(PURPLE_TYPE_SUBTYPE, |
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2842 PURPLE_SUBTYPE_ACCOUNT), |
21373
cbf197042bad
Add the old error to the account-error-changed signal.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21370
diff
changeset
|
2843 purple_value_new(PURPLE_TYPE_POINTER), |
21366
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2844 purple_value_new(PURPLE_TYPE_POINTER)); |
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2845 |
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2846 purple_signal_connect(conn_handle, "signed-on", handle, |
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2847 PURPLE_CALLBACK(signed_on_cb), NULL); |
21370
0aa18e21a595
Connect to connection-error in account.c so that the account error is actually
Will Thompson <will.thompson@collabora.co.uk>
parents:
21366
diff
changeset
|
2848 purple_signal_connect(conn_handle, "connection-error", handle, |
0aa18e21a595
Connect to connection-error in account.c so that the account error is actually
Will Thompson <will.thompson@collabora.co.uk>
parents:
21366
diff
changeset
|
2849 PURPLE_CALLBACK(connection_error_cb), NULL); |
21366
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2850 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2851 load_accounts(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2852 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2853 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2854 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2855 void |
15823 | 2856 purple_accounts_uninit(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2857 { |
21366
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2858 gpointer handle = purple_accounts_get_handle(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2859 if (save_timer != 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2860 { |
15823 | 2861 purple_timeout_remove(save_timer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2862 save_timer = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2863 sync_accounts(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2864 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2865 |
27439
1ae69ca12971
Unregister the account signals after destroying accounts.
Paul Aurich <paul@darkrain42.org>
parents:
27429
diff
changeset
|
2866 for (; accounts; accounts = g_list_delete_link(accounts, accounts)) |
1ae69ca12971
Unregister the account signals after destroying accounts.
Paul Aurich <paul@darkrain42.org>
parents:
27429
diff
changeset
|
2867 purple_account_destroy(accounts->data); |
1ae69ca12971
Unregister the account signals after destroying accounts.
Paul Aurich <paul@darkrain42.org>
parents:
27429
diff
changeset
|
2868 |
21366
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2869 purple_signals_disconnect_by_handle(handle); |
8858a42ca237
Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents:
21244
diff
changeset
|
2870 purple_signals_unregister_by_instance(handle); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2871 } |