Mercurial > pidgin.yaz
annotate libpurple/account.c @ 29613:e3206d6da6c7
propagate from branch 'im.pidgin.pidgin' (head bc551a0f3f61b07c37e8677925b1aeae91e849be)
to branch 'im.pidgin.pidgin.next.minor' (head 6d87b28fb7d202e9e5cf6700c99d9f140fdcd245)
author | John Bailey <rekkanoryo@rekkanoryo.org> |
---|---|
date | Sat, 31 Oct 2009 17:52:54 +0000 |
parents | a4e4d27fb810 e0223ad82ca1 |
children | dcd52d2b1b97 |
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 | |
28815
e0223ad82ca1
account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <paul@darkrain42.org>
parents:
28715
diff
changeset
|
1053 while (account->deny) { |
e0223ad82ca1
account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <paul@darkrain42.org>
parents:
28715
diff
changeset
|
1054 g_free(account->deny->data); |
e0223ad82ca1
account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <paul@darkrain42.org>
parents:
28715
diff
changeset
|
1055 account->deny = g_slist_delete_link(account->deny, account->deny); |
e0223ad82ca1
account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <paul@darkrain42.org>
parents:
28715
diff
changeset
|
1056 } |
e0223ad82ca1
account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <paul@darkrain42.org>
parents:
28715
diff
changeset
|
1057 |
e0223ad82ca1
account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <paul@darkrain42.org>
parents:
28715
diff
changeset
|
1058 while (account->permit) { |
e0223ad82ca1
account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <paul@darkrain42.org>
parents:
28715
diff
changeset
|
1059 g_free(account->permit->data); |
e0223ad82ca1
account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <paul@darkrain42.org>
parents:
28715
diff
changeset
|
1060 account->permit = g_slist_delete_link(account->permit, account->permit); |
e0223ad82ca1
account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <paul@darkrain42.org>
parents:
28715
diff
changeset
|
1061 } |
e0223ad82ca1
account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <paul@darkrain42.org>
parents:
28715
diff
changeset
|
1062 |
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
|
1063 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
|
1064 PURPLE_DBUS_UNREGISTER_POINTER(priv->current_error); |
28715
c4fa41bb1672
Fixing leak is nice, but let's not crash in the process.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28712
diff
changeset
|
1065 if (priv->current_error) { |
c4fa41bb1672
Fixing leak is nice, but let's not crash in the process.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28712
diff
changeset
|
1066 g_free(priv->current_error->description); |
c4fa41bb1672
Fixing leak is nice, but let's not crash in the process.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28712
diff
changeset
|
1067 g_free(priv->current_error); |
c4fa41bb1672
Fixing leak is nice, but let's not crash in the process.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28712
diff
changeset
|
1068 } |
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
|
1069 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
|
1070 |
15823 | 1071 PURPLE_DBUS_UNREGISTER_POINTER(account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1072 g_free(account); |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1075 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
|
1076 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
|
1077 { |
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
|
1078 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
|
1079 |
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
|
1080 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
|
1081 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
|
1082 } |
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
|
1083 |
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
|
1084 void |
15823 | 1085 purple_account_register(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1086 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1087 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1088 |
15823 | 1089 purple_debug_info("account", "Registering account %s\n", |
1090 purple_account_get_username(account)); | |
1091 | |
24292
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
23963
diff
changeset
|
1092 _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
|
1093 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1094 |
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
|
1095 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
|
1096 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
|
1097 { |
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
|
1098 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
|
1099 |
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
|
1100 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
|
1101 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
|
1102 |
24292
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
23963
diff
changeset
|
1103 _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
|
1104 } |
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
|
1105 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1106 static void |
15823 | 1107 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
|
1108 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1109 const char *entry; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1110 gboolean remember; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1111 |
15823 | 1112 entry = purple_request_fields_get_string(fields, "password"); |
1113 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
|
1114 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1115 if (!entry || !*entry) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1116 { |
15823 | 1117 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
|
1118 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1119 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1120 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1121 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
|
1122 purple_account_set_remember_password(account, TRUE); |
15823 | 1123 |
1124 purple_account_set_password(account, entry); | |
1125 | |
24292
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
23963
diff
changeset
|
1126 _purple_connection_new(account, FALSE, entry); |
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 |
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
|
1129 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
|
1130 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
|
1131 { |
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
|
1132 /* 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
|
1133 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
|
1134 } |
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
|
1135 |
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
|
1136 |
16068
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1137 void |
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1138 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
|
1139 GCallback cancel_cb, void *user_data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1140 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1141 gchar *primary; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1142 const gchar *username; |
15823 | 1143 PurpleRequestFieldGroup *group; |
1144 PurpleRequestField *field; | |
1145 PurpleRequestFields *fields; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1146 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1147 /* Close any previous password request windows */ |
15823 | 1148 purple_request_close_with_handle(account); |
1149 | |
1150 username = purple_account_get_username(account); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1151 primary = g_strdup_printf(_("Enter password for %s (%s)"), username, |
15823 | 1152 purple_account_get_protocol_name(account)); |
1153 | |
1154 fields = purple_request_fields_new(); | |
1155 group = purple_request_field_group_new(NULL); | |
1156 purple_request_fields_add_group(fields, group); | |
1157 | |
1158 field = purple_request_field_string_new("password", _("Enter Password"), NULL, FALSE); | |
1159 purple_request_field_string_set_masked(field, TRUE); | |
1160 purple_request_field_set_required(field, TRUE); | |
1161 purple_request_field_group_add_field(group, field); | |
1162 | |
1163 field = purple_request_field_bool_new("remember", _("Save password"), FALSE); | |
1164 purple_request_field_group_add_field(group, field); | |
1165 | |
1166 purple_request_fields(account, | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1167 NULL, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1168 primary, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1169 NULL, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1170 fields, |
16068
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1171 _("OK"), ok_cb, |
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1172 _("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
|
1173 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
|
1174 user_data); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1175 g_free(primary); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1176 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1177 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1178 void |
15823 | 1179 purple_account_connect(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1180 { |
15823 | 1181 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
|
1182 const char *password, *username; |
15823 | 1183 PurplePluginProtocolInfo *prpl_info; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1184 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1185 g_return_if_fail(account != NULL); |
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 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
|
1188 |
a3595b330671
Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <pidgin@unreliablesource.net>
parents:
25415
diff
changeset
|
1189 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
|
1190 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
|
1191 "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
|
1192 username); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1193 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
|
1194 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1195 |
15823 | 1196 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
|
1197 if (prpl == NULL) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1198 gchar *message; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1199 |
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
|
1200 message = g_strdup_printf(_("Missing protocol plugin for %s"), username); |
15823 | 1201 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
|
1202 g_free(message); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1203 return; |
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 |
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
|
1206 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
|
1207 |
15823 | 1208 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
1209 password = purple_account_get_password(account); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1210 if ((password == NULL) && |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1211 !(prpl_info->options & OPT_PROTO_NO_PASSWORD) && |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1212 !(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
|
1213 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
|
1214 else |
24292
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
23963
diff
changeset
|
1215 _purple_connection_new(account, FALSE, password); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1216 } |
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 void |
15823 | 1219 purple_account_disconnect(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1220 { |
15823 | 1221 PurpleConnection *gc; |
28442
3896cbf6336a
Display the username in the debug log when disconnecting an account.
Paul Aurich <paul@darkrain42.org>
parents:
28035
diff
changeset
|
1222 const char *username; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1223 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1224 g_return_if_fail(account != NULL); |
15823 | 1225 g_return_if_fail(!purple_account_is_disconnected(account)); |
1226 | |
28442
3896cbf6336a
Display the username in the debug log when disconnecting an account.
Paul Aurich <paul@darkrain42.org>
parents:
28035
diff
changeset
|
1227 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
|
1228 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
|
1229 username ? username : "(null)", account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1230 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1231 account->disconnecting = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1232 |
15823 | 1233 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
|
1234 _purple_connection_destroy(gc); |
15823 | 1235 if (!purple_account_get_remember_password(account)) |
1236 purple_account_set_password(account, NULL); | |
1237 purple_account_set_connection(account, NULL); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1238 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1239 account->disconnecting = FALSE; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1242 void |
15823 | 1243 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
|
1244 const char *id, const char *alias, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1245 const char *message) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1246 { |
15823 | 1247 PurpleAccountUiOps *ui_ops; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1248 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1249 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1250 g_return_if_fail(remote_user != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1251 |
15823 | 1252 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
|
1253 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1254 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
|
1255 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
|
1256 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1257 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1258 void |
15823 | 1259 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
|
1260 const char *id, const char *alias, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1261 const char *message) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1262 { |
15823 | 1263 PurpleAccountUiOps *ui_ops; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1264 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1265 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1266 g_return_if_fail(remote_user != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1267 |
15823 | 1268 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
|
1269 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1270 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
|
1271 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
|
1272 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1273 |
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
|
1274 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
|
1275 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
|
1276 { |
98ec72f8f3cc
Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24607
diff
changeset
|
1277 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
|
1278 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
|
1279 |
98ec72f8f3cc
Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24607
diff
changeset
|
1280 /* 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
|
1281 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
|
1282 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
|
1283 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
|
1284 } |
98ec72f8f3cc
Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24607
diff
changeset
|
1285 |
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
|
1286 static void |
15823 | 1287 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
|
1288 { |
15823 | 1289 PurpleAccountUiOps *ops; |
1290 | |
1291 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
|
1292 |
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 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
|
1294 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
|
1295 |
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
|
1296 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
|
1297 } |
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 |
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
|
1299 void |
15823 | 1300 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
|
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 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
|
1303 |
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
|
1304 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
|
1305 |
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
|
1306 for (l = handles; l != NULL; l = l_next) { |
15823 | 1307 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
|
1308 |
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
|
1309 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
|
1310 |
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
|
1311 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
|
1312 handles = g_list_remove(handles, info); |
15823 | 1313 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
|
1314 } |
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 } |
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
|
1316 } |
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 |
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
|
1318 void |
15823 | 1319 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
|
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 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
|
1322 |
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
|
1323 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
|
1324 |
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
|
1325 for (l = handles; l != NULL; l = l_next) { |
15823 | 1326 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
|
1327 |
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
|
1328 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
|
1329 |
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
|
1330 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
|
1331 handles = g_list_remove(handles, info); |
15823 | 1332 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
|
1333 } |
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
|
1334 } |
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
|
1335 } |
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
|
1336 |
20178
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1337 static void |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1338 request_auth_cb(void *data) |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1339 { |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1340 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
|
1341 |
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
|
1342 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
|
1343 |
20178
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1344 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
|
1345 |
20178
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1346 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
|
1347 "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
|
1348 |
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
|
1349 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
|
1350 } |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1351 |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1352 static void |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1353 request_deny_cb(void *data) |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1354 { |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1355 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
|
1356 |
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
|
1357 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
|
1358 |
20178
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1359 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
|
1360 |
20178
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1361 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
|
1362 "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
|
1363 |
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
|
1364 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
|
1365 } |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1366 |
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 void * |
15823 | 1368 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
|
1369 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
|
1370 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
|
1371 { |
15823 | 1372 PurpleAccountUiOps *ui_ops; |
1373 PurpleAccountRequestInfo *info; | |
20178
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1374 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
|
1375 |
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
|
1376 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
|
1377 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
|
1378 |
15823 | 1379 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
|
1380 |
20178
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1381 plugin_return = GPOINTER_TO_INT( |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1382 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
|
1383 "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
|
1384 |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1385 if (plugin_return > 0) { |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1386 auth_cb(user_data); |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1387 return NULL; |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1388 } else if (plugin_return < 0) { |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1389 deny_cb(user_data); |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1390 return NULL; |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1391 } |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1392 |
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
|
1393 if (ui_ops != NULL && ui_ops->request_authorize != NULL) { |
15823 | 1394 info = g_new0(PurpleAccountRequestInfo, 1); |
1395 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
|
1396 info->account = account; |
20178
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1397 info->auth_cb = auth_cb; |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1398 info->deny_cb = deny_cb; |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1399 info->userdata = user_data; |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
1400 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
|
1401 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
|
1402 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
|
1403 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
|
1404 |
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
|
1405 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
|
1406 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
|
1407 |
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
|
1408 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
|
1409 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
|
1410 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
|
1411 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
|
1412 } |
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
|
1413 } |
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
|
1414 |
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
|
1415 return NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1416 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1417 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1418 static void |
15823 | 1419 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
|
1420 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1421 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
|
1422 |
15823 | 1423 orig_pass = purple_request_fields_get_string(fields, "password"); |
1424 new_pass_1 = purple_request_fields_get_string(fields, "new_password_1"); | |
1425 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
|
1426 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1427 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
|
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 _("New passwords do not match."), NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1431 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1432 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1433 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1434 |
22694
7097bbac4234
Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents:
22503
diff
changeset
|
1435 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
|
1436 (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
|
1437 (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
|
1438 (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
|
1439 (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
|
1440 (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
|
1441 { |
15823 | 1442 purple_notify_error(account, NULL, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1443 _("Fill out all fields completely."), NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1444 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1445 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1446 |
15823 | 1447 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
|
1448 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1449 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1450 void |
15823 | 1451 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
|
1452 { |
15823 | 1453 PurpleRequestFields *fields; |
1454 PurpleRequestFieldGroup *group; | |
1455 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
|
1456 PurpleConnection *gc; |
7097bbac4234
Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents:
22503
diff
changeset
|
1457 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
|
1458 PurplePluginProtocolInfo *prpl_info = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1459 char primary[256]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1460 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1461 g_return_if_fail(account != NULL); |
15823 | 1462 g_return_if_fail(purple_account_is_connected(account)); |
1463 | |
22694
7097bbac4234
Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents:
22503
diff
changeset
|
1464 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
|
1465 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
|
1466 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
|
1467 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
|
1468 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
|
1469 |
15823 | 1470 fields = purple_request_fields_new(); |
1471 | |
1472 group = purple_request_field_group_new(NULL); | |
1473 purple_request_fields_add_group(fields, group); | |
1474 | |
1475 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
|
1476 NULL, FALSE); |
15823 | 1477 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
|
1478 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
|
1479 purple_request_field_set_required(field, TRUE); |
15823 | 1480 purple_request_field_group_add_field(group, field); |
1481 | |
1482 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
|
1483 _("New password"), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1484 NULL, FALSE); |
15823 | 1485 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
|
1486 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
|
1487 purple_request_field_set_required(field, TRUE); |
15823 | 1488 purple_request_field_group_add_field(group, field); |
1489 | |
1490 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
|
1491 _("New password (again)"), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1492 NULL, FALSE); |
15823 | 1493 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
|
1494 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
|
1495 purple_request_field_set_required(field, TRUE); |
15823 | 1496 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
|
1497 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1498 g_snprintf(primary, sizeof(primary), _("Change password for %s"), |
15823 | 1499 purple_account_get_username(account)); |
15374
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 /* 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
|
1502 |
15823 | 1503 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
|
1504 NULL, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1505 primary, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1506 _("Please enter your current password and your " |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1507 "new password."), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1508 fields, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1509 _("OK"), G_CALLBACK(change_password_cb), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1510 _("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
|
1511 account, NULL, NULL, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1512 account); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1513 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1514 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1515 static void |
15823 | 1516 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
|
1517 { |
15823 | 1518 PurpleConnection *gc; |
1519 | |
1520 purple_account_set_user_info(account, user_info); | |
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 serv_set_info(gc, user_info); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1523 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1524 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1525 void |
15823 | 1526 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
|
1527 { |
15823 | 1528 PurpleConnection *gc; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1529 char primary[256]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1530 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1531 g_return_if_fail(account != NULL); |
15823 | 1532 g_return_if_fail(purple_account_is_connected(account)); |
1533 | |
1534 gc = purple_account_get_connection(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 g_snprintf(primary, sizeof(primary), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1537 _("Change user information for %s"), |
15823 | 1538 purple_account_get_username(account)); |
1539 | |
1540 purple_request_input(gc, _("Set User Info"), primary, NULL, | |
1541 purple_account_get_user_info(account), | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1542 TRUE, FALSE, ((gc != NULL) && |
15823 | 1543 (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
|
1544 _("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
|
1545 _("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
|
1546 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
|
1547 account); |
15374
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1550 void |
15823 | 1551 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
|
1552 { |
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
|
1553 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
|
1554 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1555 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1556 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1557 g_free(account->username); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1558 account->username = g_strdup(username); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1559 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1560 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1561 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1562 /* 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
|
1563 * 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
|
1564 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
|
1565 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
|
1566 blist_ops->save_account(account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1567 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1568 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1569 void |
15823 | 1570 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
|
1571 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1572 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1573 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1574 g_free(account->password); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1575 account->password = g_strdup(password); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1576 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1577 schedule_accounts_save(); |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1580 void |
15823 | 1581 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
|
1582 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1583 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1584 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1585 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1586 * 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
|
1587 * they're the exact same string. |
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 if (alias == account->alias) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1590 return; |
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 if ((!alias && account->alias) || (alias && !account->alias) || |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1593 g_utf8_collate(account->alias, alias)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1594 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1595 char *old = account->alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1596 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1597 account->alias = g_strdup(alias); |
15823 | 1598 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
|
1599 account, old); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1600 g_free(old); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1601 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1602 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1603 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1604 } |
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 void |
15823 | 1607 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
|
1608 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1609 g_return_if_fail(account != NULL); |
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 g_free(account->user_info); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1612 account->user_info = g_strdup(user_info); |
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 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1615 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1616 |
15823 | 1617 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
|
1618 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1619 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1620 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1621 g_free(account->buddy_icon_path); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1622 account->buddy_icon_path = g_strdup(path); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1623 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1624 schedule_accounts_save(); |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1627 void |
15823 | 1628 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
|
1629 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1630 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1631 g_return_if_fail(protocol_id != NULL); |
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 g_free(account->protocol_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1634 account->protocol_id = g_strdup(protocol_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1635 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1636 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1637 } |
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 void |
15823 | 1640 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
|
1641 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1642 g_return_if_fail(account != NULL); |
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 account->gc = gc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1645 } |
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 void |
15823 | 1648 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
|
1649 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1650 g_return_if_fail(account != NULL); |
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 account->remember_pass = value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1653 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1654 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1655 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1656 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1657 void |
15823 | 1658 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
|
1659 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1660 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1661 |
15823 | 1662 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
|
1663 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1664 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1665 void |
15823 | 1666 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
|
1667 gboolean value) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1668 { |
15823 | 1669 PurpleConnection *gc; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1670 gboolean was_enabled = FALSE; |
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 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1673 g_return_if_fail(ui != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1674 |
15823 | 1675 was_enabled = purple_account_get_enabled(account, ui); |
1676 | |
1677 purple_account_set_ui_bool(account, ui, "auto-login", value); | |
1678 gc = purple_account_get_connection(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 if(was_enabled && !value) |
15823 | 1681 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
|
1682 else if(!was_enabled && value) |
15823 | 1683 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
|
1684 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1685 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
|
1686 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1687 |
15823 | 1688 if (value && purple_presence_is_online(account->presence)) |
1689 purple_account_connect(account); | |
1690 else if (!value && !purple_account_is_disconnected(account)) | |
1691 purple_account_disconnect(account); | |
15374
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_proxy_info(PurpleAccount *account, PurpleProxyInfo *info) |
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 if (account->proxy_info != NULL) |
15823 | 1700 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
|
1701 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1702 account->proxy_info = info; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1703 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1704 schedule_accounts_save(); |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1707 void |
15823 | 1708 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
|
1709 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1710 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1711 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1712 /* Out with the old... */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1713 if (account->status_types != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1714 { |
15823 | 1715 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
|
1716 g_list_free(account->status_types); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1717 } |
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 /* In with the new... */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1720 account->status_types = status_types; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1723 void |
15823 | 1724 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
|
1725 gboolean active, ...) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1726 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1727 GList *attrs = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1728 const gchar *id; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1729 gpointer data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1730 va_list args; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1731 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1732 va_start(args, active); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1733 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
|
1734 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1735 attrs = g_list_append(attrs, (char *)id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1736 data = va_arg(args, void *); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1737 attrs = g_list_append(attrs, data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1738 } |
15823 | 1739 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
|
1740 g_list_free(attrs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1741 va_end(args); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1742 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1743 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1744 void |
15823 | 1745 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
|
1746 gboolean active, GList *attrs) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1747 { |
15823 | 1748 PurpleStatus *status; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1749 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1750 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1751 g_return_if_fail(status_id != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1752 |
15823 | 1753 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
|
1754 if (status == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1755 { |
15823 | 1756 purple_debug_error("account", |
21937
8daec0ca3218
Infinitesimally better debug message
Mark Doliner <mark@kingant.net>
parents:
21846
diff
changeset
|
1757 "Invalid status ID '%s' for account %s (%s)\n", |
15823 | 1758 status_id, purple_account_get_username(account), |
1759 purple_account_get_protocol_id(account)); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1760 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1761 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1762 |
15823 | 1763 if (active || purple_status_is_independent(status)) |
1764 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
|
1765 |
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 * 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
|
1768 * 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
|
1769 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1770 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1771 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1772 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1773 void |
15823 | 1774 purple_account_clear_settings(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1775 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1776 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1777 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1778 g_hash_table_destroy(account->settings); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1779 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1780 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
|
1781 g_free, delete_setting); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1782 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1783 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1784 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
|
1785 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
|
1786 { |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
1787 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
|
1788 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
|
1789 |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
1790 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
|
1791 } |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
1792 |
87586d7bdbbd
Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27313
diff
changeset
|
1793 void |
15823 | 1794 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
|
1795 { |
15823 | 1796 PurpleAccountSetting *setting; |
15374
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 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1799 g_return_if_fail(name != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1800 |
15823 | 1801 setting = g_new0(PurpleAccountSetting, 1); |
1802 | |
1803 setting->type = PURPLE_PREF_INT; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1804 setting->value.integer = value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1805 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1806 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
|
1807 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1808 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1809 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1810 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1811 void |
15823 | 1812 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
|
1813 const char *value) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1814 { |
15823 | 1815 PurpleAccountSetting *setting; |
15374
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 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1818 g_return_if_fail(name != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1819 |
15823 | 1820 setting = g_new0(PurpleAccountSetting, 1); |
1821 | |
1822 setting->type = PURPLE_PREF_STRING; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1823 setting->value.string = g_strdup(value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1824 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1825 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
|
1826 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1827 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1828 } |
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 void |
15823 | 1831 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
|
1832 { |
15823 | 1833 PurpleAccountSetting *setting; |
15374
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 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1836 g_return_if_fail(name != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1837 |
15823 | 1838 setting = g_new0(PurpleAccountSetting, 1); |
1839 | |
1840 setting->type = PURPLE_PREF_BOOLEAN; | |
20354
01101467094f
applied changes from 7a436ba53de6adebccf4e920ca62d544e13b1094
Luke Schierer <lschiere@pidgin.im>
parents:
20251
diff
changeset
|
1841 setting->value.boolean = value; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1842 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1843 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
|
1844 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1845 schedule_accounts_save(); |
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 static GHashTable * |
15823 | 1849 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
|
1850 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1851 GHashTable *table; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1852 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1853 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
|
1854 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1855 if (table == NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1856 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
|
1857 delete_setting); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1858 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
|
1859 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1860 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1861 return table; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1862 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1863 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1864 void |
15823 | 1865 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
|
1866 const char *name, int value) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1867 { |
15823 | 1868 PurpleAccountSetting *setting; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1869 GHashTable *table; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1870 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1871 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1872 g_return_if_fail(ui != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1873 g_return_if_fail(name != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1874 |
15823 | 1875 setting = g_new0(PurpleAccountSetting, 1); |
1876 | |
1877 setting->type = PURPLE_PREF_INT; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1878 setting->ui = g_strdup(ui); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1879 setting->value.integer = value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1880 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1881 table = get_ui_settings_table(account, ui); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1882 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1883 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
|
1884 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1885 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1886 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1887 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1888 void |
15823 | 1889 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
|
1890 const char *name, const char *value) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1891 { |
15823 | 1892 PurpleAccountSetting *setting; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1893 GHashTable *table; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1894 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1895 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1896 g_return_if_fail(ui != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1897 g_return_if_fail(name != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1898 |
15823 | 1899 setting = g_new0(PurpleAccountSetting, 1); |
1900 | |
1901 setting->type = PURPLE_PREF_STRING; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1902 setting->ui = g_strdup(ui); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1903 setting->value.string = g_strdup(value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1904 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1905 table = get_ui_settings_table(account, ui); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1906 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1907 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
|
1908 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1909 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1910 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1911 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1912 void |
15823 | 1913 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
|
1914 const char *name, gboolean value) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1915 { |
15823 | 1916 PurpleAccountSetting *setting; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1917 GHashTable *table; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1918 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1919 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1920 g_return_if_fail(ui != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1921 g_return_if_fail(name != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1922 |
15823 | 1923 setting = g_new0(PurpleAccountSetting, 1); |
1924 | |
1925 setting->type = PURPLE_PREF_BOOLEAN; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1926 setting->ui = g_strdup(ui); |
20354
01101467094f
applied changes from 7a436ba53de6adebccf4e920ca62d544e13b1094
Luke Schierer <lschiere@pidgin.im>
parents:
20251
diff
changeset
|
1927 setting->value.boolean = value; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1928 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1929 table = get_ui_settings_table(account, ui); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1930 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1931 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
|
1932 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1933 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1934 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1935 |
15823 | 1936 static PurpleConnectionState |
1937 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
|
1938 { |
15823 | 1939 PurpleConnection *gc; |
1940 | |
1941 g_return_val_if_fail(account != NULL, PURPLE_DISCONNECTED); | |
1942 | |
1943 gc = purple_account_get_connection(account); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1944 if (!gc) |
15823 | 1945 return PURPLE_DISCONNECTED; |
1946 | |
1947 return purple_connection_get_state(gc); | |
15374
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1950 gboolean |
15823 | 1951 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
|
1952 { |
15823 | 1953 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
|
1954 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1955 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1956 gboolean |
15823 | 1957 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
|
1958 { |
15823 | 1959 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
|
1960 } |
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 gboolean |
15823 | 1963 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
|
1964 { |
15823 | 1965 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
|
1966 } |
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 const char * |
15823 | 1969 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
|
1970 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1971 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
|
1972 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1973 return account->username; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1974 } |
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 const char * |
15823 | 1977 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
|
1978 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1979 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
|
1980 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1981 return account->password; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1982 } |
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 const char * |
15823 | 1985 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
|
1986 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1987 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
|
1988 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1989 return account->alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1990 } |
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 const char * |
15823 | 1993 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
|
1994 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1995 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
|
1996 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1997 return account->user_info; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1998 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1999 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2000 const char * |
15823 | 2001 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
|
2002 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2003 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
|
2004 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2005 return account->buddy_icon_path; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2008 const char * |
15823 | 2009 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
|
2010 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2011 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
|
2012 return account->protocol_id; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2013 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2014 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2015 const char * |
15823 | 2016 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
|
2017 { |
15823 | 2018 PurplePlugin *p; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2019 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2020 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
|
2021 |
15823 | 2022 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
|
2023 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2024 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
|
2025 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2026 |
15823 | 2027 PurpleConnection * |
2028 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
|
2029 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2030 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
|
2031 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2032 return account->gc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2033 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2034 |
29499
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2035 const gchar * |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2036 purple_account_get_name_for_display(const PurpleAccount *account) |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2037 { |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2038 PurpleBuddy *self = NULL; |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2039 PurpleConnection *gc = NULL; |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2040 const gchar *name = NULL, *username = NULL, *displayname = NULL; |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2041 |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2042 name = purple_account_get_alias(account); |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2043 |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2044 if (name) { |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2045 return name; |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2046 } |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2047 |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2048 username = purple_account_get_username(account); |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2049 self = purple_find_buddy((PurpleAccount *)account, username); |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2050 |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2051 if (self) { |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2052 const gchar *calias= purple_buddy_get_contact_alias(self); |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2053 |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2054 /* We don't want to return the buddy name if the buddy/contact |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2055 * doesn't have an alias set. */ |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2056 if (!purple_strequal(username, calias)) { |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2057 return calias; |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2058 } |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2059 } |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2060 |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2061 gc = purple_account_get_connection(account); |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2062 displayname = purple_connection_get_display_name(gc); |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2063 |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2064 if (displayname) { |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2065 return displayname; |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2066 } |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2067 |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2068 return username; |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2069 } |
94f85ba7e5a9
This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28442
diff
changeset
|
2070 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2071 gboolean |
15823 | 2072 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
|
2073 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2074 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
|
2075 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2076 return account->remember_pass; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2077 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2078 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2079 gboolean |
15823 | 2080 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
|
2081 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2082 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
|
2083 |
15823 | 2084 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
|
2085 } |
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 gboolean |
15823 | 2088 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
|
2089 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2090 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
|
2091 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
|
2092 |
15823 | 2093 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
|
2094 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2095 |
15823 | 2096 PurpleProxyInfo * |
2097 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
|
2098 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2099 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
|
2100 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2101 return account->proxy_info; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2102 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2103 |
15823 | 2104 PurpleStatus * |
2105 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
|
2106 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2107 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
|
2108 |
15823 | 2109 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
|
2110 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2111 |
15823 | 2112 PurpleStatus * |
2113 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
|
2114 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2115 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
|
2116 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
|
2117 |
15823 | 2118 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
|
2119 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2120 |
15823 | 2121 PurpleStatusType * |
2122 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
|
2123 { |
18118
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18063
diff
changeset
|
2124 GList *l; |
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 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
|
2127 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
|
2128 |
15823 | 2129 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
|
2130 { |
15823 | 2131 PurpleStatusType *status_type = (PurpleStatusType *)l->data; |
2132 | |
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
|
2133 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
|
2134 return status_type; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2135 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2136 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2137 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2138 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2139 |
15823 | 2140 PurpleStatusType * |
2141 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
|
2142 { |
18118
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18063
diff
changeset
|
2143 GList *l; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2144 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2145 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
|
2146 |
15823 | 2147 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
|
2148 { |
15823 | 2149 PurpleStatusType *status_type = (PurpleStatusType *)l->data; |
2150 | |
2151 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
|
2152 return status_type; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2155 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2156 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2157 |
15823 | 2158 PurplePresence * |
2159 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
|
2160 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2161 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
|
2162 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2163 return account->presence; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2166 gboolean |
15823 | 2167 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
|
2168 const char *status_id) |
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 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
|
2171 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
|
2172 |
15823 | 2173 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
|
2174 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2175 |
18118
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18063
diff
changeset
|
2176 GList * |
15823 | 2177 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
|
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, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2180 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2181 return account->status_types; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2182 } |
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 int |
15823 | 2185 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
|
2186 int default_value) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2187 { |
15823 | 2188 PurpleAccountSetting *setting; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2189 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2190 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
|
2191 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
|
2192 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2193 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
|
2194 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2195 if (setting == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2196 return default_value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2197 |
15823 | 2198 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
|
2199 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2200 return setting->value.integer; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2201 } |
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 const char * |
15823 | 2204 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
|
2205 const char *default_value) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2206 { |
15823 | 2207 PurpleAccountSetting *setting; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2208 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2209 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
|
2210 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
|
2211 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2212 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
|
2213 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2214 if (setting == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2215 return default_value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2216 |
15823 | 2217 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
|
2218 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2219 return setting->value.string; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2222 gboolean |
15823 | 2223 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
|
2224 gboolean default_value) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2225 { |
15823 | 2226 PurpleAccountSetting *setting; |
15374
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 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
|
2229 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
|
2230 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2231 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
|
2232 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2233 if (setting == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2234 return default_value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2235 |
15823 | 2236 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
|
2237 |
20354
01101467094f
applied changes from 7a436ba53de6adebccf4e920ca62d544e13b1094
Luke Schierer <lschiere@pidgin.im>
parents:
20251
diff
changeset
|
2238 return setting->value.boolean; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2239 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2240 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2241 int |
15823 | 2242 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
|
2243 const char *name, int default_value) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2244 { |
15823 | 2245 PurpleAccountSetting *setting; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2246 GHashTable *table; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2247 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2248 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
|
2249 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
|
2250 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
|
2251 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2252 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
|
2253 return default_value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2254 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2255 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
|
2256 return default_value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2257 |
15823 | 2258 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
|
2259 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2260 return setting->value.integer; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2261 } |
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 const char * |
15823 | 2264 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
|
2265 const char *name, const char *default_value) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2266 { |
15823 | 2267 PurpleAccountSetting *setting; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2268 GHashTable *table; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2269 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2270 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
|
2271 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
|
2272 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
|
2273 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2274 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
|
2275 return default_value; |
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 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
|
2278 return default_value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2279 |
15823 | 2280 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
|
2281 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2282 return setting->value.string; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2283 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2284 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2285 gboolean |
15823 | 2286 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
|
2287 const char *name, gboolean default_value) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2288 { |
15823 | 2289 PurpleAccountSetting *setting; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2290 GHashTable *table; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2291 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2292 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
|
2293 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
|
2294 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
|
2295 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2296 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
|
2297 return default_value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2298 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2299 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
|
2300 return default_value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2301 |
15823 | 2302 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
|
2303 |
20354
01101467094f
applied changes from 7a436ba53de6adebccf4e920ca62d544e13b1094
Luke Schierer <lschiere@pidgin.im>
parents:
20251
diff
changeset
|
2304 return setting->value.boolean; |
15374
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 |
15823 | 2307 PurpleLog * |
2308 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
|
2309 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2310 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
|
2311 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2312 if(!account->system_log && create){ |
15823 | 2313 PurplePresence *presence; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2314 int login_time; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2315 |
15823 | 2316 presence = purple_account_get_presence(account); |
2317 login_time = purple_presence_get_login_time(presence); | |
2318 | |
2319 account->system_log = purple_log_new(PURPLE_LOG_SYSTEM, | |
2320 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
|
2321 (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
|
2322 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2323 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2324 return account->system_log; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2325 } |
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 void |
15823 | 2328 purple_account_destroy_log(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2329 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2330 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2331 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2332 if(account->system_log){ |
15823 | 2333 purple_log_free(account->system_log); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2334 account->system_log = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2335 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2336 } |
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 void |
15823 | 2339 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
|
2340 { |
15823 | 2341 PurplePluginProtocolInfo *prpl_info = NULL; |
28469
caa94dfa37f1
Add assertions to purple_account_add_buddy; a NULL buddy is very bad. Refs #10115.
Paul Aurich <paul@darkrain42.org>
parents:
28442
diff
changeset
|
2342 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
|
2343 PurplePlugin *prpl = NULL; |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2344 |
28469
caa94dfa37f1
Add assertions to purple_account_add_buddy; a NULL buddy is very bad. Refs #10115.
Paul Aurich <paul@darkrain42.org>
parents:
28442
diff
changeset
|
2345 g_return_if_fail(account != NULL); |
caa94dfa37f1
Add assertions to purple_account_add_buddy; a NULL buddy is very bad. Refs #10115.
Paul Aurich <paul@darkrain42.org>
parents:
28442
diff
changeset
|
2346 g_return_if_fail(buddy != NULL); |
caa94dfa37f1
Add assertions to purple_account_add_buddy; a NULL buddy is very bad. Refs #10115.
Paul Aurich <paul@darkrain42.org>
parents:
28442
diff
changeset
|
2347 |
caa94dfa37f1
Add assertions to purple_account_add_buddy; a NULL buddy is very bad. Refs #10115.
Paul Aurich <paul@darkrain42.org>
parents:
28442
diff
changeset
|
2348 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
|
2349 if (gc != NULL) |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2350 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
|
2351 |
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 (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
|
2353 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
|
2354 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2355 if (prpl_info != NULL && prpl_info->add_buddy != NULL) |
15823 | 2356 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
|
2357 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2358 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2359 void |
15823 | 2360 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
|
2361 { |
15823 | 2362 PurplePluginProtocolInfo *prpl_info = NULL; |
2363 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
|
2364 PurplePlugin *prpl = NULL; |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2365 |
22231
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2366 if (gc != NULL) |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2367 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
|
2368 |
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 (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
|
2370 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2371 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2372 if (prpl_info) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2373 GList *cur, *groups = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2374 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2375 /* 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
|
2376 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
|
2377 PurpleBuddy *buddy = cur->data; |
41485746e2b9
A couple of minor fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25299
diff
changeset
|
2378 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
|
2379 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2380 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2381 if (prpl_info->add_buddies != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2382 prpl_info->add_buddies(gc, buddies, groups); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2383 else if (prpl_info->add_buddy != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2384 GList *curb = buddies, *curg = groups; |
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 while ((curb != NULL) && (curg != NULL)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2387 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
|
2388 curb = curb->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2389 curg = curg->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2390 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2391 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2392 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2393 g_list_free(groups); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2394 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2395 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2396 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2397 void |
15823 | 2398 purple_account_remove_buddy(PurpleAccount *account, PurpleBuddy *buddy, |
2399 PurpleGroup *group) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2400 { |
15823 | 2401 PurplePluginProtocolInfo *prpl_info = NULL; |
2402 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
|
2403 PurplePlugin *prpl = NULL; |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2404 |
22231
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2405 if (gc != NULL) |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2406 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
|
2407 |
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2408 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
|
2409 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2410 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2411 if (prpl_info && prpl_info->remove_buddy) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2412 prpl_info->remove_buddy(gc, buddy, group); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2413 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2414 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2415 void |
15823 | 2416 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
|
2417 { |
15823 | 2418 PurplePluginProtocolInfo *prpl_info = NULL; |
2419 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
|
2420 PurplePlugin *prpl = NULL; |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2421 |
22231
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2422 if (gc != NULL) |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2423 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
|
2424 |
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2425 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
|
2426 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2427 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2428 if (prpl_info) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2429 if (prpl_info->remove_buddies) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2430 prpl_info->remove_buddies(gc, buddies, groups); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2431 else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2432 GList *curb = buddies; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2433 GList *curg = groups; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2434 while ((curb != NULL) && (curg != NULL)) { |
15823 | 2435 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
|
2436 curb = curb->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2437 curg = curg->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2438 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2439 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2440 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2441 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2442 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2443 void |
15823 | 2444 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
|
2445 { |
15823 | 2446 PurplePluginProtocolInfo *prpl_info = NULL; |
2447 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
|
2448 PurplePlugin *prpl = NULL; |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2449 |
22231
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2450 if (gc != NULL) |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2451 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
|
2452 |
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2453 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
|
2454 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
|
2455 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2456 if (prpl_info && prpl_info->remove_group) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2457 prpl_info->remove_group(gc, group); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2458 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2459 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2460 void |
15823 | 2461 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
|
2462 const char *new_pw) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2463 { |
15823 | 2464 PurplePluginProtocolInfo *prpl_info = NULL; |
2465 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
|
2466 PurplePlugin *prpl = NULL; |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2467 |
15823 | 2468 purple_account_set_password(account, new_pw); |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2469 |
22231
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2470 if (gc != NULL) |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2471 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
|
2472 |
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2473 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
|
2474 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
|
2475 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2476 if (prpl_info && prpl_info->change_passwd) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2477 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
|
2478 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2479 |
15823 | 2480 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
|
2481 { |
15823 | 2482 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
|
2483 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
|
2484 PurplePlugin *prpl = NULL; |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2485 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2486 g_return_val_if_fail(account, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2487 g_return_val_if_fail(buddy, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2488 |
15823 | 2489 gc = purple_account_get_connection(account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2490 if (gc == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2491 return FALSE; |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2492 |
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
25398
diff
changeset
|
2493 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
|
2494 |
4af9179e33df
Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
22108
diff
changeset
|
2495 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
|
2496 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
|
2497 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2498 if (!prpl_info || !prpl_info->offline_message) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2499 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2500 return prpl_info->offline_message(buddy); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2501 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2502 |
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
|
2503 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
|
2504 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
|
2505 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
|
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 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
|
2508 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
|
2509 } |
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 static void |
22500
89a036334991
Register and unregister the PurpleConnectionErrorInfo pointers with dbus, I
Etan Reisner <pidgin@unreliablesource.net>
parents:
22231
diff
changeset
|
2512 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
|
2513 { |
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
|
2514 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
|
2515 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
|
2516 |
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
|
2517 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
|
2518 |
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
|
2519 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
|
2520 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
|
2521 |
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
|
2522 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
|
2523 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
|
2524 |
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
|
2525 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
|
2526 |
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
|
2527 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
|
2528 "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
|
2529 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
|
2530 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
|
2531 |
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
|
2532 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
|
2533 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
|
2534 |
22500
89a036334991
Register and unregister the PurpleConnectionErrorInfo pointers with dbus, I
Etan Reisner <pidgin@unreliablesource.net>
parents:
22231
diff
changeset
|
2535 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
|
2536 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
|
2537 } |
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
|
2538 |
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
|
2539 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
|
2540 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
|
2541 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
|
2542 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
|
2543 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
|
2544 { |
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
|
2545 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
|
2546 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
|
2547 |
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
|
2548 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
|
2549 |
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
|
2550 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
|
2551 |
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
|
2552 err = g_new0(PurpleConnectionErrorInfo, 1); |
22503
e62b3625cc54
Add this back, the merge lost it.
Etan Reisner <pidgin@unreliablesource.net>
parents:
22501
diff
changeset
|
2553 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
|
2554 |
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
|
2555 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
|
2556 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
|
2557 |
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
|
2558 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
|
2559 } |
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
|
2560 |
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
|
2561 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
|
2562 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
|
2563 { |
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
|
2564 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
|
2565 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
|
2566 } |
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
|
2567 |
21419
9fe16ecaa4ab
Propagating ipp to im.pidgin.cpw.resiak.disconnectreason caused
Will Thompson <will.thompson@collabora.co.uk>
parents:
21418
diff
changeset
|
2568 void |
9fe16ecaa4ab
Propagating ipp to im.pidgin.cpw.resiak.disconnectreason caused
Will Thompson <will.thompson@collabora.co.uk>
parents:
21418
diff
changeset
|
2569 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
|
2570 { |
21419
9fe16ecaa4ab
Propagating ipp to im.pidgin.cpw.resiak.disconnectreason caused
Will Thompson <will.thompson@collabora.co.uk>
parents:
21418
diff
changeset
|
2571 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
|
2572 } |
21419
9fe16ecaa4ab
Propagating ipp to im.pidgin.cpw.resiak.disconnectreason caused
Will Thompson <will.thompson@collabora.co.uk>
parents:
21418
diff
changeset
|
2573 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2574 void |
15823 | 2575 purple_accounts_add(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2576 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2577 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2578 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2579 if (g_list_find(accounts, account) != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2580 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2581 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2582 accounts = g_list_append(accounts, account); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2583 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2584 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2585 |
15823 | 2586 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
|
2587 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2588 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2589 void |
15823 | 2590 purple_accounts_remove(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2591 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2592 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2593 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2594 accounts = g_list_remove(accounts, account); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2595 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2596 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2597 |
21379
30a532b14003
Document exactly how long the PurpleConnectionErrorInfo pointers given out by
Will Thompson <will.thompson@collabora.co.uk>
parents:
21377
diff
changeset
|
2598 /* 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
|
2599 * 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
|
2600 * valid. |
30a532b14003
Document exactly how long the PurpleConnectionErrorInfo pointers given out by
Will Thompson <will.thompson@collabora.co.uk>
parents:
21377
diff
changeset
|
2601 */ |
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
|
2602 purple_account_clear_current_error(account); |
15823 | 2603 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
|
2604 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2605 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2606 void |
15823 | 2607 purple_accounts_delete(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2608 { |
15823 | 2609 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
|
2610 GList *iter; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2611 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2612 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2613 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2614 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2615 * 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
|
2616 * 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
|
2617 * 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
|
2618 * but it doesn't really matter. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2619 */ |
15823 | 2620 purple_account_set_enabled(account, purple_core_get_ui(), FALSE); |
2621 | |
2622 purple_notify_close_with_handle(account); | |
2623 purple_request_close_with_handle(account); | |
2624 | |
2625 purple_accounts_remove(account); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2626 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2627 /* 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
|
2628 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
|
2629 gnode != NULL; |
5ebfa814b9e8
Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents:
24292
diff
changeset
|
2630 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
|
2631 { |
15823 | 2632 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
|
2633 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2634 |
25299
5ebfa814b9e8
Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents:
24292
diff
changeset
|
2635 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
|
2636 while (cnode) { |
25299
5ebfa814b9e8
Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents:
24292
diff
changeset
|
2637 PurpleBlistNode *cnode_next = purple_blist_node_get_sibling_next(cnode); |
15823 | 2638 |
2639 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
|
2640 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
|
2641 while (bnode) { |
25299
5ebfa814b9e8
Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents:
24292
diff
changeset
|
2642 PurpleBlistNode *bnode_next = purple_blist_node_get_sibling_next(bnode); |
15823 | 2643 |
2644 if (PURPLE_BLIST_NODE_IS_BUDDY(bnode)) { | |
2645 PurpleBuddy *b = (PurpleBuddy *)bnode; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2646 |
25299
5ebfa814b9e8
Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents:
24292
diff
changeset
|
2647 if (purple_buddy_get_account(b) == account) |
15823 | 2648 purple_blist_remove_buddy(b); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2649 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2650 bnode = bnode_next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2651 } |
15823 | 2652 } else if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) { |
2653 PurpleChat *c = (PurpleChat *)cnode; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2654 |
25299
5ebfa814b9e8
Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents:
24292
diff
changeset
|
2655 if (purple_chat_get_account(c) == account) |
15823 | 2656 purple_blist_remove_chat(c); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2657 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2658 cnode = cnode_next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2659 } |
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 |
18452
45865fb3f4f9
Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18118
diff
changeset
|
2662 /* 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
|
2663 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
|
2664 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
|
2665 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
|
2666 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
|
2667 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
|
2668 } |
45865fb3f4f9
Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18118
diff
changeset
|
2669 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2670 /* Remove this account's pounces */ |
15823 | 2671 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
|
2672 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2673 /* 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
|
2674 purple_buddy_icons_set_account_icon(account, NULL, 0); |
15823 | 2675 |
2676 purple_account_destroy(account); | |
15374
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 void |
15823 | 2680 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
|
2681 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2682 gint index; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2683 GList *l; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2684 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2685 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2686 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
|
2687 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2688 index = g_list_index(accounts, account); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2689 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2690 if (index == -1) { |
15823 | 2691 purple_debug_error("account", |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2692 "Unregistered account (%s) discovered during reorder!\n", |
15823 | 2693 purple_account_get_username(account)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2694 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2695 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2696 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2697 l = g_list_nth(accounts, index); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2698 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2699 if (new_index > index) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2700 new_index--; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2701 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2702 /* Remove the old one. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2703 accounts = g_list_delete_link(accounts, l); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2704 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2705 /* Insert it where it should go. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2706 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
|
2707 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2708 schedule_accounts_save(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2709 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2710 |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
2711 GList * |
15823 | 2712 purple_accounts_get_all(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2713 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2714 return accounts; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2715 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2716 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2717 GList * |
15823 | 2718 purple_accounts_get_all_active(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2719 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2720 GList *list = NULL; |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
2721 GList *all = purple_accounts_get_all(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2722 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2723 while (all != NULL) { |
15823 | 2724 PurpleAccount *account = all->data; |
2725 | |
2726 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
|
2727 list = g_list_append(list, account); |
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 all = all->next; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2732 return list; |
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 |
15823 | 2735 PurpleAccount * |
2736 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
|
2737 { |
15823 | 2738 PurpleAccount *account = NULL; |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
2739 GList *l; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2740 char *who; |
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 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
|
2743 |
15823 | 2744 for (l = purple_accounts_get_all(); l != NULL; l = l->next) { |
2745 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
|
2746 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
|
2747 continue; |
15823 | 2748 |
21792
f5d8acf1c5f4
Normalize the names appropriately when searching for accounts. This should
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21778
diff
changeset
|
2749 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
|
2750 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
|
2751 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
|
2752 return account; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2753 } |
21792
f5d8acf1c5f4
Normalize the names appropriately when searching for accounts. This should
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21778
diff
changeset
|
2754 g_free(who); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2755 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2756 |
23963
d1797f30960f
An optimization for purple_accounts_find() to eliminate a malloc/free per
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22694
diff
changeset
|
2757 return NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2758 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2759 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2760 void |
15823 | 2761 purple_accounts_restore_current_statuses() |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2762 { |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
2763 GList *l; |
15823 | 2764 PurpleAccount *account; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2765 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2766 /* If we're not connected to the Internet right now, we bail on this */ |
15823 | 2767 if (!purple_network_is_available()) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2768 { |
27313
627d23bfdb05
Increase the logging level of some debugging messages that seemed to be a
mauro.brasil@tqi.com.br
parents:
26967
diff
changeset
|
2769 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
|
2770 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2771 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2772 |
15823 | 2773 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
|
2774 { |
15823 | 2775 account = (PurpleAccount *)l->data; |
2776 if (purple_account_get_enabled(account, purple_core_get_ui()) && | |
2777 (purple_presence_is_online(account->presence))) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2778 { |
15823 | 2779 purple_account_connect(account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2780 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2781 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2782 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2783 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2784 void |
15823 | 2785 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
|
2786 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2787 account_ui_ops = ops; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2788 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2789 |
15823 | 2790 PurpleAccountUiOps * |
2791 purple_accounts_get_ui_ops(void) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2792 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2793 return account_ui_ops; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2794 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2795 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2796 void * |
15823 | 2797 purple_accounts_get_handle(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2798 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2799 static int handle; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2800 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2801 return &handle; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2802 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2803 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2804 void |
15823 | 2805 purple_accounts_init(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2806 { |
15823 | 2807 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
|
2808 void *conn_handle = purple_connections_get_handle(); |
15823 | 2809 |
2810 purple_signal_register(handle, "account-connecting", | |
2811 purple_marshal_VOID__POINTER, NULL, 1, | |
2812 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2813 PURPLE_SUBTYPE_ACCOUNT)); | |
2814 | |
2815 purple_signal_register(handle, "account-disabled", | |
2816 purple_marshal_VOID__POINTER, NULL, 1, | |
2817 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2818 PURPLE_SUBTYPE_ACCOUNT)); | |
2819 | |
2820 purple_signal_register(handle, "account-enabled", | |
2821 purple_marshal_VOID__POINTER, NULL, 1, | |
2822 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2823 PURPLE_SUBTYPE_ACCOUNT)); | |
2824 | |
2825 purple_signal_register(handle, "account-setting-info", | |
2826 purple_marshal_VOID__POINTER_POINTER, NULL, 2, | |
2827 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2828 PURPLE_SUBTYPE_ACCOUNT), | |
2829 purple_value_new(PURPLE_TYPE_STRING)); | |
2830 | |
2831 purple_signal_register(handle, "account-set-info", | |
2832 purple_marshal_VOID__POINTER_POINTER, NULL, 2, | |
2833 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2834 PURPLE_SUBTYPE_ACCOUNT), | |
2835 purple_value_new(PURPLE_TYPE_STRING)); | |
2836 | |
26845
76a1598ecf1c
Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents:
26776
diff
changeset
|
2837 purple_signal_register(handle, "account-created", |
76a1598ecf1c
Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents:
26776
diff
changeset
|
2838 purple_marshal_VOID__POINTER, NULL, 1, |
76a1598ecf1c
Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents:
26776
diff
changeset
|
2839 purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_ACCOUNT)); |
76a1598ecf1c
Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents:
26776
diff
changeset
|
2840 |
76a1598ecf1c
Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents:
26776
diff
changeset
|
2841 purple_signal_register(handle, "account-destroying", |
76a1598ecf1c
Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents:
26776
diff
changeset
|
2842 purple_marshal_VOID__POINTER, NULL, 1, |
76a1598ecf1c
Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents:
26776
diff
changeset
|
2843 purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_ACCOUNT)); |
76a1598ecf1c
Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents:
26776
diff
changeset
|
2844 |
15823 | 2845 purple_signal_register(handle, "account-added", |
2846 purple_marshal_VOID__POINTER, NULL, 1, | |
2847 purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_ACCOUNT)); | |
2848 | |
2849 purple_signal_register(handle, "account-removed", | |
2850 purple_marshal_VOID__POINTER, NULL, 1, | |
2851 purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_ACCOUNT)); | |
2852 | |
2853 purple_signal_register(handle, "account-status-changed", | |
2854 purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, | |
2855 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2856 PURPLE_SUBTYPE_ACCOUNT), | |
2857 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2858 PURPLE_SUBTYPE_STATUS), | |
2859 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2860 PURPLE_SUBTYPE_STATUS)); | |
2861 | |
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
|
2862 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
|
2863 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
|
2864 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
|
2865 |
15823 | 2866 purple_signal_register(handle, "account-alias-changed", |
2867 purple_marshal_VOID__POINTER_POINTER, NULL, 2, | |
2868 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2869 PURPLE_SUBTYPE_ACCOUNT), | |
2870 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
|
2871 |
20178
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
2872 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
|
2873 purple_marshal_INT__POINTER_POINTER, |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
2874 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
|
2875 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
|
2876 PURPLE_SUBTYPE_ACCOUNT), |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
2877 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
|
2878 |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
2879 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
|
2880 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
|
2881 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
|
2882 PURPLE_SUBTYPE_ACCOUNT), |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
2883 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
|
2884 |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
2885 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
|
2886 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
|
2887 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
|
2888 PURPLE_SUBTYPE_ACCOUNT), |
8e3ef71c4362
Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20152
diff
changeset
|
2889 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
|
2890 |
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
|
2891 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
|
2892 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
|
2893 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
|
2894 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
|
2895 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
|
2896 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
|
2897 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
|
2898 |
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
|
2899 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
|
2900 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
|
2901 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
|
2902 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
|
2903 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2904 load_accounts(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2905 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2906 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2907 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2908 void |
15823 | 2909 purple_accounts_uninit(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2910 { |
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
|
2911 gpointer handle = purple_accounts_get_handle(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2912 if (save_timer != 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2913 { |
15823 | 2914 purple_timeout_remove(save_timer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2915 save_timer = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2916 sync_accounts(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2917 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2918 |
27439
1ae69ca12971
Unregister the account signals after destroying accounts.
Paul Aurich <paul@darkrain42.org>
parents:
27429
diff
changeset
|
2919 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
|
2920 purple_account_destroy(accounts->data); |
1ae69ca12971
Unregister the account signals after destroying accounts.
Paul Aurich <paul@darkrain42.org>
parents:
27429
diff
changeset
|
2921 |
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
|
2922 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
|
2923 purple_signals_unregister_by_instance(handle); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2924 } |