libpurple/account.c

Mon, 17 Jun 2013 18:57:26 +0530

author
Ankit Vani <a@nevitus.org>
date
Mon, 17 Jun 2013 18:57:26 +0530
branch
soc.2013.gobjectification
changeset 34574
19850cd1b2de
parent 34196
3ba4989ede79
child 34576
216613e5e368
permissions
-rw-r--r--

Begun GObjectification of PurpleAccount. Moved things around, see details.
* Created accounts.[ch] for purple_accounts_* API, account.[ch] belongs to the PurpleAccount object.
* Removed privacy.[ch]. These were basically PurpleAccount methods and appropriately belong to the object's account.[ch] file.
* purple_privacy_* functions are now purple_account_privacy_* functions.
* PurplePrivacyType is now PurpleAccountPrivacyType

5865
5b358b960d7d [gaim-migrate @ 6296]
Christian Hammond <chipx86@chipx86.com>
parents: 5842
diff changeset
1 /**
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 * @file account.c Account API
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 * @ingroup core
20147
66f05a854eee applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents: 20093
diff changeset
4 */
66f05a854eee applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents: 20093
diff changeset
5
66f05a854eee applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents: 20093
diff changeset
6 /* purple
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
8 * Purple is the legal property of its developers, whose names are too numerous
8046
c581b20a47d6 [gaim-migrate @ 8730]
Sean Egan <seanegan@pidgin.im>
parents: 7956
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
c581b20a47d6 [gaim-migrate @ 8730]
Sean Egan <seanegan@pidgin.im>
parents: 7956
diff changeset
10 * source distribution.
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6368
diff changeset
11 *
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 * (at your option) any later version.
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 *
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 * GNU General Public License for more details.
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 *
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
19859
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19767
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 */
5872
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5870
diff changeset
26 #include "internal.h"
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
27 #include "accounts.h"
11053
6d2abb51e586 [gaim-migrate @ 12991]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11042
diff changeset
28 #include "core.h"
11067
b6353889a9ba [gaim-migrate @ 13048]
Piotr Zielinski <zielaj@users.sourceforge.net>
parents: 11053
diff changeset
29 #include "dbus-maybe.h"
5717
2f3a377de638 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents: 5711
diff changeset
30 #include "debug.h"
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33967
diff changeset
31 #include "keyring.h"
14758
13b9adc9efd2 [gaim-migrate @ 17448]
Sean Egan <seanegan@pidgin.im>
parents: 14724
diff changeset
32 #include "network.h"
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
33 #include "notify.h"
8235
00045afab151 [gaim-migrate @ 8958]
Gary Kramlich <grim@pidgin.im>
parents: 8134
diff changeset
34 #include "pounce.h"
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35 #include "prefs.h"
10945
28bef60177e7 [gaim-migrate @ 12740]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10944
diff changeset
36 #include "privacy.h"
5665
0115e8068f51 [gaim-migrate @ 6081]
Christian Hammond <chipx86@chipx86.com>
parents: 5659
diff changeset
37 #include "prpl.h"
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
38 #include "request.h"
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
39 #include "server.h"
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6368
diff changeset
40 #include "signals.h"
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
41 #include "status.h"
5717
2f3a377de638 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents: 5711
diff changeset
42 #include "util.h"
10423
4663a8238def [gaim-migrate @ 11675]
Mark Doliner <markdoliner@pidgin.im>
parents: 10418
diff changeset
43 #include "xmlnode.h"
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
45 #define PURPLE_ACCOUNT_GET_PRIVATE(obj) \
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
46 (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_ACCOUNT, PurpleAccountPrivate))
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
47
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
48 typedef struct
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
49 {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
50 char *username; /**< The username. */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
51 char *alias; /**< How you appear to yourself. */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
52 char *password; /**< The account password. */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
53 char *user_info; /**< User information. */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
54
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
55 char *buddy_icon_path; /**< The buddy icon's non-cached path. */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
56
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
57 gboolean remember_pass; /**< Remember the password. */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
58
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
59 char *protocol_id; /**< The ID of the protocol. */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
60
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
61 PurpleConnection *gc; /**< The connection handle. */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
62 gboolean disconnecting; /**< The account is currently disconnecting */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
63
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
64 GHashTable *settings; /**< Protocol-specific settings. */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
65 GHashTable *ui_settings; /**< UI-specific settings. */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
66
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
67 PurpleProxyInfo *proxy_info; /**< Proxy information. This will be set */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
68 /* to NULL when the account inherits */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
69 /* proxy settings from global prefs. */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
70
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
71 /*
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
72 * TODO: Supplementing the next two linked lists with hash tables
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
73 * should help performance a lot when these lists are long. This
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
74 * matters quite a bit for protocols like MSN, where all your
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
75 * buddies are added to your permit list. Currently we have to
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
76 * iterate through the entire list if we want to check if someone
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
77 * is permitted or denied. We should do this for 3.0.0.
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
78 * Or maybe use a GTree.
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
79 */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
80 GSList *permit; /**< Permit list. */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
81 GSList *deny; /**< Deny list. */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
82 PurpleAccountPrivacyType perm_deny; /**< The permit/deny setting. */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
83
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
84 GList *status_types; /**< Status types. */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
85
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
86 PurplePresence *presence; /**< Presence. */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
87 PurpleLog *system_log; /**< The system log */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
88
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
89 void *ui_data; /**< The UI can put data here. */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
90 PurpleAccountRegistrationCb registration_cb;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
91 void *registration_cb_user_data;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
92
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
93 PurpleConnectionErrorInfo *current_error; /**< Errors */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
94 } PurpleAccountPrivate;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
95
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
96 /* TODO: Should use PurpleValue instead of this? What about "ui"? */
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
97 typedef struct
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
98 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
99 PurplePrefType type;
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
100
5777
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
101 char *ui;
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
102
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
103 union
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
104 {
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
105 int integer;
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
106 char *string;
20246
161dd7a7f73a applied changes from 7a436ba53de6adebccf4e920ca62d544e13b1094
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
107 gboolean boolean;
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
108
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
109 } value;
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
110
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
111 } PurpleAccountSetting;
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
112
15537
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
113 typedef struct
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
114 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
115 PurpleAccountRequestType type;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
116 PurpleAccount *account;
15537
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
117 void *ui_handle;
20421
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
118 char *user;
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
119 gpointer userdata;
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
120 PurpleAccountRequestAuthorizationCb auth_cb;
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
121 PurpleAccountRequestAuthorizationCb deny_cb;
25113
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
122 guint ref;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
123 } PurpleAccountRequestInfo;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
124
33996
ca5e901a5311 Implemented a password caching system to limit problems linked to the
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33995
diff changeset
125 typedef struct
ca5e901a5311 Implemented a password caching system to limit problems linked to the
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33995
diff changeset
126 {
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
127 PurpleCallback cb;
33996
ca5e901a5311 Implemented a password caching system to limit problems linked to the
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33995
diff changeset
128 gpointer data;
34115
a0f9b38226eb Better name for CbInfo, revert cosmetic changes not related to master password branch
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34111
diff changeset
129 } PurpleCallbackBundle;
33996
ca5e901a5311 Implemented a password caching system to limit problems linked to the
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33995
diff changeset
130
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
131 static PurpleAccountUiOps *account_ui_ops = NULL;
7015
bea9111282b3 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
132
5573
633880e3f137 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5565
diff changeset
133 static GList *accounts = NULL;
10428
940d15803cad [gaim-migrate @ 11680]
Mark Doliner <markdoliner@pidgin.im>
parents: 10427
diff changeset
134 static guint save_timer = 0;
5573
633880e3f137 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5565
diff changeset
135 static gboolean accounts_loaded = FALSE;
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
136
15537
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
137 static GList *handles = NULL;
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
138
21314
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
139 static void set_current_error(PurpleAccount *account,
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
140 PurpleConnectionErrorInfo *new_err);
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
141
10428
940d15803cad [gaim-migrate @ 11680]
Mark Doliner <markdoliner@pidgin.im>
parents: 10427
diff changeset
142 /*********************************************************************
10429
cc2f5ab7ed77 [gaim-migrate @ 11681]
Mark Doliner <markdoliner@pidgin.im>
parents: 10428
diff changeset
143 * Writing to disk *
10428
940d15803cad [gaim-migrate @ 11680]
Mark Doliner <markdoliner@pidgin.im>
parents: 10427
diff changeset
144 *********************************************************************/
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
145
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
146 static void
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
147 setting_to_xmlnode(gpointer key, gpointer value, gpointer user_data)
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
148 {
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
149 const char *name;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
150 PurpleAccountSetting *setting;
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
151 xmlnode *node, *child;
27116
19dff7b3ed0f A patch from Scott Wolchok to replace snprintf() with g_snprintf() and
Richard Laager <rlaager@pidgin.im>
parents: 26986
diff changeset
152 char buf[21];
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
153
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
154 name = (const char *)key;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
155 setting = (PurpleAccountSetting *)value;
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
156 node = (xmlnode *)user_data;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
157
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
158 child = xmlnode_new_child(node, "setting");
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
159 xmlnode_set_attrib(child, "name", name);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
160
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
161 if (setting->type == PURPLE_PREF_INT) {
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
162 xmlnode_set_attrib(child, "type", "int");
27116
19dff7b3ed0f A patch from Scott Wolchok to replace snprintf() with g_snprintf() and
Richard Laager <rlaager@pidgin.im>
parents: 26986
diff changeset
163 g_snprintf(buf, sizeof(buf), "%d", setting->value.integer);
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
164 xmlnode_insert_data(child, buf, -1);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
165 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
166 else if (setting->type == PURPLE_PREF_STRING && setting->value.string != NULL) {
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
167 xmlnode_set_attrib(child, "type", "string");
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
168 xmlnode_insert_data(child, setting->value.string, -1);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
169 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
170 else if (setting->type == PURPLE_PREF_BOOLEAN) {
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
171 xmlnode_set_attrib(child, "type", "bool");
27116
19dff7b3ed0f A patch from Scott Wolchok to replace snprintf() with g_snprintf() and
Richard Laager <rlaager@pidgin.im>
parents: 26986
diff changeset
172 g_snprintf(buf, sizeof(buf), "%d", setting->value.boolean);
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
173 xmlnode_insert_data(child, buf, -1);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
174 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
175 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
176
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
177 static void
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
178 ui_setting_to_xmlnode(gpointer key, gpointer value, gpointer user_data)
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
179 {
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
180 const char *ui;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
181 GHashTable *table;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
182 xmlnode *node, *child;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
183
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
184 ui = (const char *)key;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
185 table = (GHashTable *)value;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
186 node = (xmlnode *)user_data;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
187
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
188 if (g_hash_table_size(table) > 0)
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
189 {
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
190 child = xmlnode_new_child(node, "settings");
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
191 xmlnode_set_attrib(child, "ui", ui);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
192 g_hash_table_foreach(table, setting_to_xmlnode, child);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
193 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
194 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
195
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
196 static xmlnode *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
197 status_attr_to_xmlnode(const PurpleStatus *status, const PurpleStatusType *type, const PurpleStatusAttr *attr)
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
198 {
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
199 xmlnode *node;
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
200 const char *id;
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
201 char *value = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
202 PurpleStatusAttr *default_attr;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
203 PurpleValue *default_value;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
204 PurpleType attr_type;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
205 PurpleValue *attr_value;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
206
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
207 id = purple_status_attr_get_id(attr);
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
208 g_return_val_if_fail(id, NULL);
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
209
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
210 attr_value = purple_status_get_attr_value(status, id);
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
211 g_return_val_if_fail(attr_value, NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
212 attr_type = purple_value_get_type(attr_value);
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
213
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
214 /*
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
215 * If attr_value is a different type than it should be
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
216 * then don't write it to the file.
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
217 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
218 default_attr = purple_status_type_get_attr(type, id);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
219 default_value = purple_status_attr_get_value(default_attr);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
220 if (attr_type != purple_value_get_type(default_value))
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
221 return NULL;
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
222
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
223 /*
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
224 * If attr_value is the same as the default for this status
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
225 * then there is no need to write it to the file.
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
226 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
227 if (attr_type == PURPLE_TYPE_STRING)
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
228 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
229 const char *string_value = purple_value_get_string(attr_value);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
230 const char *default_string_value = purple_value_get_string(default_value);
25859
b42be7bb9dac 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 <darkrain42@pidgin.im>
parents: 25140
diff changeset
231 if (purple_strequal(string_value, default_string_value))
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
232 return NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
233 value = g_strdup(purple_value_get_string(attr_value));
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
234 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
235 else if (attr_type == PURPLE_TYPE_INT)
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
236 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
237 int int_value = purple_value_get_int(attr_value);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
238 if (int_value == purple_value_get_int(default_value))
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
239 return NULL;
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
240 value = g_strdup_printf("%d", int_value);
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
241 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
242 else if (attr_type == PURPLE_TYPE_BOOLEAN)
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
243 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
244 gboolean boolean_value = purple_value_get_boolean(attr_value);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
245 if (boolean_value == purple_value_get_boolean(default_value))
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
246 return NULL;
34115
a0f9b38226eb Better name for CbInfo, revert cosmetic changes not related to master password branch
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34111
diff changeset
247 value = g_strdup(boolean_value ?
a0f9b38226eb Better name for CbInfo, revert cosmetic changes not related to master password branch
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34111
diff changeset
248 "true" : "false");
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
249 }
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
250 else
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
251 {
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
252 return NULL;
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
253 }
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
254
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
255 g_return_val_if_fail(value, NULL);
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
256
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
257 node = xmlnode_new("attribute");
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
258
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
259 xmlnode_set_attrib(node, "id", id);
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
260 xmlnode_set_attrib(node, "value", value);
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
261
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
262 g_free(value);
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
263
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
264 return node;
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
265 }
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
266
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
267 static xmlnode *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
268 status_attrs_to_xmlnode(const PurpleStatus *status)
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
269 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
270 PurpleStatusType *type = purple_status_get_type(status);
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
271 xmlnode *node, *child;
18190
bcf28ef7e8ff Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@pidgin.im>
parents: 18122
diff changeset
272 GList *attrs, *attr;
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
273
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
274 node = xmlnode_new("attributes");
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
275
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
276 attrs = purple_status_type_get_attrs(type);
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
277 for (attr = attrs; attr != NULL; attr = attr->next)
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
278 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
279 child = status_attr_to_xmlnode(status, type, (const PurpleStatusAttr *)attr->data);
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
280 if (child)
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
281 xmlnode_insert_child(node, child);
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
282 }
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
283
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
284 return node;
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
285 }
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
286
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
287 static xmlnode *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
288 status_to_xmlnode(const PurpleStatus *status)
10738
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
289 {
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
290 xmlnode *node, *child;
10738
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
291
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
292 node = xmlnode_new("status");
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
293 xmlnode_set_attrib(node, "type", purple_status_get_id(status));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
294 if (purple_status_get_name(status) != NULL)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
295 xmlnode_set_attrib(node, "name", purple_status_get_name(status));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
296 xmlnode_set_attrib(node, "active", purple_status_is_active(status) ? "true" : "false");
10738
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
297
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
298 child = status_attrs_to_xmlnode(status);
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
299 xmlnode_insert_child(node, child);
10738
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
300
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
301 return node;
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
302 }
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
303
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
304 static xmlnode *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
305 statuses_to_xmlnode(const PurplePresence *presence)
10738
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
306 {
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
307 xmlnode *node, *child;
25445
b36f23e05c50 Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <datallah@pidgin.im>
parents: 25113
diff changeset
308 GList *statuses;
b36f23e05c50 Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <datallah@pidgin.im>
parents: 25113
diff changeset
309 PurpleStatus *status;
10738
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
310
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
311 node = xmlnode_new("statuses");
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
312
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
313 statuses = purple_presence_get_statuses(presence);
25445
b36f23e05c50 Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <datallah@pidgin.im>
parents: 25113
diff changeset
314 for (; statuses != NULL; statuses = statuses->next)
10738
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
315 {
25445
b36f23e05c50 Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <datallah@pidgin.im>
parents: 25113
diff changeset
316 status = statuses->data;
b36f23e05c50 Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <datallah@pidgin.im>
parents: 25113
diff changeset
317 if (purple_status_type_is_saveable(purple_status_get_type(status)))
b36f23e05c50 Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <datallah@pidgin.im>
parents: 25113
diff changeset
318 {
b36f23e05c50 Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <datallah@pidgin.im>
parents: 25113
diff changeset
319 child = status_to_xmlnode(status);
b36f23e05c50 Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <datallah@pidgin.im>
parents: 25113
diff changeset
320 xmlnode_insert_child(node, child);
b36f23e05c50 Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <datallah@pidgin.im>
parents: 25113
diff changeset
321 }
10738
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
322 }
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
323
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
324 return node;
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
325 }
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
326
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
327 static xmlnode *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
328 proxy_settings_to_xmlnode(PurpleProxyInfo *proxy_info)
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
329 {
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
330 xmlnode *node, *child;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
331 PurpleProxyType proxy_type;
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
332 const char *value;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
333 int int_value;
27116
19dff7b3ed0f A patch from Scott Wolchok to replace snprintf() with g_snprintf() and
Richard Laager <rlaager@pidgin.im>
parents: 26986
diff changeset
334 char buf[21];
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
335
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
336 proxy_type = purple_proxy_info_get_type(proxy_info);
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
337
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
338 node = xmlnode_new("proxy");
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
339
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
340 child = xmlnode_new_child(node, "type");
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
341 xmlnode_insert_data(child,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
342 (proxy_type == PURPLE_PROXY_USE_GLOBAL ? "global" :
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
343 proxy_type == PURPLE_PROXY_NONE ? "none" :
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
344 proxy_type == PURPLE_PROXY_HTTP ? "http" :
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
345 proxy_type == PURPLE_PROXY_SOCKS4 ? "socks4" :
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
346 proxy_type == PURPLE_PROXY_SOCKS5 ? "socks5" :
31677
042eaab1468c Add a new proxy type of "Tor". This is really just a SOCKS5 proxy, but can be
Daniel Atallah <datallah@pidgin.im>
parents: 31594
diff changeset
347 proxy_type == PURPLE_PROXY_TOR ? "tor" :
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
348 proxy_type == PURPLE_PROXY_USE_ENVVAR ? "envvar" : "unknown"), -1);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
349
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
350 if ((value = purple_proxy_info_get_host(proxy_info)) != NULL)
15041
18a6f6cdce33 [gaim-migrate @ 17758]
Daniel Atallah <datallah@pidgin.im>
parents: 15030
diff changeset
351 {
18a6f6cdce33 [gaim-migrate @ 17758]
Daniel Atallah <datallah@pidgin.im>
parents: 15030
diff changeset
352 child = xmlnode_new_child(node, "host");
18a6f6cdce33 [gaim-migrate @ 17758]
Daniel Atallah <datallah@pidgin.im>
parents: 15030
diff changeset
353 xmlnode_insert_data(child, value, -1);
18a6f6cdce33 [gaim-migrate @ 17758]
Daniel Atallah <datallah@pidgin.im>
parents: 15030
diff changeset
354 }
18a6f6cdce33 [gaim-migrate @ 17758]
Daniel Atallah <datallah@pidgin.im>
parents: 15030
diff changeset
355
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
356 if ((int_value = purple_proxy_info_get_port(proxy_info)) != 0)
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
357 {
27116
19dff7b3ed0f A patch from Scott Wolchok to replace snprintf() with g_snprintf() and
Richard Laager <rlaager@pidgin.im>
parents: 26986
diff changeset
358 g_snprintf(buf, sizeof(buf), "%d", int_value);
15041
18a6f6cdce33 [gaim-migrate @ 17758]
Daniel Atallah <datallah@pidgin.im>
parents: 15030
diff changeset
359 child = xmlnode_new_child(node, "port");
18a6f6cdce33 [gaim-migrate @ 17758]
Daniel Atallah <datallah@pidgin.im>
parents: 15030
diff changeset
360 xmlnode_insert_data(child, buf, -1);
18a6f6cdce33 [gaim-migrate @ 17758]
Daniel Atallah <datallah@pidgin.im>
parents: 15030
diff changeset
361 }
18a6f6cdce33 [gaim-migrate @ 17758]
Daniel Atallah <datallah@pidgin.im>
parents: 15030
diff changeset
362
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
363 if ((value = purple_proxy_info_get_username(proxy_info)) != NULL)
15041
18a6f6cdce33 [gaim-migrate @ 17758]
Daniel Atallah <datallah@pidgin.im>
parents: 15030
diff changeset
364 {
18a6f6cdce33 [gaim-migrate @ 17758]
Daniel Atallah <datallah@pidgin.im>
parents: 15030
diff changeset
365 child = xmlnode_new_child(node, "username");
18a6f6cdce33 [gaim-migrate @ 17758]
Daniel Atallah <datallah@pidgin.im>
parents: 15030
diff changeset
366 xmlnode_insert_data(child, value, -1);
18a6f6cdce33 [gaim-migrate @ 17758]
Daniel Atallah <datallah@pidgin.im>
parents: 15030
diff changeset
367 }
18a6f6cdce33 [gaim-migrate @ 17758]
Daniel Atallah <datallah@pidgin.im>
parents: 15030
diff changeset
368
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
369 if ((value = purple_proxy_info_get_password(proxy_info)) != NULL)
15041
18a6f6cdce33 [gaim-migrate @ 17758]
Daniel Atallah <datallah@pidgin.im>
parents: 15030
diff changeset
370 {
18a6f6cdce33 [gaim-migrate @ 17758]
Daniel Atallah <datallah@pidgin.im>
parents: 15030
diff changeset
371 child = xmlnode_new_child(node, "password");
18a6f6cdce33 [gaim-migrate @ 17758]
Daniel Atallah <datallah@pidgin.im>
parents: 15030
diff changeset
372 xmlnode_insert_data(child, value, -1);
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
373 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
374
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
375 return node;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
376 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
377
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
378 static xmlnode *
21314
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
379 current_error_to_xmlnode(PurpleConnectionErrorInfo *err)
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
380 {
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
381 xmlnode *node, *child;
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
382 char type_str[3];
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
383
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
384 node = xmlnode_new("current_error");
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
385
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
386 if(err == NULL)
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
387 return node;
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
388
21961
8ca368922eba Don't bother making transient connection errors persist across a restart.
Will Thompson <resiak@pidgin.im>
parents: 21928
diff changeset
389 /* It doesn't make sense to have transient errors persist across a
8ca368922eba Don't bother making transient connection errors persist across a restart.
Will Thompson <resiak@pidgin.im>
parents: 21928
diff changeset
390 * restart.
8ca368922eba Don't bother making transient connection errors persist across a restart.
Will Thompson <resiak@pidgin.im>
parents: 21928
diff changeset
391 */
8ca368922eba Don't bother making transient connection errors persist across a restart.
Will Thompson <resiak@pidgin.im>
parents: 21928
diff changeset
392 if(!purple_connection_error_is_fatal (err->type))
8ca368922eba Don't bother making transient connection errors persist across a restart.
Will Thompson <resiak@pidgin.im>
parents: 21928
diff changeset
393 return node;
8ca368922eba Don't bother making transient connection errors persist across a restart.
Will Thompson <resiak@pidgin.im>
parents: 21928
diff changeset
394
21314
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
395 child = xmlnode_new_child(node, "type");
27116
19dff7b3ed0f A patch from Scott Wolchok to replace snprintf() with g_snprintf() and
Richard Laager <rlaager@pidgin.im>
parents: 26986
diff changeset
396 g_snprintf(type_str, sizeof(type_str), "%u", err->type);
21314
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
397 xmlnode_insert_data(child, type_str, -1);
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
398
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
399 child = xmlnode_new_child(node, "description");
21928
075718340ddf Ensure that an error's description actually is UTF-8 before writing it out to
Will Thompson <resiak@pidgin.im>
parents: 21907
diff changeset
400 if(err->description) {
075718340ddf Ensure that an error's description actually is UTF-8 before writing it out to
Will Thompson <resiak@pidgin.im>
parents: 21907
diff changeset
401 char *utf8ized = purple_utf8_try_convert(err->description);
075718340ddf Ensure that an error's description actually is UTF-8 before writing it out to
Will Thompson <resiak@pidgin.im>
parents: 21907
diff changeset
402 if(utf8ized == NULL)
075718340ddf Ensure that an error's description actually is UTF-8 before writing it out to
Will Thompson <resiak@pidgin.im>
parents: 21907
diff changeset
403 utf8ized = purple_utf8_salvage(err->description);
075718340ddf Ensure that an error's description actually is UTF-8 before writing it out to
Will Thompson <resiak@pidgin.im>
parents: 21907
diff changeset
404 xmlnode_insert_data(child, utf8ized, -1);
075718340ddf Ensure that an error's description actually is UTF-8 before writing it out to
Will Thompson <resiak@pidgin.im>
parents: 21907
diff changeset
405 g_free(utf8ized);
075718340ddf Ensure that an error's description actually is UTF-8 before writing it out to
Will Thompson <resiak@pidgin.im>
parents: 21907
diff changeset
406 }
21314
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
407
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
408 return node;
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
409 }
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
410
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
411 static xmlnode *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
412 account_to_xmlnode(PurpleAccount *account)
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
413 {
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
414 xmlnode *node, *child;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
415 const char *tmp;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
416 PurplePresence *presence;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
417 PurpleProxyInfo *proxy_info;
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
418
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
419 node = xmlnode_new("account");
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
420
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
421 child = xmlnode_new_child(node, "protocol");
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
422 xmlnode_insert_data(child, purple_account_get_protocol_id(account), -1);
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
423
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
424 child = xmlnode_new_child(node, "name");
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
425 xmlnode_insert_data(child, purple_account_get_username(account), -1);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
426
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33967
diff changeset
427 if (purple_account_get_remember_password(account))
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
428 {
34145
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
429 const char *keyring_id = NULL;
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
430 const char *mode = NULL;
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
431 char *data = NULL;
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
432 GError *error = NULL;
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
433 GDestroyNotify destroy = NULL;
34134
fda68dc6481c Don't require implementing import/export of password
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34127
diff changeset
434 gboolean exported = purple_keyring_export_password(account,
fda68dc6481c Don't require implementing import/export of password
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34127
diff changeset
435 &keyring_id, &mode, &data, &error, &destroy);
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33967
diff changeset
436
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33967
diff changeset
437 if (error != NULL) {
34127
51c1bce7f52f Tidying debug messages, signals
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34125
diff changeset
438 purple_debug_error("account",
34170
94102637e7c7 Coding style and entry description for GNOME Keyring
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34165
diff changeset
439 "Failed to export password for account %s: %s.\n",
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
440 purple_account_get_username(account),
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
441 error->message);
34134
fda68dc6481c Don't require implementing import/export of password
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34127
diff changeset
442 } else if (exported) {
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33967
diff changeset
443 child = xmlnode_new_child(node, "password");
34010
cd639f4079d3 Fixed account_toxmlnode() so that xmlnode funcctions are not called if we have nothing to put in them.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 34007
diff changeset
444 if (keyring_id != NULL)
cd639f4079d3 Fixed account_toxmlnode() so that xmlnode funcctions are not called if we have nothing to put in them.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 34007
diff changeset
445 xmlnode_set_attrib(child, "keyring_id", keyring_id);
cd639f4079d3 Fixed account_toxmlnode() so that xmlnode funcctions are not called if we have nothing to put in them.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 34007
diff changeset
446 if (mode != NULL)
cd639f4079d3 Fixed account_toxmlnode() so that xmlnode funcctions are not called if we have nothing to put in them.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 34007
diff changeset
447 xmlnode_set_attrib(child, "mode", mode);
cd639f4079d3 Fixed account_toxmlnode() so that xmlnode funcctions are not called if we have nothing to put in them.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 34007
diff changeset
448 if (data != NULL)
cd639f4079d3 Fixed account_toxmlnode() so that xmlnode funcctions are not called if we have nothing to put in them.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 34007
diff changeset
449 xmlnode_insert_data(child, data, -1);
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33967
diff changeset
450
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33967
diff changeset
451 if (destroy != NULL)
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33967
diff changeset
452 destroy(data);
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33967
diff changeset
453 }
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
454 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
455
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
456 if ((tmp = purple_account_get_alias(account)) != NULL)
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
457 {
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
458 child = xmlnode_new_child(node, "alias");
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
459 xmlnode_insert_data(child, tmp, -1);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
460 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
461
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
462 if ((presence = purple_account_get_presence(account)) != NULL)
10738
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
463 {
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
464 child = statuses_to_xmlnode(presence);
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
465 xmlnode_insert_child(node, child);
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
466 }
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
467
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
468 if ((tmp = purple_account_get_user_info(account)) != NULL)
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
469 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
470 /* TODO: Do we need to call purple_str_strip_char(tmp, '\r') here? */
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
471 child = xmlnode_new_child(node, "userinfo");
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
472 xmlnode_insert_data(child, tmp, -1);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
473 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
474
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
475 if (g_hash_table_size(account->settings) > 0)
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
476 {
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
477 child = xmlnode_new_child(node, "settings");
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
478 g_hash_table_foreach(account->settings, setting_to_xmlnode, child);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
479 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
480
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
481 if (g_hash_table_size(account->ui_settings) > 0)
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
482 {
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
483 g_hash_table_foreach(account->ui_settings, ui_setting_to_xmlnode, node);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
484 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
485
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
486 if ((proxy_info = purple_account_get_proxy_info(account)) != NULL)
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
487 {
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
488 child = proxy_settings_to_xmlnode(proxy_info);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
489 xmlnode_insert_child(node, child);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
490 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
491
32628
d3ad4cb046aa The intention is to make PurpleAccount a private structure in account.c, so merge
Andrew Victor <andrew.victor@mxit.com>
parents: 32582
diff changeset
492 child = current_error_to_xmlnode(account->current_error);
21314
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
493 xmlnode_insert_child(node, child);
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
494
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
495 return node;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
496 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
497
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
498 static xmlnode *
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
499 accounts_to_xmlnode(void)
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
500 {
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
501 xmlnode *node, *child;
18122
9bf9970c1b6a disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents: 18121
diff changeset
502 GList *cur;
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
503
10760
36ed17d3ad9d [gaim-migrate @ 12363]
Mark Doliner <markdoliner@pidgin.im>
parents: 10758
diff changeset
504 node = xmlnode_new("account");
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
505 xmlnode_set_attrib(node, "version", "1.0");
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
506
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
507 for (cur = purple_accounts_get_all(); cur != NULL; cur = cur->next)
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
508 {
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
509 child = account_to_xmlnode(cur->data);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
510 xmlnode_insert_child(node, child);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
511 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
512
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
513 return node;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
514 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
515
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
516 static void
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
517 sync_accounts(void)
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
518 {
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
519 xmlnode *node;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
520 char *data;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
521
10428
940d15803cad [gaim-migrate @ 11680]
Mark Doliner <markdoliner@pidgin.im>
parents: 10427
diff changeset
522 if (!accounts_loaded)
940d15803cad [gaim-migrate @ 11680]
Mark Doliner <markdoliner@pidgin.im>
parents: 10427
diff changeset
523 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
524 purple_debug_error("account", "Attempted to save accounts before "
10443
aa7dcc1c796a [gaim-migrate @ 11703]
Mark Doliner <markdoliner@pidgin.im>
parents: 10429
diff changeset
525 "they were read!\n");
aa7dcc1c796a [gaim-migrate @ 11703]
Mark Doliner <markdoliner@pidgin.im>
parents: 10429
diff changeset
526 return;
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
527 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
528
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
529 node = accounts_to_xmlnode();
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
530 data = xmlnode_to_formatted_str(node, NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
531 purple_util_write_data_to_file("accounts.xml", data, -1);
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
532 g_free(data);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
533 xmlnode_free(node);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
534 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
535
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
536 static gboolean
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
537 save_cb(gpointer data)
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
538 {
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
539 sync_accounts();
10428
940d15803cad [gaim-migrate @ 11680]
Mark Doliner <markdoliner@pidgin.im>
parents: 10427
diff changeset
540 save_timer = 0;
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
541 return FALSE;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
542 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
543
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
544 static void
22104
56970903b8e9 Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents: 22055
diff changeset
545 schedule_accounts_save(void)
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
546 {
10428
940d15803cad [gaim-migrate @ 11680]
Mark Doliner <markdoliner@pidgin.im>
parents: 10427
diff changeset
547 if (save_timer == 0)
18068
b6554e3c8224 merge of '1442df274a24edc9a31194327bd00dfbcf478720'
Richard Laager <rlaager@pidgin.im>
parents: 18067 17155
diff changeset
548 save_timer = purple_timeout_add_seconds(5, save_cb, NULL);
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
549 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
550
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
551
10428
940d15803cad [gaim-migrate @ 11680]
Mark Doliner <markdoliner@pidgin.im>
parents: 10427
diff changeset
552 /*********************************************************************
940d15803cad [gaim-migrate @ 11680]
Mark Doliner <markdoliner@pidgin.im>
parents: 10427
diff changeset
553 * Reading from disk *
940d15803cad [gaim-migrate @ 11680]
Mark Doliner <markdoliner@pidgin.im>
parents: 10427
diff changeset
554 *********************************************************************/
27562
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
555 static void
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
556 migrate_yahoo_japan(PurpleAccount *account)
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
557 {
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
558 /* detect a Yahoo! JAPAN account that existed prior to 2.6.0 and convert it
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
559 * to use the new prpl-yahoojp. Also remove the account-specific settings
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
560 * we no longer need */
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
561
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
562 if(purple_strequal(purple_account_get_protocol_id(account), "prpl-yahoo")) {
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
563 if(purple_account_get_bool(account, "yahoojp", FALSE)) {
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
564 const char *serverjp = purple_account_get_string(account, "serverjp", NULL);
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
565 const char *xferjp_host = purple_account_get_string(account, "xferjp_host", NULL);
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
566
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
567 g_return_if_fail(serverjp != NULL);
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
568 g_return_if_fail(xferjp_host != NULL);
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
569
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
570 purple_account_set_string(account, "server", serverjp);
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
571 purple_account_set_string(account, "xfer_host", xferjp_host);
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
572
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
573 purple_account_set_protocol_id(account, "prpl-yahoojp");
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
574 }
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
575
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
576 /* these should always be nuked */
27563
3f38f3d8b8ba I forgot to remove the old bool setting for Yahoo! JAPAN.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27562
diff changeset
577 purple_account_remove_setting(account, "yahoojp");
27562
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
578 purple_account_remove_setting(account, "serverjp");
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
579 purple_account_remove_setting(account, "xferjp_host");
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
580
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
581 }
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
582 }
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
583
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
584 static void
30890
58793c9c41b6 Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30740
diff changeset
585 migrate_icq_server(PurpleAccount *account)
58793c9c41b6 Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30740
diff changeset
586 {
58793c9c41b6 Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30740
diff changeset
587 /* Migrate the login server setting for ICQ accounts. See
58793c9c41b6 Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30740
diff changeset
588 * 'mtn log --last 1 --no-graph --from b6d7712e90b68610df3bd2d8cbaf46d94c8b3794'
58793c9c41b6 Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30740
diff changeset
589 * for details on the change. */
58793c9c41b6 Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30740
diff changeset
590
58793c9c41b6 Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30740
diff changeset
591 if(purple_strequal(purple_account_get_protocol_id(account), "prpl-icq")) {
30893
4fd87562e958 warnings--
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30892
diff changeset
592 const char *tmp = purple_account_get_string(account, "server", NULL);
30892
a8e96ae0ce4b Tweak the login server migration for ICQ:
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30890
diff changeset
593
30890
58793c9c41b6 Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30740
diff changeset
594 /* Non-secure server */
30892
a8e96ae0ce4b Tweak the login server migration for ICQ:
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30890
diff changeset
595 if(purple_strequal(tmp, "login.messaging.aol.com") ||
a8e96ae0ce4b Tweak the login server migration for ICQ:
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30890
diff changeset
596 purple_strequal(tmp, "login.oscar.aol.com"))
30890
58793c9c41b6 Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30740
diff changeset
597 purple_account_set_string(account, "server", "login.icq.com");
58793c9c41b6 Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30740
diff changeset
598
58793c9c41b6 Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30740
diff changeset
599 /* Secure server */
30892
a8e96ae0ce4b Tweak the login server migration for ICQ:
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30890
diff changeset
600 if(purple_strequal(tmp, "slogin.oscar.aol.com"))
30890
58793c9c41b6 Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30740
diff changeset
601 purple_account_set_string(account, "server", "slogin.icq.com");
58793c9c41b6 Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30740
diff changeset
602 }
58793c9c41b6 Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30740
diff changeset
603 }
58793c9c41b6 Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30740
diff changeset
604
58793c9c41b6 Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30740
diff changeset
605 static void
30740
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30708
diff changeset
606 migrate_xmpp_encryption(PurpleAccount *account)
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30708
diff changeset
607 {
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30708
diff changeset
608 /* When this is removed, nuke the "old_ssl" and "require_tls" settings */
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30708
diff changeset
609 if (g_str_equal(purple_account_get_protocol_id(account), "prpl-jabber")) {
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30708
diff changeset
610 const char *sec = purple_account_get_string(account, "connection_security", "");
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30708
diff changeset
611
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30708
diff changeset
612 if (g_str_equal("", sec)) {
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30708
diff changeset
613 const char *val = "require_tls";
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30708
diff changeset
614 if (purple_account_get_bool(account, "old_ssl", FALSE))
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30708
diff changeset
615 val = "old_ssl";
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30708
diff changeset
616 else if (!purple_account_get_bool(account, "require_tls", TRUE))
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30708
diff changeset
617 val = "opportunistic_tls";
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30708
diff changeset
618
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30708
diff changeset
619 purple_account_set_string(account, "connection_security", val);
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30708
diff changeset
620 }
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30708
diff changeset
621 }
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30708
diff changeset
622 }
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30708
diff changeset
623
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30708
diff changeset
624 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
625 parse_settings(xmlnode *node, PurpleAccount *account)
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
626 {
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
627 const char *ui;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
628 xmlnode *child;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
629
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
630 /* Get the UI string, if these are UI settings */
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
631 ui = xmlnode_get_attrib(node, "ui");
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
632
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
633 /* Read settings, one by one */
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
634 for (child = xmlnode_get_child(node, "setting"); child != NULL;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
635 child = xmlnode_get_next_twin(child))
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
636 {
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
637 const char *name, *str_type;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
638 PurplePrefType type;
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
639 char *data;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
640
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
641 name = xmlnode_get_attrib(child, "name");
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
642 if (name == NULL)
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
643 /* Ignore this setting */
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
644 continue;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
645
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
646 str_type = xmlnode_get_attrib(child, "type");
10448
4415ffba12e9 [gaim-migrate @ 11713]
Mark Doliner <markdoliner@pidgin.im>
parents: 10447
diff changeset
647 if (str_type == NULL)
4415ffba12e9 [gaim-migrate @ 11713]
Mark Doliner <markdoliner@pidgin.im>
parents: 10447
diff changeset
648 /* Ignore this setting */
4415ffba12e9 [gaim-migrate @ 11713]
Mark Doliner <markdoliner@pidgin.im>
parents: 10447
diff changeset
649 continue;
4415ffba12e9 [gaim-migrate @ 11713]
Mark Doliner <markdoliner@pidgin.im>
parents: 10447
diff changeset
650
25859
b42be7bb9dac 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 <darkrain42@pidgin.im>
parents: 25140
diff changeset
651 if (purple_strequal(str_type, "string"))
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
652 type = PURPLE_PREF_STRING;
25859
b42be7bb9dac 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 <darkrain42@pidgin.im>
parents: 25140
diff changeset
653 else if (purple_strequal(str_type, "int"))
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
654 type = PURPLE_PREF_INT;
25859
b42be7bb9dac 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 <darkrain42@pidgin.im>
parents: 25140
diff changeset
655 else if (purple_strequal(str_type, "bool"))
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
656 type = PURPLE_PREF_BOOLEAN;
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
657 else
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
658 /* Ignore this setting */
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
659 continue;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
660
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
661 data = xmlnode_get_data(child);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
662 if (data == NULL)
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
663 /* Ignore this setting */
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
664 continue;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
665
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
666 if (ui == NULL)
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
667 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
668 if (type == PURPLE_PREF_STRING)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
669 purple_account_set_string(account, name, data);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
670 else if (type == PURPLE_PREF_INT)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
671 purple_account_set_int(account, name, atoi(data));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
672 else if (type == PURPLE_PREF_BOOLEAN)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
673 purple_account_set_bool(account, name,
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
674 (*data == '0' ? FALSE : TRUE));
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
675 } else {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
676 if (type == PURPLE_PREF_STRING)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
677 purple_account_set_ui_string(account, ui, name, data);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
678 else if (type == PURPLE_PREF_INT)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
679 purple_account_set_ui_int(account, ui, name, atoi(data));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
680 else if (type == PURPLE_PREF_BOOLEAN)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
681 purple_account_set_ui_bool(account, ui, name,
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
682 (*data == '0' ? FALSE : TRUE));
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
683 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
684
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
685 g_free(data);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
686 }
27562
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
687
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
688 /* we do this here because we need access to account settings to determine
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
689 * if we can/should migrate an old Yahoo! JAPAN account */
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
690 migrate_yahoo_japan(account);
30890
58793c9c41b6 Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30740
diff changeset
691 /* we do this here because we need access to account settings to determine
58793c9c41b6 Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30740
diff changeset
692 * if we can/should migrate an ICQ account's server setting */
58793c9c41b6 Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30740
diff changeset
693 migrate_icq_server(account);
30740
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30708
diff changeset
694 /* we do this here because we need to do it before the user views the
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30708
diff changeset
695 * Edit Account dialog. */
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30708
diff changeset
696 migrate_xmpp_encryption(account);
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
697 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
698
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
699 static GList *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
700 parse_status_attrs(xmlnode *node, PurpleStatus *status)
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
701 {
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
702 GList *list = NULL;
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
703 xmlnode *child;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
704 PurpleValue *attr_value;
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
705
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
706 for (child = xmlnode_get_child(node, "attribute"); child != NULL;
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
707 child = xmlnode_get_next_twin(child))
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
708 {
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
709 const char *id = xmlnode_get_attrib(child, "id");
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
710 const char *value = xmlnode_get_attrib(child, "value");
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
711
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
712 if (!id || !*id || !value || !*value)
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
713 continue;
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
714
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
715 attr_value = purple_status_get_attr_value(status, id);
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
716 if (!attr_value)
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
717 continue;
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
718
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
719 list = g_list_append(list, (char *)id);
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
720
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
721 switch (purple_value_get_type(attr_value))
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
722 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
723 case PURPLE_TYPE_STRING:
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
724 list = g_list_append(list, (char *)value);
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
725 break;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
726 case PURPLE_TYPE_INT:
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
727 case PURPLE_TYPE_BOOLEAN:
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
728 {
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
729 int v;
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
730 if (sscanf(value, "%d", &v) == 1)
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
731 list = g_list_append(list, GINT_TO_POINTER(v));
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
732 else
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
733 list = g_list_remove(list, id);
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
734 break;
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
735 }
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
736 default:
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
737 break;
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
738 }
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
739 }
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
740
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
741 return list;
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
742 }
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
743
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
744 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
745 parse_status(xmlnode *node, PurpleAccount *account)
10738
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
746 {
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
747 gboolean active = FALSE;
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
748 const char *data;
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
749 const char *type;
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
750 xmlnode *child;
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
751 GList *attrs = NULL;
10738
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
752
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
753 /* Get the active/inactive state */
11075
d93c3b97203e [gaim-migrate @ 13085]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11067
diff changeset
754 data = xmlnode_get_attrib(node, "active");
11076
f6c4835e68ee [gaim-migrate @ 13086]
Mark Doliner <markdoliner@pidgin.im>
parents: 11075
diff changeset
755 if (data == NULL)
f6c4835e68ee [gaim-migrate @ 13086]
Mark Doliner <markdoliner@pidgin.im>
parents: 11075
diff changeset
756 return;
17155
143ff2796376 Replace strcasecmp() calls with glib equivalents.
Richard Laager <rlaager@pidgin.im>
parents: 16698
diff changeset
757 if (g_ascii_strcasecmp(data, "true") == 0)
11076
f6c4835e68ee [gaim-migrate @ 13086]
Mark Doliner <markdoliner@pidgin.im>
parents: 11075
diff changeset
758 active = TRUE;
17155
143ff2796376 Replace strcasecmp() calls with glib equivalents.
Richard Laager <rlaager@pidgin.im>
parents: 16698
diff changeset
759 else if (g_ascii_strcasecmp(data, "false") == 0)
11076
f6c4835e68ee [gaim-migrate @ 13086]
Mark Doliner <markdoliner@pidgin.im>
parents: 11075
diff changeset
760 active = FALSE;
10738
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
761 else
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
762 return;
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
763
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
764 /* Get the type of the status */
11075
d93c3b97203e [gaim-migrate @ 13085]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11067
diff changeset
765 type = xmlnode_get_attrib(node, "type");
d93c3b97203e [gaim-migrate @ 13085]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11067
diff changeset
766 if (type == NULL)
10738
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
767 return;
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
768
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
769 /* Read attributes into a GList */
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
770 child = xmlnode_get_child(node, "attributes");
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
771 if (child != NULL)
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
772 {
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
773 attrs = parse_status_attrs(child,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
774 purple_account_get_status(account, type));
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
775 }
10738
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
776
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
777 purple_account_set_status_list(account, type, active, attrs);
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
778
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
779 g_list_free(attrs);
10738
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
780 }
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
781
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
782 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
783 parse_statuses(xmlnode *node, PurpleAccount *account)
10738
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
784 {
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
785 xmlnode *child;
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
786
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
787 for (child = xmlnode_get_child(node, "status"); child != NULL;
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
788 child = xmlnode_get_next_twin(child))
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
789 {
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
790 parse_status(child, account);
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
791 }
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
792 }
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
793
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
794 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
795 parse_proxy_info(xmlnode *node, PurpleAccount *account)
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
796 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
797 PurpleProxyInfo *proxy_info;
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
798 xmlnode *child;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
799 char *data;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
800
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
801 proxy_info = purple_proxy_info_new();
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
802
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
803 /* Use the global proxy settings, by default */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
804 purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_USE_GLOBAL);
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
805
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
806 /* Read proxy type */
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
807 child = xmlnode_get_child(node, "type");
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
808 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
809 {
25859
b42be7bb9dac 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 <darkrain42@pidgin.im>
parents: 25140
diff changeset
810 if (purple_strequal(data, "global"))
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
811 purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_USE_GLOBAL);
25859
b42be7bb9dac 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 <darkrain42@pidgin.im>
parents: 25140
diff changeset
812 else if (purple_strequal(data, "none"))
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
813 purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_NONE);
25859
b42be7bb9dac 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 <darkrain42@pidgin.im>
parents: 25140
diff changeset
814 else if (purple_strequal(data, "http"))
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
815 purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_HTTP);
25859
b42be7bb9dac 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 <darkrain42@pidgin.im>
parents: 25140
diff changeset
816 else if (purple_strequal(data, "socks4"))
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
817 purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_SOCKS4);
25859
b42be7bb9dac 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 <darkrain42@pidgin.im>
parents: 25140
diff changeset
818 else if (purple_strequal(data, "socks5"))
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
819 purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_SOCKS5);
31677
042eaab1468c Add a new proxy type of "Tor". This is really just a SOCKS5 proxy, but can be
Daniel Atallah <datallah@pidgin.im>
parents: 31594
diff changeset
820 else if (purple_strequal(data, "tor"))
042eaab1468c Add a new proxy type of "Tor". This is really just a SOCKS5 proxy, but can be
Daniel Atallah <datallah@pidgin.im>
parents: 31594
diff changeset
821 purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_TOR);
25859
b42be7bb9dac 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 <darkrain42@pidgin.im>
parents: 25140
diff changeset
822 else if (purple_strequal(data, "envvar"))
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
823 purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_USE_ENVVAR);
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
824 else
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
825 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
826 purple_debug_error("account", "Invalid proxy type found when "
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
827 "loading account information for %s\n",
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
828 purple_account_get_username(account));
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
829 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
830 g_free(data);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
831 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
832
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
833 /* Read proxy host */
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
834 child = xmlnode_get_child(node, "host");
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
835 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
836 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
837 purple_proxy_info_set_host(proxy_info, data);
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
838 g_free(data);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
839 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
840
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
841 /* Read proxy port */
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
842 child = xmlnode_get_child(node, "port");
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
843 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
844 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
845 purple_proxy_info_set_port(proxy_info, atoi(data));
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
846 g_free(data);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
847 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
848
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
849 /* Read proxy username */
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
850 child = xmlnode_get_child(node, "username");
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
851 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
852 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
853 purple_proxy_info_set_username(proxy_info, data);
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
854 g_free(data);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
855 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
856
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
857 /* Read proxy password */
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
858 child = xmlnode_get_child(node, "password");
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
859 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
860 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
861 purple_proxy_info_set_password(proxy_info, data);
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
862 g_free(data);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
863 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
864
15041
18a6f6cdce33 [gaim-migrate @ 17758]
Daniel Atallah <datallah@pidgin.im>
parents: 15030
diff changeset
865 /* If there are no values set then proxy_info NULL */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
866 if ((purple_proxy_info_get_type(proxy_info) == PURPLE_PROXY_USE_GLOBAL) &&
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
867 (purple_proxy_info_get_host(proxy_info) == NULL) &&
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
868 (purple_proxy_info_get_port(proxy_info) == 0) &&
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
869 (purple_proxy_info_get_username(proxy_info) == NULL) &&
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
870 (purple_proxy_info_get_password(proxy_info) == NULL))
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
871 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
872 purple_proxy_info_destroy(proxy_info);
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
873 return;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
874 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
875
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
876 purple_account_set_proxy_info(account, proxy_info);
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
877 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
878
21314
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
879 static void
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
880 parse_current_error(xmlnode *node, PurpleAccount *account)
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
881 {
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
882 guint type;
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
883 char *type_str = NULL, *description = NULL;
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
884 xmlnode *child;
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
885 PurpleConnectionErrorInfo *current_error = NULL;
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
886
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
887 child = xmlnode_get_child(node, "type");
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
888 if (child == NULL || (type_str = xmlnode_get_data(child)) == NULL)
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
889 return;
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
890 type = atoi(type_str);
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
891 g_free(type_str);
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
892
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
893 if (type > PURPLE_CONNECTION_ERROR_OTHER_ERROR)
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
894 {
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
895 purple_debug_error("account",
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
896 "Invalid PurpleConnectionError value %d found when "
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
897 "loading account information for %s\n",
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
898 type, purple_account_get_username(account));
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
899 type = PURPLE_CONNECTION_ERROR_OTHER_ERROR;
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
900 }
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
901
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
902 child = xmlnode_get_child(node, "description");
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
903 if (child)
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
904 description = xmlnode_get_data(child);
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
905 if (description == NULL)
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
906 description = g_strdup("");
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
907
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
908 current_error = g_new0(PurpleConnectionErrorInfo, 1);
22467
151133154190 Register and unregister the PurpleConnectionErrorInfo pointers with dbus, I
Etan Reisner <deryni@pidgin.im>
parents: 22357
diff changeset
909 PURPLE_DBUS_REGISTER_POINTER(current_error, PurpleConnectionErrorInfo);
21314
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
910 current_error->type = type;
22235
16d50b31a47b Plug a small leak.
Daniel Atallah <datallah@pidgin.im>
parents: 22177
diff changeset
911 current_error->description = description;
21314
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
912
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
913 set_current_error(account, current_error);
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
914 }
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
915
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
916 static PurpleAccount *
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
917 parse_account(xmlnode *node)
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
918 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
919 PurpleAccount *ret;
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
920 xmlnode *child;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
921 char *protocol_id = NULL;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
922 char *name = NULL;
34145
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
923 char *data;
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
924
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
925 child = xmlnode_get_child(node, "protocol");
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
926 if (child != NULL)
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
927 protocol_id = xmlnode_get_data(child);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
928
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
929 child = xmlnode_get_child(node, "name");
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
930 if (child != NULL)
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
931 name = xmlnode_get_data(child);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
932 if (name == NULL)
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
933 {
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
934 /* Do we really need to do this? */
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
935 child = xmlnode_get_child(node, "username");
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
936 if (child != NULL)
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
937 name = xmlnode_get_data(child);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
938 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
939
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
940 if ((protocol_id == NULL) || (name == NULL))
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
941 {
14141
cc05956d28dc [gaim-migrate @ 16700]
Daniel Atallah <datallah@pidgin.im>
parents: 14097
diff changeset
942 g_free(protocol_id);
cc05956d28dc [gaim-migrate @ 16700]
Daniel Atallah <datallah@pidgin.im>
parents: 14097
diff changeset
943 g_free(name);
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
944 return NULL;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
945 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
946
31576
a18eb7b16c5e Remove the _purple_oscar_convert(). It existed to migrate data from
Mark Doliner <markdoliner@pidgin.im>
parents: 31566
diff changeset
947 ret = purple_account_new(name, protocol_id);
14141
cc05956d28dc [gaim-migrate @ 16700]
Daniel Atallah <datallah@pidgin.im>
parents: 14097
diff changeset
948 g_free(name);
cc05956d28dc [gaim-migrate @ 16700]
Daniel Atallah <datallah@pidgin.im>
parents: 14097
diff changeset
949 g_free(protocol_id);
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
950
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
951 /* Read the alias */
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
952 child = xmlnode_get_child(node, "alias");
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
953 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
954 {
11247
3b59f05f78b6 [gaim-migrate @ 13416]
Mark Doliner <markdoliner@pidgin.im>
parents: 11146
diff changeset
955 if (*data != '\0')
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
956 purple_account_set_alias(ret, data);
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
957 g_free(data);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
958 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
959
10738
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
960 /* Read the statuses */
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
961 child = xmlnode_get_child(node, "statuses");
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
962 if (child != NULL)
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
963 {
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
964 parse_statuses(child, ret);
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
965 }
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
966
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
967 /* Read the userinfo */
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
968 child = xmlnode_get_child(node, "userinfo");
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
969 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
970 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
971 purple_account_set_user_info(ret, data);
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
972 g_free(data);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
973 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
974
16538
c7e61e2917c9 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents: 16180
diff changeset
975 /* Read an old buddyicon */
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
976 child = xmlnode_get_child(node, "buddyicon");
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
977 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
978 {
16544
945caa0d6436 Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@pidgin.im>
parents: 16538
diff changeset
979 const char *dirname = purple_buddy_icons_get_cache_dir();
945caa0d6436 Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@pidgin.im>
parents: 16538
diff changeset
980 char *filename = g_build_filename(dirname, data, NULL);
945caa0d6436 Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@pidgin.im>
parents: 16538
diff changeset
981 gchar *contents;
945caa0d6436 Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@pidgin.im>
parents: 16538
diff changeset
982 gsize len;
945caa0d6436 Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@pidgin.im>
parents: 16538
diff changeset
983
945caa0d6436 Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@pidgin.im>
parents: 16538
diff changeset
984 if (g_file_get_contents(filename, &contents, &len, NULL))
945caa0d6436 Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@pidgin.im>
parents: 16538
diff changeset
985 {
945caa0d6436 Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@pidgin.im>
parents: 16538
diff changeset
986 purple_buddy_icons_set_account_icon(ret, (guchar *)contents, len);
945caa0d6436 Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@pidgin.im>
parents: 16538
diff changeset
987 }
945caa0d6436 Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@pidgin.im>
parents: 16538
diff changeset
988
945caa0d6436 Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@pidgin.im>
parents: 16538
diff changeset
989 g_free(filename);
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
990 g_free(data);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
991 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
992
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
993 /* Read settings (both core and UI) */
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
994 for (child = xmlnode_get_child(node, "settings"); child != NULL;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
995 child = xmlnode_get_next_twin(child))
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
996 {
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
997 parse_settings(child, ret);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
998 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
999
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
1000 /* Read proxy */
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
1001 child = xmlnode_get_child(node, "proxy");
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
1002 if (child != NULL)
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
1003 {
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
1004 parse_proxy_info(child, ret);
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
1005 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
1006
21314
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
1007 /* Read current error */
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
1008 child = xmlnode_get_child(node, "current_error");
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
1009 if (child != NULL)
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
1010 {
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
1011 parse_current_error(child, ret);
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
1012 }
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
1013
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33967
diff changeset
1014 /* Read the password */
33982
58a0de711782 Added support for the PURPLE_PLUGIN_FLAG_AUTOLOAD flag, corrected a few bugs and crashed. The compatibility plugin is automatically loaded at startup, and works nicely in compatibility mode (read_sync, write_sync, import, export). Also, I played unsuccessfully with makefiles, so i moved the keyring up one directory. I've finally gotten to the point where I run "make && sudo make install" every now and then.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33981
diff changeset
1015 child = xmlnode_get_child(node, "password");
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33967
diff changeset
1016 if (child != NULL)
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33967
diff changeset
1017 {
34145
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
1018 const char *keyring_id = xmlnode_get_attrib(child, "keyring_id");
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
1019 const char *mode = xmlnode_get_attrib(child, "mode");
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
1020 gboolean result;
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
1021
33982
58a0de711782 Added support for the PURPLE_PLUGIN_FLAG_AUTOLOAD flag, corrected a few bugs and crashed. The compatibility plugin is automatically loaded at startup, and works nicely in compatibility mode (read_sync, write_sync, import, export). Also, I played unsuccessfully with makefiles, so i moved the keyring up one directory. I've finally gotten to the point where I run "make && sudo make install" every now and then.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33981
diff changeset
1022 data = xmlnode_get_data(child);
34125
34c3dbf12e95 Fix some memleaks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34115
diff changeset
1023 result = purple_keyring_import_password(ret, keyring_id, mode, data, NULL);
33982
58a0de711782 Added support for the PURPLE_PLUGIN_FLAG_AUTOLOAD flag, corrected a few bugs and crashed. The compatibility plugin is automatically loaded at startup, and works nicely in compatibility mode (read_sync, write_sync, import, export). Also, I played unsuccessfully with makefiles, so i moved the keyring up one directory. I've finally gotten to the point where I run "make && sudo make install" every now and then.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33981
diff changeset
1024
34157
c67266e97d75 Don't drop exported passwords, when keyring plugin is not loadable
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34146
diff changeset
1025 if (result == TRUE || purple_keyring_get_inuse() == NULL) {
34127
51c1bce7f52f Tidying debug messages, signals
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34125
diff changeset
1026 purple_account_set_remember_password(ret, TRUE);
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33967
diff changeset
1027 } else {
34134
fda68dc6481c Don't require implementing import/export of password
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34127
diff changeset
1028 purple_debug_error("account", "Failed to import password.\n");
33997
035d8594b66a Wrote a caching system that uses account->password to store password.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33996
diff changeset
1029 }
34146
99bad5c80d1e More password wiping, better password management withing account.c, using actual UI name with KWallet
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34145
diff changeset
1030 purple_str_wipe(data);
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33967
diff changeset
1031 }
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33967
diff changeset
1032
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
1033 return ret;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
1034 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
1035
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
1036 static void
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
1037 load_accounts(void)
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
1038 {
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
1039 xmlnode *node, *child;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
1040
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
1041 accounts_loaded = TRUE;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
1042
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1043 node = purple_util_read_xml_from_file("accounts.xml", _("accounts"));
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
1044
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
1045 if (node == NULL)
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
1046 return;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
1047
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
1048 for (child = xmlnode_get_child(node, "account"); child != NULL;
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
1049 child = xmlnode_get_next_twin(child))
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
1050 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1051 PurpleAccount *new_acct;
10490
72932e32f29d [gaim-migrate @ 11780]
Nathan Walp <nwalp@pidgin.im>
parents: 10448
diff changeset
1052 new_acct = parse_account(child);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1053 purple_accounts_add(new_acct);
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
1054 }
11593
71d9d00b36ba [gaim-migrate @ 13863]
Levi Bard <levi@bard.sytes.net>
parents: 11562
diff changeset
1055
71d9d00b36ba [gaim-migrate @ 13863]
Levi Bard <levi@bard.sytes.net>
parents: 11562
diff changeset
1056 xmlnode_free(node);
16565
f5cd28cc7367 Ref the filenames for account buddy icons on load.
Richard Laager <rlaager@pidgin.im>
parents: 16545
diff changeset
1057
16698
1fb16746439f Fix up the private function calls to be prefixed with an underscore.
Richard Laager <rlaager@pidgin.im>
parents: 16659
diff changeset
1058 _purple_buddy_icons_account_loaded_cb();
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
1059 }
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
1060
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
1061
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1062 static void
5794
ebdbb7dc6658 [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5792
diff changeset
1063 delete_setting(void *data)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1064 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1065 PurpleAccountSetting *setting = (PurpleAccountSetting *)data;
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1066
14097
0c340861ab79 [gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents: 13735
diff changeset
1067 g_free(setting->ui);
5777
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
1068
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1069 if (setting->type == PURPLE_PREF_STRING)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1070 g_free(setting->value.string);
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1071
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1072 g_free(setting);
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1073 }
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1074
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1075 PurpleAccount *
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1076 purple_account_new(const char *username, const char *protocol_id)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1077 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1078 PurpleAccount *account = NULL;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1079 PurplePlugin *prpl = NULL;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1080 PurplePluginProtocolInfo *prpl_info = NULL;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1081 PurpleStatusType *status_type;
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1082
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
1083 g_return_val_if_fail(username != NULL, NULL);
9971
8291bafb0025 [gaim-migrate @ 10882]
Daniel Atallah <datallah@pidgin.im>
parents: 9944
diff changeset
1084 g_return_val_if_fail(protocol_id != NULL, NULL);
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1085
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1086 account = purple_accounts_find(username, protocol_id);
5867
46d0ef5058c7 [gaim-migrate @ 6298]
Christian Hammond <chipx86@chipx86.com>
parents: 5865
diff changeset
1087
5874
5e19273d3c6f [gaim-migrate @ 6306]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1088 if (account != NULL)
5e19273d3c6f [gaim-migrate @ 6306]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1089 return account;
5867
46d0ef5058c7 [gaim-migrate @ 6298]
Christian Hammond <chipx86@chipx86.com>
parents: 5865
diff changeset
1090
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1091 account = g_new0(PurpleAccount, 1);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1092 PURPLE_DBUS_REGISTER_POINTER(account, PurpleAccount);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1093
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1094 purple_account_set_username(account, username);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1095
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1096 purple_account_set_protocol_id(account, protocol_id);
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1097
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1098 account->settings = g_hash_table_new_full(g_str_hash, g_str_equal,
5794
ebdbb7dc6658 [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5792
diff changeset
1099 g_free, delete_setting);
5777
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
1100 account->ui_settings = g_hash_table_new_full(g_str_hash, g_str_equal,
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
1101 g_free, (GDestroyNotify)g_hash_table_destroy);
8573
3f37bd7005c8 [gaim-migrate @ 9321]
Ka-Hing Cheung <khc@pidgin.im>
parents: 8549
diff changeset
1102 account->system_log = NULL;
10944
b6f61a32cacc [gaim-migrate @ 12737]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10862
diff changeset
1103 /* 0 is not a valid privacy setting */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1104 account->perm_deny = PURPLE_PRIVACY_ALLOW_ALL;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1105
26986
5b66ec752214 Add account-(created|destroying) signals.
Paul Aurich <darkrain42@pidgin.im>
parents: 26871
diff changeset
1106 purple_signal_emit(purple_accounts_get_handle(), "account-created", account);
5b66ec752214 Add account-(created|destroying) signals.
Paul Aurich <darkrain42@pidgin.im>
parents: 26871
diff changeset
1107
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1108 prpl = purple_find_prpl(protocol_id);
10052
329dad7e2da3 [gaim-migrate @ 11013]
Dave West <kat@users.sourceforge.net>
parents: 10012
diff changeset
1109
10012
da9fdfbf4c5a [gaim-migrate @ 10929]
Nathan Walp <nwalp@pidgin.im>
parents: 10005
diff changeset
1110 if (prpl == NULL)
da9fdfbf4c5a [gaim-migrate @ 10929]
Nathan Walp <nwalp@pidgin.im>
parents: 10005
diff changeset
1111 return account;
10052
329dad7e2da3 [gaim-migrate @ 11013]
Dave West <kat@users.sourceforge.net>
parents: 10012
diff changeset
1112
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1113 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
10738
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
1114 if (prpl_info != NULL && prpl_info->status_types != NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1115 purple_account_set_status_types(account, prpl_info->status_types(account));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1116
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1117 account->presence = purple_presence_new_for_account(account);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1118
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1119 status_type = purple_account_get_status_type_with_primitive(account, PURPLE_STATUS_AVAILABLE);
11982
095ec3ce8b3c [gaim-migrate @ 14275]
Mark Doliner <markdoliner@pidgin.im>
parents: 11979
diff changeset
1120 if (status_type != NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1121 purple_presence_set_status_active(account->presence,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1122 purple_status_type_get_id(status_type),
11982
095ec3ce8b3c [gaim-migrate @ 14275]
Mark Doliner <markdoliner@pidgin.im>
parents: 11979
diff changeset
1123 TRUE);
095ec3ce8b3c [gaim-migrate @ 14275]
Mark Doliner <markdoliner@pidgin.im>
parents: 11979
diff changeset
1124 else
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1125 purple_presence_set_status_active(account->presence,
11982
095ec3ce8b3c [gaim-migrate @ 14275]
Mark Doliner <markdoliner@pidgin.im>
parents: 11979
diff changeset
1126 "offline",
095ec3ce8b3c [gaim-migrate @ 14275]
Mark Doliner <markdoliner@pidgin.im>
parents: 11979
diff changeset
1127 TRUE);
10052
329dad7e2da3 [gaim-migrate @ 11013]
Dave West <kat@users.sourceforge.net>
parents: 10012
diff changeset
1128
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1129 return account;
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1130 }
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1131
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1132 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1133 purple_account_destroy(PurpleAccount *account)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1134 {
18122
9bf9970c1b6a disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents: 18121
diff changeset
1135 GList *l;
7324
17d02b04567c [gaim-migrate @ 7910]
Christian Hammond <chipx86@chipx86.com>
parents: 7263
diff changeset
1136
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1137 g_return_if_fail(account != NULL);
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1138
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1139 purple_debug_info("account", "Destroying account %p\n", account);
26986
5b66ec752214 Add account-(created|destroying) signals.
Paul Aurich <darkrain42@pidgin.im>
parents: 26871
diff changeset
1140 purple_signal_emit(purple_accounts_get_handle(), "account-destroying", account);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1141
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1142 for (l = purple_get_conversations(); l != NULL; l = l->next)
7324
17d02b04567c [gaim-migrate @ 7910]
Christian Hammond <chipx86@chipx86.com>
parents: 7263
diff changeset
1143 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1144 PurpleConversation *conv = (PurpleConversation *)l->data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1145
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1146 if (purple_conversation_get_account(conv) == account)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1147 purple_conversation_set_account(conv, NULL);
7324
17d02b04567c [gaim-migrate @ 7910]
Christian Hammond <chipx86@chipx86.com>
parents: 7263
diff changeset
1148 }
17d02b04567c [gaim-migrate @ 7910]
Christian Hammond <chipx86@chipx86.com>
parents: 7263
diff changeset
1149
11985
d4a210fb43e9 [gaim-migrate @ 14278]
Mark Doliner <markdoliner@pidgin.im>
parents: 11982
diff changeset
1150 g_free(account->username);
d4a210fb43e9 [gaim-migrate @ 14278]
Mark Doliner <markdoliner@pidgin.im>
parents: 11982
diff changeset
1151 g_free(account->alias);
34146
99bad5c80d1e More password wiping, better password management withing account.c, using actual UI name with KWallet
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34145
diff changeset
1152 purple_str_wipe(account->password);
11985
d4a210fb43e9 [gaim-migrate @ 14278]
Mark Doliner <markdoliner@pidgin.im>
parents: 11982
diff changeset
1153 g_free(account->user_info);
15132
672c39839af1 [gaim-migrate @ 17854]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents: 15119
diff changeset
1154 g_free(account->buddy_icon_path);
11985
d4a210fb43e9 [gaim-migrate @ 14278]
Mark Doliner <markdoliner@pidgin.im>
parents: 11982
diff changeset
1155 g_free(account->protocol_id);
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1156
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1157 g_hash_table_destroy(account->settings);
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
1158 g_hash_table_destroy(account->ui_settings);
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1159
31137
9e8bfd01f6bf It looks like this account proxy info is leaked, too.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31092
diff changeset
1160 if (account->proxy_info)
9e8bfd01f6bf It looks like this account proxy info is leaked, too.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31092
diff changeset
1161 purple_proxy_info_destroy(account->proxy_info);
9e8bfd01f6bf It looks like this account proxy info is leaked, too.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31092
diff changeset
1162
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1163 purple_account_set_status_types(account, NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1164
32582
51ebd5886504 I don't know why this happens, but I keep getting a critical debug
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32315
diff changeset
1165 if (account->presence)
51ebd5886504 I don't know why this happens, but I keep getting a critical debug
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32315
diff changeset
1166 purple_presence_destroy(account->presence);
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
1167
8573
3f37bd7005c8 [gaim-migrate @ 9321]
Ka-Hing Cheung <khc@pidgin.im>
parents: 8549
diff changeset
1168 if(account->system_log)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1169 purple_log_free(account->system_log);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1170
28764
96b05c14eeaa account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <darkrain42@pidgin.im>
parents: 28643
diff changeset
1171 while (account->deny) {
96b05c14eeaa account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <darkrain42@pidgin.im>
parents: 28643
diff changeset
1172 g_free(account->deny->data);
96b05c14eeaa account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <darkrain42@pidgin.im>
parents: 28643
diff changeset
1173 account->deny = g_slist_delete_link(account->deny, account->deny);
96b05c14eeaa account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <darkrain42@pidgin.im>
parents: 28643
diff changeset
1174 }
96b05c14eeaa account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <darkrain42@pidgin.im>
parents: 28643
diff changeset
1175
96b05c14eeaa account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <darkrain42@pidgin.im>
parents: 28643
diff changeset
1176 while (account->permit) {
96b05c14eeaa account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <darkrain42@pidgin.im>
parents: 28643
diff changeset
1177 g_free(account->permit->data);
96b05c14eeaa account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <darkrain42@pidgin.im>
parents: 28643
diff changeset
1178 account->permit = g_slist_delete_link(account->permit, account->permit);
96b05c14eeaa account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <darkrain42@pidgin.im>
parents: 28643
diff changeset
1179 }
96b05c14eeaa account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <darkrain42@pidgin.im>
parents: 28643
diff changeset
1180
32628
d3ad4cb046aa The intention is to make PurpleAccount a private structure in account.c, so merge
Andrew Victor <andrew.victor@mxit.com>
parents: 32582
diff changeset
1181 PURPLE_DBUS_UNREGISTER_POINTER(account->current_error);
d3ad4cb046aa The intention is to make PurpleAccount a private structure in account.c, so merge
Andrew Victor <andrew.victor@mxit.com>
parents: 32582
diff changeset
1182 if (account->current_error) {
d3ad4cb046aa The intention is to make PurpleAccount a private structure in account.c, so merge
Andrew Victor <andrew.victor@mxit.com>
parents: 32582
diff changeset
1183 g_free(account->current_error->description);
d3ad4cb046aa The intention is to make PurpleAccount a private structure in account.c, so merge
Andrew Victor <andrew.victor@mxit.com>
parents: 32582
diff changeset
1184 g_free(account->current_error);
28643
6d99167bbe77 Fixing leak is nice, but let's not crash in the process.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28640
diff changeset
1185 }
21287
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
1186
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1187 PURPLE_DBUS_UNREGISTER_POINTER(account);
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1188 g_free(account);
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1189 }
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1190
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
1191 void
17814
c47c22006b0d 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 <am@adiumx.com>
parents: 17800
diff changeset
1192 purple_account_set_register_callback(PurpleAccount *account, PurpleAccountRegistrationCb cb, void *user_data)
c47c22006b0d 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 <am@adiumx.com>
parents: 17800
diff changeset
1193 {
c47c22006b0d 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 <am@adiumx.com>
parents: 17800
diff changeset
1194 g_return_if_fail(account != NULL);
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
1195
17814
c47c22006b0d 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 <am@adiumx.com>
parents: 17800
diff changeset
1196 account->registration_cb = cb;
c47c22006b0d 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 <am@adiumx.com>
parents: 17800
diff changeset
1197 account->registration_cb_user_data = user_data;
c47c22006b0d 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 <am@adiumx.com>
parents: 17800
diff changeset
1198 }
c47c22006b0d 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 <am@adiumx.com>
parents: 17800
diff changeset
1199
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
1200 static void
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
1201 purple_account_register_got_password_cb(PurpleAccount *account,
34145
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
1202 const gchar *password, GError *error, gpointer data)
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
1203 {
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
1204 g_return_if_fail(account != NULL);
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
1205
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
1206 _purple_connection_new(account, TRUE, password);
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
1207 }
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
1208
17814
c47c22006b0d 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 <am@adiumx.com>
parents: 17800
diff changeset
1209 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1210 purple_account_register(PurpleAccount *account)
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
1211 {
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
1212 g_return_if_fail(account != NULL);
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
1213
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1214 purple_debug_info("account", "Registering account %s\n",
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1215 purple_account_get_username(account));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1216
34145
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
1217 purple_keyring_get_password(account,
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
1218 purple_account_register_got_password_cb, NULL);
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
1219 }
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
1220
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
1221 static void
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
1222 purple_account_unregister_got_password_cb(PurpleAccount *account,
34145
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
1223 const gchar *password, GError *error, gpointer data)
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
1224 {
34115
a0f9b38226eb Better name for CbInfo, revert cosmetic changes not related to master password branch
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34111
diff changeset
1225 PurpleCallbackBundle *cbb = data;
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
1226 PurpleAccountUnregistrationCb cb;
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
1227
34115
a0f9b38226eb Better name for CbInfo, revert cosmetic changes not related to master password branch
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34111
diff changeset
1228 cb = (PurpleAccountUnregistrationCb)cbb->cb;
a0f9b38226eb Better name for CbInfo, revert cosmetic changes not related to master password branch
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34111
diff changeset
1229 _purple_connection_new_unregister(account, password, cb, cbb->data);
a0f9b38226eb Better name for CbInfo, revert cosmetic changes not related to master password branch
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34111
diff changeset
1230
a0f9b38226eb Better name for CbInfo, revert cosmetic changes not related to master password branch
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34111
diff changeset
1231 g_free(cbb);
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
1232 }
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
1233
18912
606597744812 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents: 18718
diff changeset
1234 void
32721
3a64afbc2da2 Introduce purple_account_register_completed() to handle the invoking of any
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
1235 purple_account_register_completed(PurpleAccount *account, gboolean succeeded)
3a64afbc2da2 Introduce purple_account_register_completed() to handle the invoking of any
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
1236 {
3a64afbc2da2 Introduce purple_account_register_completed() to handle the invoking of any
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
1237 g_return_if_fail(account != NULL);
3a64afbc2da2 Introduce purple_account_register_completed() to handle the invoking of any
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
1238
3a64afbc2da2 Introduce purple_account_register_completed() to handle the invoking of any
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
1239 if (account->registration_cb)
3a64afbc2da2 Introduce purple_account_register_completed() to handle the invoking of any
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
1240 (account->registration_cb)(account, succeeded, account->registration_cb_user_data);
3a64afbc2da2 Introduce purple_account_register_completed() to handle the invoking of any
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
1241 }
3a64afbc2da2 Introduce purple_account_register_completed() to handle the invoking of any
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
1242
3a64afbc2da2 Introduce purple_account_register_completed() to handle the invoking of any
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
1243 void
18994
310e9d853e2b Implemented a callback for unregistering, mirroring the registration callback. Since this is a new API, I can do it properly by passing it right in the unregister function call, instead of having a separate function for setting it.
Andreas Monitzer <am@adiumx.com>
parents: 18912
diff changeset
1244 purple_account_unregister(PurpleAccount *account, PurpleAccountUnregistrationCb cb, void *user_data)
18912
606597744812 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents: 18718
diff changeset
1245 {
34115
a0f9b38226eb Better name for CbInfo, revert cosmetic changes not related to master password branch
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34111
diff changeset
1246 PurpleCallbackBundle *cbb;
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
1247
18912
606597744812 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents: 18718
diff changeset
1248 g_return_if_fail(account != NULL);
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
1249
18912
606597744812 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents: 18718
diff changeset
1250 purple_debug_info("account", "Unregistering account %s\n",
606597744812 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents: 18718
diff changeset
1251 purple_account_get_username(account));
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
1252
34115
a0f9b38226eb Better name for CbInfo, revert cosmetic changes not related to master password branch
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34111
diff changeset
1253 cbb = g_new0(PurpleCallbackBundle, 1);
a0f9b38226eb Better name for CbInfo, revert cosmetic changes not related to master password branch
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34111
diff changeset
1254 cbb->cb = PURPLE_CALLBACK(cb);
a0f9b38226eb Better name for CbInfo, revert cosmetic changes not related to master password branch
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34111
diff changeset
1255 cbb->data = user_data;
a0f9b38226eb Better name for CbInfo, revert cosmetic changes not related to master password branch
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34111
diff changeset
1256
34145
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
1257 purple_keyring_get_password(account,
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
1258 purple_account_unregister_got_password_cb, cbb);
18912
606597744812 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents: 18718
diff changeset
1259 }
606597744812 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents: 18718
diff changeset
1260
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
1261 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1262 request_password_ok_cb(PurpleAccount *account, PurpleRequestFields *fields)
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
1263 {
11042
d1ccf8d8a187 [gaim-migrate @ 12954]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11033
diff changeset
1264 const char *entry;
d1ccf8d8a187 [gaim-migrate @ 12954]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11033
diff changeset
1265 gboolean remember;
11985
d4a210fb43e9 [gaim-migrate @ 14278]
Mark Doliner <markdoliner@pidgin.im>
parents: 11982
diff changeset
1266
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1267 entry = purple_request_fields_get_string(fields, "password");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1268 remember = purple_request_fields_get_bool(fields, "remember");
11985
d4a210fb43e9 [gaim-migrate @ 14278]
Mark Doliner <markdoliner@pidgin.im>
parents: 11982
diff changeset
1269
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
1270 if (!entry || !*entry)
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
1271 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1272 purple_notify_error(account, NULL, _("Password is required to sign on."), NULL);
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
1273 return;
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
1274 }
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
1275
33996
ca5e901a5311 Implemented a password caching system to limit problems linked to the
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33995
diff changeset
1276 purple_account_set_remember_password(account, remember);
ca5e901a5311 Implemented a password caching system to limit problems linked to the
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33995
diff changeset
1277
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
1278 purple_account_set_password(account, entry, NULL, NULL);
24569
5dbd0617a27d Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents: 24230
diff changeset
1279 _purple_connection_new(account, FALSE, entry);
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
1280 }
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
1281
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
1282 static void
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
1283 request_password_cancel_cb(PurpleAccount *account, PurpleRequestFields *fields)
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
1284 {
30708
535bec1e66fb Standardize on "cancelled".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30456
diff changeset
1285 /* Disable the account as the user has cancelled connecting */
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
1286 purple_account_set_enabled(account, purple_core_get_ui(), FALSE);
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
1287 }
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
1288
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
1289
16180
82761882c366 patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
1290 void
82761882c366 patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
1291 purple_account_request_password(PurpleAccount *account, GCallback ok_cb,
82761882c366 patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
1292 GCallback cancel_cb, void *user_data)
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
1293 {
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
1294 gchar *primary;
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
1295 const gchar *username;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1296 PurpleRequestFieldGroup *group;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1297 PurpleRequestField *field;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1298 PurpleRequestFields *fields;
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
1299
10758
b4554ec8d126 [gaim-migrate @ 12361]
Mark Doliner <markdoliner@pidgin.im>
parents: 10754
diff changeset
1300 /* Close any previous password request windows */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1301 purple_request_close_with_handle(account);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1302
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1303 username = purple_account_get_username(account);
10774
f4238d6312ff [gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10760
diff changeset
1304 primary = g_strdup_printf(_("Enter password for %s (%s)"), username,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1305 purple_account_get_protocol_name(account));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1306
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1307 fields = purple_request_fields_new();
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1308 group = purple_request_field_group_new(NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1309 purple_request_fields_add_group(fields, group);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1310
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1311 field = purple_request_field_string_new("password", _("Enter Password"), NULL, FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1312 purple_request_field_string_set_masked(field, TRUE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1313 purple_request_field_set_required(field, TRUE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1314 purple_request_field_group_add_field(group, field);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1315
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1316 field = purple_request_field_bool_new("remember", _("Save password"), FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1317 purple_request_field_group_add_field(group, field);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1318
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1319 purple_request_fields(account,
11042
d1ccf8d8a187 [gaim-migrate @ 12954]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11033
diff changeset
1320 NULL,
d1ccf8d8a187 [gaim-migrate @ 12954]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11033
diff changeset
1321 primary,
d1ccf8d8a187 [gaim-migrate @ 12954]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11033
diff changeset
1322 NULL,
d1ccf8d8a187 [gaim-migrate @ 12954]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11033
diff changeset
1323 fields,
16180
82761882c366 patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
1324 _("OK"), ok_cb,
82761882c366 patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
1325 _("Cancel"), cancel_cb,
16490
68c22924d66b 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 <evands@pidgin.im>
parents: 16180
diff changeset
1326 account, NULL, NULL,
16180
82761882c366 patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
1327 user_data);
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
1328 g_free(primary);
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
1329 }
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
1330
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
1331 static void
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
1332 purple_account_connect_got_password_cb(PurpleAccount *account,
34145
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
1333 const gchar *password, GError *error, gpointer data)
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
1334 {
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
1335 PurplePluginProtocolInfo *prpl_info = data;
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
1336
34086
6fcec7f32c4a Prompt the user for a password if the keyring's result is non-NULL,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34063
diff changeset
1337 if ((password == NULL || *password == '\0') &&
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
1338 !(prpl_info->options & OPT_PROTO_NO_PASSWORD) &&
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
1339 !(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL))
34145
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
1340 purple_account_request_password(account,
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
1341 G_CALLBACK(request_password_ok_cb),
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
1342 G_CALLBACK(request_password_cancel_cb), account);
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
1343 else
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
1344 _purple_connection_new(account, FALSE, password);
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
1345 }
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
1346
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
1347 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1348 purple_account_connect(PurpleAccount *account)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1349 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1350 PurplePlugin *prpl;
34022
c49f6e9ea27d Make all the prpls build.
Paul Aurich <darkrain42@pidgin.im>
parents: 34021
diff changeset
1351 const char *username;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1352 PurplePluginProtocolInfo *prpl_info;
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
1353
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
1354 g_return_if_fail(account != NULL);
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1355
27575
206581aed04f Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <deryni@pidgin.im>
parents: 25888
diff changeset
1356 username = purple_account_get_username(account);
206581aed04f Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <deryni@pidgin.im>
parents: 25888
diff changeset
1357
206581aed04f Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <deryni@pidgin.im>
parents: 25888
diff changeset
1358 if (!purple_account_get_enabled(account, purple_core_get_ui())) {
206581aed04f Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <deryni@pidgin.im>
parents: 25888
diff changeset
1359 purple_debug_info("account",
206581aed04f Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <deryni@pidgin.im>
parents: 25888
diff changeset
1360 "Account %s not enabled, not connecting.\n",
206581aed04f Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <deryni@pidgin.im>
parents: 25888
diff changeset
1361 username);
11722
8cad41c3c5b9 [gaim-migrate @ 14013]
Mark Doliner <markdoliner@pidgin.im>
parents: 11643
diff changeset
1362 return;
27575
206581aed04f Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <deryni@pidgin.im>
parents: 25888
diff changeset
1363 }
11722
8cad41c3c5b9 [gaim-migrate @ 14013]
Mark Doliner <markdoliner@pidgin.im>
parents: 11643
diff changeset
1364
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1365 prpl = purple_find_prpl(purple_account_get_protocol_id(account));
27575
206581aed04f Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <deryni@pidgin.im>
parents: 25888
diff changeset
1366 if (prpl == NULL) {
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
1367 gchar *message;
6036
285e48913c72 [gaim-migrate @ 6486]
Mark Doliner <markdoliner@pidgin.im>
parents: 5979
diff changeset
1368
27575
206581aed04f Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <deryni@pidgin.im>
parents: 25888
diff changeset
1369 message = g_strdup_printf(_("Missing protocol plugin for %s"), username);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1370 purple_notify_error(account, _("Connection Error"), message, NULL);
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
1371 g_free(message);
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
1372 return;
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
1373 }
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1374
27575
206581aed04f Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <deryni@pidgin.im>
parents: 25888
diff changeset
1375 purple_debug_info("account", "Connecting to account %s.\n", username);
206581aed04f Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <deryni@pidgin.im>
parents: 25888
diff changeset
1376
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1377 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
34146
99bad5c80d1e More password wiping, better password management withing account.c, using actual UI name with KWallet
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34145
diff changeset
1378 if (account->password != NULL) {
99bad5c80d1e More password wiping, better password management withing account.c, using actual UI name with KWallet
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34145
diff changeset
1379 purple_account_connect_got_password_cb(account,
99bad5c80d1e More password wiping, better password management withing account.c, using actual UI name with KWallet
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34145
diff changeset
1380 account->password, NULL, prpl_info);
99bad5c80d1e More password wiping, better password management withing account.c, using actual UI name with KWallet
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34145
diff changeset
1381 } else {
99bad5c80d1e More password wiping, better password management withing account.c, using actual UI name with KWallet
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34145
diff changeset
1382 purple_keyring_get_password(account,
99bad5c80d1e More password wiping, better password management withing account.c, using actual UI name with KWallet
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34145
diff changeset
1383 purple_account_connect_got_password_cb, prpl_info);
99bad5c80d1e More password wiping, better password management withing account.c, using actual UI name with KWallet
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34145
diff changeset
1384 }
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1385 }
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1386
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1387 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1388 purple_account_disconnect(PurpleAccount *account)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1389 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1390 PurpleConnection *gc;
28373
14e79bd71ac3 Display the username in the debug log when disconnecting an account.
Paul Aurich <darkrain42@pidgin.im>
parents: 27969
diff changeset
1391 const char *username;
5926
f0c5bbf16793 [gaim-migrate @ 6366]
Christian Hammond <chipx86@chipx86.com>
parents: 5879
diff changeset
1392
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1393 g_return_if_fail(account != NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1394 g_return_if_fail(!purple_account_is_disconnected(account));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1395
28373
14e79bd71ac3 Display the username in the debug log when disconnecting an account.
Paul Aurich <darkrain42@pidgin.im>
parents: 27969
diff changeset
1396 username = purple_account_get_username(account);
14e79bd71ac3 Display the username in the debug log when disconnecting an account.
Paul Aurich <darkrain42@pidgin.im>
parents: 27969
diff changeset
1397 purple_debug_info("account", "Disconnecting account %s (%p)\n",
14e79bd71ac3 Display the username in the debug log when disconnecting an account.
Paul Aurich <darkrain42@pidgin.im>
parents: 27969
diff changeset
1398 username ? username : "(null)", account);
5930
cdd2e5397cd3 [gaim-migrate @ 6370]
Christian Hammond <chipx86@chipx86.com>
parents: 5926
diff changeset
1399
10384
16c214b87337 [gaim-migrate @ 11610]
Tim Ringenbach <marv@pidgin.im>
parents: 10309
diff changeset
1400 account->disconnecting = TRUE;
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1401
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1402 gc = purple_account_get_connection(account);
24569
5dbd0617a27d Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents: 24230
diff changeset
1403 _purple_connection_destroy(gc);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1404 purple_account_set_connection(account, NULL);
10384
16c214b87337 [gaim-migrate @ 11610]
Tim Ringenbach <marv@pidgin.im>
parents: 10309
diff changeset
1405
16c214b87337 [gaim-migrate @ 11610]
Tim Ringenbach <marv@pidgin.im>
parents: 10309
diff changeset
1406 account->disconnecting = FALSE;
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1407 }
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1408
32722
50ed95d90d55 Add purple_account_is_disconnecting() accessor function.
Andrew Victor <andrew.victor@mxit.com>
parents: 32721
diff changeset
1409 gboolean
50ed95d90d55 Add purple_account_is_disconnecting() accessor function.
Andrew Victor <andrew.victor@mxit.com>
parents: 32721
diff changeset
1410 purple_account_is_disconnecting(const PurpleAccount *account)
50ed95d90d55 Add purple_account_is_disconnecting() accessor function.
Andrew Victor <andrew.victor@mxit.com>
parents: 32721
diff changeset
1411 {
50ed95d90d55 Add purple_account_is_disconnecting() accessor function.
Andrew Victor <andrew.victor@mxit.com>
parents: 32721
diff changeset
1412 g_return_val_if_fail(account != NULL, TRUE);
34115
a0f9b38226eb Better name for CbInfo, revert cosmetic changes not related to master password branch
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34111
diff changeset
1413
32722
50ed95d90d55 Add purple_account_is_disconnecting() accessor function.
Andrew Victor <andrew.victor@mxit.com>
parents: 32721
diff changeset
1414 return account->disconnecting;
50ed95d90d55 Add purple_account_is_disconnecting() accessor function.
Andrew Victor <andrew.victor@mxit.com>
parents: 32721
diff changeset
1415 }
50ed95d90d55 Add purple_account_is_disconnecting() accessor function.
Andrew Victor <andrew.victor@mxit.com>
parents: 32721
diff changeset
1416
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1417 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1418 purple_account_notify_added(PurpleAccount *account, const char *remote_user,
12287
d4b4c3745f2f [gaim-migrate @ 14591]
Etan Reisner <deryni@pidgin.im>
parents: 12286
diff changeset
1419 const char *id, const char *alias,
12286
08d994091c36 [gaim-migrate @ 14590]
Etan Reisner <deryni@pidgin.im>
parents: 12285
diff changeset
1420 const char *message)
7015
bea9111282b3 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1421 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1422 PurpleAccountUiOps *ui_ops;
7015
bea9111282b3 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1423
bea9111282b3 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1424 g_return_if_fail(account != NULL);
bea9111282b3 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1425 g_return_if_fail(remote_user != NULL);
bea9111282b3 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1426
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1427 ui_ops = purple_accounts_get_ui_ops();
7015
bea9111282b3 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1428
bea9111282b3 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1429 if (ui_ops != NULL && ui_ops->notify_added != NULL)
bea9111282b3 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1430 ui_ops->notify_added(account, remote_user, id, alias, message);
bea9111282b3 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1431 }
bea9111282b3 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1432
12285
5a0f4619b0c5 [gaim-migrate @ 14589]
Etan Reisner <deryni@pidgin.im>
parents: 12088
diff changeset
1433 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1434 purple_account_request_add(PurpleAccount *account, const char *remote_user,
12285
5a0f4619b0c5 [gaim-migrate @ 14589]
Etan Reisner <deryni@pidgin.im>
parents: 12088
diff changeset
1435 const char *id, const char *alias,
5a0f4619b0c5 [gaim-migrate @ 14589]
Etan Reisner <deryni@pidgin.im>
parents: 12088
diff changeset
1436 const char *message)
5a0f4619b0c5 [gaim-migrate @ 14589]
Etan Reisner <deryni@pidgin.im>
parents: 12088
diff changeset
1437 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1438 PurpleAccountUiOps *ui_ops;
12285
5a0f4619b0c5 [gaim-migrate @ 14589]
Etan Reisner <deryni@pidgin.im>
parents: 12088
diff changeset
1439
5a0f4619b0c5 [gaim-migrate @ 14589]
Etan Reisner <deryni@pidgin.im>
parents: 12088
diff changeset
1440 g_return_if_fail(account != NULL);
5a0f4619b0c5 [gaim-migrate @ 14589]
Etan Reisner <deryni@pidgin.im>
parents: 12088
diff changeset
1441 g_return_if_fail(remote_user != NULL);
5a0f4619b0c5 [gaim-migrate @ 14589]
Etan Reisner <deryni@pidgin.im>
parents: 12088
diff changeset
1442
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1443 ui_ops = purple_accounts_get_ui_ops();
12285
5a0f4619b0c5 [gaim-migrate @ 14589]
Etan Reisner <deryni@pidgin.im>
parents: 12088
diff changeset
1444
5a0f4619b0c5 [gaim-migrate @ 14589]
Etan Reisner <deryni@pidgin.im>
parents: 12088
diff changeset
1445 if (ui_ops != NULL && ui_ops->request_add != NULL)
5a0f4619b0c5 [gaim-migrate @ 14589]
Etan Reisner <deryni@pidgin.im>
parents: 12088
diff changeset
1446 ui_ops->request_add(account, remote_user, id, alias, message);
5a0f4619b0c5 [gaim-migrate @ 14589]
Etan Reisner <deryni@pidgin.im>
parents: 12088
diff changeset
1447 }
5a0f4619b0c5 [gaim-migrate @ 14589]
Etan Reisner <deryni@pidgin.im>
parents: 12088
diff changeset
1448
25113
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
1449 static PurpleAccountRequestInfo *
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
1450 purple_account_request_info_unref(PurpleAccountRequestInfo *info)
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
1451 {
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
1452 if (--info->ref)
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
1453 return info;
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
1454
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
1455 /* TODO: This will leak info->user_data, but there is no callback to just clean that up */
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
1456 g_free(info->user);
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
1457 g_free(info);
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
1458 return NULL;
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
1459 }
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
1460
15537
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1461 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1462 purple_account_request_close_info(PurpleAccountRequestInfo *info)
15537
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1463 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1464 PurpleAccountUiOps *ops;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1465
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1466 ops = purple_accounts_get_ui_ops();
15537
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1467
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1468 if (ops != NULL && ops->close_account_request != NULL)
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1469 ops->close_account_request(info->ui_handle);
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1470
25113
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
1471 purple_account_request_info_unref(info);
15537
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1472 }
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1473
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
1474 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1475 purple_account_request_close_with_account(PurpleAccount *account)
15537
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1476 {
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1477 GList *l, *l_next;
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
1478
15537
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1479 g_return_if_fail(account != NULL);
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
1480
15537
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1481 for (l = handles; l != NULL; l = l_next) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1482 PurpleAccountRequestInfo *info = l->data;
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
1483
15537
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1484 l_next = l->next;
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
1485
15537
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1486 if (info->account == account) {
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1487 handles = g_list_remove(handles, info);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1488 purple_account_request_close_info(info);
15537
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1489 }
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1490 }
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1491 }
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1492
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
1493 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1494 purple_account_request_close(void *ui_handle)
15537
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1495 {
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1496 GList *l, *l_next;
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
1497
15537
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1498 g_return_if_fail(ui_handle != NULL);
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
1499
15537
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1500 for (l = handles; l != NULL; l = l_next) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1501 PurpleAccountRequestInfo *info = l->data;
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
1502
15537
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1503 l_next = l->next;
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
1504
15537
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1505 if (info->ui_handle == ui_handle) {
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1506 handles = g_list_remove(handles, info);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1507 purple_account_request_close_info(info);
15537
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1508 }
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1509 }
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1510 }
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1511
20421
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
1512 static void
33687
0819d40769c8 Add a message to the authorization callbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33686
diff changeset
1513 request_auth_cb(const char *message, void *data)
20421
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
1514 {
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
1515 PurpleAccountRequestInfo *info = data;
22177
d3858cc821a8 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 <datallah@pidgin.im>
parents: 22104
diff changeset
1516
d3858cc821a8 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 <datallah@pidgin.im>
parents: 22104
diff changeset
1517 handles = g_list_remove(handles, info);
d3858cc821a8 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 <datallah@pidgin.im>
parents: 22104
diff changeset
1518
29046
1cae96b8e674 *** Plucked rev 0707f870a510922ae86ef379b5f01efa76d01402 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <datallah@pidgin.im>
parents: 28764
diff changeset
1519 if (info->auth_cb != NULL)
33687
0819d40769c8 Add a message to the authorization callbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33686
diff changeset
1520 info->auth_cb(message, info->userdata);
22177
d3858cc821a8 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 <datallah@pidgin.im>
parents: 22104
diff changeset
1521
20421
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
1522 purple_signal_emit(purple_accounts_get_handle(),
33688
9454bda83147 Add response message to authorization signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33687
diff changeset
1523 "account-authorization-granted", info->account, info->user, message);
22177
d3858cc821a8 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 <datallah@pidgin.im>
parents: 22104
diff changeset
1524
25113
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
1525 purple_account_request_info_unref(info);
20421
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
1526 }
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
1527
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
1528 static void
33687
0819d40769c8 Add a message to the authorization callbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33686
diff changeset
1529 request_deny_cb(const char *message, void *data)
20421
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
1530 {
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
1531 PurpleAccountRequestInfo *info = data;
22177
d3858cc821a8 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 <datallah@pidgin.im>
parents: 22104
diff changeset
1532
d3858cc821a8 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 <datallah@pidgin.im>
parents: 22104
diff changeset
1533 handles = g_list_remove(handles, info);
d3858cc821a8 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 <datallah@pidgin.im>
parents: 22104
diff changeset
1534
29046
1cae96b8e674 *** Plucked rev 0707f870a510922ae86ef379b5f01efa76d01402 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <datallah@pidgin.im>
parents: 28764
diff changeset
1535 if (info->deny_cb != NULL)
33687
0819d40769c8 Add a message to the authorization callbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33686
diff changeset
1536 info->deny_cb(message, info->userdata);
22177
d3858cc821a8 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 <datallah@pidgin.im>
parents: 22104
diff changeset
1537
20421
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
1538 purple_signal_emit(purple_accounts_get_handle(),
33688
9454bda83147 Add response message to authorization signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33687
diff changeset
1539 "account-authorization-denied", info->account, info->user, message);
22177
d3858cc821a8 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 <datallah@pidgin.im>
parents: 22104
diff changeset
1540
25113
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
1541 purple_account_request_info_unref(info);
20421
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
1542 }
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
1543
15537
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1544 void *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1545 purple_account_request_authorization(PurpleAccount *account, const char *remote_user,
19335
4613b53d5741 Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <datallah@pidgin.im>
parents: 18636
diff changeset
1546 const char *id, const char *alias, const char *message, gboolean on_list,
4613b53d5741 Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <datallah@pidgin.im>
parents: 18636
diff changeset
1547 PurpleAccountRequestAuthorizationCb auth_cb, PurpleAccountRequestAuthorizationCb deny_cb, void *user_data)
15119
28d34487ac71 [gaim-migrate @ 17841]
Sean Egan <seanegan@pidgin.im>
parents: 15117
diff changeset
1548 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1549 PurpleAccountUiOps *ui_ops;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1550 PurpleAccountRequestInfo *info;
20421
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
1551 int plugin_return;
33688
9454bda83147 Add response message to authorization signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33687
diff changeset
1552 char *response = NULL;
15537
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1553
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1554 g_return_val_if_fail(account != NULL, NULL);
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1555 g_return_val_if_fail(remote_user != NULL, NULL);
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1556
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1557 ui_ops = purple_accounts_get_ui_ops();
15537
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1558
20421
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
1559 plugin_return = GPOINTER_TO_INT(
31325
2bb18e0658e7 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31137
diff changeset
1560 purple_signal_emit_return_1(
2bb18e0658e7 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31137
diff changeset
1561 purple_accounts_get_handle(),
33686
0f6df320414b Remove duplicate account-authorization-requested-with-message signal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32722
diff changeset
1562 "account-authorization-requested",
33688
9454bda83147 Add response message to authorization signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33687
diff changeset
1563 account, remote_user, message, &response
31325
2bb18e0658e7 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31137
diff changeset
1564 ));
2bb18e0658e7 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31137
diff changeset
1565
2bb18e0658e7 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31137
diff changeset
1566 switch (plugin_return)
2bb18e0658e7 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31137
diff changeset
1567 {
2bb18e0658e7 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31137
diff changeset
1568 case PURPLE_ACCOUNT_RESPONSE_IGNORE:
33688
9454bda83147 Add response message to authorization signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33687
diff changeset
1569 g_free(response);
31325
2bb18e0658e7 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31137
diff changeset
1570 return NULL;
2bb18e0658e7 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31137
diff changeset
1571 case PURPLE_ACCOUNT_RESPONSE_ACCEPT:
2bb18e0658e7 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31137
diff changeset
1572 if (auth_cb != NULL)
33688
9454bda83147 Add response message to authorization signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33687
diff changeset
1573 auth_cb(response, user_data);
9454bda83147 Add response message to authorization signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33687
diff changeset
1574 g_free(response);
31325
2bb18e0658e7 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31137
diff changeset
1575 return NULL;
2bb18e0658e7 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31137
diff changeset
1576 case PURPLE_ACCOUNT_RESPONSE_DENY:
2bb18e0658e7 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31137
diff changeset
1577 if (deny_cb != NULL)
33688
9454bda83147 Add response message to authorization signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33687
diff changeset
1578 deny_cb(response, user_data);
9454bda83147 Add response message to authorization signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33687
diff changeset
1579 g_free(response);
31325
2bb18e0658e7 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31137
diff changeset
1580 return NULL;
2bb18e0658e7 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31137
diff changeset
1581 }
2bb18e0658e7 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31137
diff changeset
1582
33688
9454bda83147 Add response message to authorization signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33687
diff changeset
1583 g_free(response);
9454bda83147 Add response message to authorization signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33687
diff changeset
1584
15537
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1585 if (ui_ops != NULL && ui_ops->request_authorize != NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1586 info = g_new0(PurpleAccountRequestInfo, 1);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1587 info->type = PURPLE_ACCOUNT_REQUEST_AUTHORIZATION;
15537
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1588 info->account = account;
20421
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
1589 info->auth_cb = auth_cb;
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
1590 info->deny_cb = deny_cb;
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
1591 info->userdata = user_data;
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
1592 info->user = g_strdup(remote_user);
25113
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
1593 info->ref = 2; /* We hold an extra ref to make sure info remains valid
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
1594 if any of the callbacks are called synchronously. We
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
1595 unref it after the function call */
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
1596
15537
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1597 info->ui_handle = ui_ops->request_authorize(account, remote_user, id, alias, message,
20421
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
1598 on_list, request_auth_cb, request_deny_cb, info);
19335
4613b53d5741 Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <datallah@pidgin.im>
parents: 18636
diff changeset
1599
25113
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
1600 info = purple_account_request_info_unref(info);
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
1601 if (info) {
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
1602 handles = g_list_append(handles, info);
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
1603 return info->ui_handle;
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
1604 }
15537
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1605 }
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
1606
15537
5d7473f14c67 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 <evands@pidgin.im>
parents: 15482
diff changeset
1607 return NULL;
15119
28d34487ac71 [gaim-migrate @ 17841]
Sean Egan <seanegan@pidgin.im>
parents: 15117
diff changeset
1608 }
28d34487ac71 [gaim-migrate @ 17841]
Sean Egan <seanegan@pidgin.im>
parents: 15117
diff changeset
1609
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1610 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1611 change_password_cb(PurpleAccount *account, PurpleRequestFields *fields)
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1612 {
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1613 const char *orig_pass, *new_pass_1, *new_pass_2;
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1614
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1615 orig_pass = purple_request_fields_get_string(fields, "password");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1616 new_pass_1 = purple_request_fields_get_string(fields, "new_password_1");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1617 new_pass_2 = purple_request_fields_get_string(fields, "new_password_2");
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1618
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1619 if (g_utf8_collate(new_pass_1, new_pass_2))
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1620 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1621 purple_notify_error(account, NULL,
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1622 _("New passwords do not match."), NULL);
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1623
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1624 return;
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1625 }
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1626
22854
0002c0556d57 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22484
diff changeset
1627 if ((purple_request_fields_is_field_required(fields, "password") &&
0002c0556d57 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22484
diff changeset
1628 (orig_pass == NULL || *orig_pass == '\0')) ||
0002c0556d57 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22484
diff changeset
1629 (purple_request_fields_is_field_required(fields, "new_password_1") &&
0002c0556d57 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22484
diff changeset
1630 (new_pass_1 == NULL || *new_pass_1 == '\0')) ||
0002c0556d57 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22484
diff changeset
1631 (purple_request_fields_is_field_required(fields, "new_password_2") &&
0002c0556d57 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22484
diff changeset
1632 (new_pass_2 == NULL || *new_pass_2 == '\0')))
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1633 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1634 purple_notify_error(account, NULL,
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1635 _("Fill out all fields completely."), NULL);
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1636 return;
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1637 }
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1638
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1639 purple_account_change_password(account, orig_pass, new_pass_1);
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1640 }
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1641
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1642 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1643 purple_account_request_change_password(PurpleAccount *account)
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1644 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1645 PurpleRequestFields *fields;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1646 PurpleRequestFieldGroup *group;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1647 PurpleRequestField *field;
22854
0002c0556d57 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22484
diff changeset
1648 PurpleConnection *gc;
0002c0556d57 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22484
diff changeset
1649 PurplePlugin *prpl = NULL;
0002c0556d57 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22484
diff changeset
1650 PurplePluginProtocolInfo *prpl_info = NULL;
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1651 char primary[256];
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1652
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1653 g_return_if_fail(account != NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1654 g_return_if_fail(purple_account_is_connected(account));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1655
22854
0002c0556d57 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22484
diff changeset
1656 gc = purple_account_get_connection(account);
0002c0556d57 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22484
diff changeset
1657 if (gc != NULL)
0002c0556d57 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22484
diff changeset
1658 prpl = purple_connection_get_prpl(gc);
0002c0556d57 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22484
diff changeset
1659 if (prpl != NULL)
0002c0556d57 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22484
diff changeset
1660 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
0002c0556d57 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22484
diff changeset
1661
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1662 fields = purple_request_fields_new();
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1663
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1664 group = purple_request_field_group_new(NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1665 purple_request_fields_add_group(fields, group);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1666
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1667 field = purple_request_field_string_new("password", _("Original password"),
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1668 NULL, FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1669 purple_request_field_string_set_masked(field, TRUE);
33786
909e73523124 libpurple: fix incorrect check for password being optional (it was always being
Daniel Atallah <datallah@pidgin.im>
parents: 31885
diff changeset
1670 if (!prpl_info || !(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL))
22854
0002c0556d57 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22484
diff changeset
1671 purple_request_field_set_required(field, TRUE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1672 purple_request_field_group_add_field(group, field);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1673
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1674 field = purple_request_field_string_new("new_password_1",
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1675 _("New password"),
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1676 NULL, FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1677 purple_request_field_string_set_masked(field, TRUE);
33786
909e73523124 libpurple: fix incorrect check for password being optional (it was always being
Daniel Atallah <datallah@pidgin.im>
parents: 31885
diff changeset
1678 if (!prpl_info || !(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL))
22854
0002c0556d57 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22484
diff changeset
1679 purple_request_field_set_required(field, TRUE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1680 purple_request_field_group_add_field(group, field);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1681
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1682 field = purple_request_field_string_new("new_password_2",
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1683 _("New password (again)"),
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1684 NULL, FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1685 purple_request_field_string_set_masked(field, TRUE);
33786
909e73523124 libpurple: fix incorrect check for password being optional (it was always being
Daniel Atallah <datallah@pidgin.im>
parents: 31885
diff changeset
1686 if (!prpl_info || !(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL))
22854
0002c0556d57 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22484
diff changeset
1687 purple_request_field_set_required(field, TRUE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1688 purple_request_field_group_add_field(group, field);
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1689
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1690 g_snprintf(primary, sizeof(primary), _("Change password for %s"),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1691 purple_account_get_username(account));
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1692
7755
a08288ab4e5f [gaim-migrate @ 8400]
Mark Doliner <markdoliner@pidgin.im>
parents: 7654
diff changeset
1693 /* I'm sticking this somewhere in the code: bologna */
a08288ab4e5f [gaim-migrate @ 8400]
Mark Doliner <markdoliner@pidgin.im>
parents: 7654
diff changeset
1694
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1695 purple_request_fields(purple_account_get_connection(account),
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1696 NULL,
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1697 primary,
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1698 _("Please enter your current password and your "
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1699 "new password."),
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1700 fields,
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1701 _("OK"), G_CALLBACK(change_password_cb),
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1702 _("Cancel"), NULL,
16490
68c22924d66b 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 <evands@pidgin.im>
parents: 16180
diff changeset
1703 account, NULL, NULL,
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1704 account);
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1705 }
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1706
7067
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
1707 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1708 set_user_info_cb(PurpleAccount *account, const char *user_info)
7067
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
1709 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1710 PurpleConnection *gc;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1711
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1712 purple_account_set_user_info(account, user_info);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1713 gc = purple_account_get_connection(account);
14669
df3f48ab4aff [gaim-migrate @ 17335]
Mark Doliner <markdoliner@pidgin.im>
parents: 14254
diff changeset
1714 serv_set_info(gc, user_info);
7067
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
1715 }
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
1716
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
1717 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1718 purple_account_request_change_user_info(PurpleAccount *account)
7067
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
1719 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1720 PurpleConnection *gc;
7067
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
1721 char primary[256];
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
1722
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
1723 g_return_if_fail(account != NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1724 g_return_if_fail(purple_account_is_connected(account));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1725
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1726 gc = purple_account_get_connection(account);
8697
c5e51aef2026 [gaim-migrate @ 9450]
Jon Oberheide
parents: 8658
diff changeset
1727
7067
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
1728 g_snprintf(primary, sizeof(primary),
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
1729 _("Change user information for %s"),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1730 purple_account_get_username(account));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1731
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1732 purple_request_input(gc, _("Set User Info"), primary, NULL,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1733 purple_account_get_user_info(account),
8697
c5e51aef2026 [gaim-migrate @ 9450]
Jon Oberheide
parents: 8658
diff changeset
1734 TRUE, FALSE, ((gc != NULL) &&
32678
01f6312a4a7b On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents: 32634
diff changeset
1735 (purple_connection_get_flags(gc) & PURPLE_CONNECTION_HTML) ? "html" : NULL),
7067
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
1736 _("Save"), G_CALLBACK(set_user_info_cb),
16490
68c22924d66b 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 <evands@pidgin.im>
parents: 16180
diff changeset
1737 _("Cancel"), NULL,
68c22924d66b 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 <evands@pidgin.im>
parents: 16180
diff changeset
1738 account, NULL, NULL,
68c22924d66b 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 <evands@pidgin.im>
parents: 16180
diff changeset
1739 account);
7067
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
1740 }
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
1741
7015
bea9111282b3 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1742 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1743 purple_account_set_username(PurpleAccount *account, const char *username)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1744 {
27969
ed5bf3c3e328 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
Jan Kaluza <hanzz.k@gmail.com>
parents: 27638
diff changeset
1745 PurpleBlistUiOps *blist_ops;
ed5bf3c3e328 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
Jan Kaluza <hanzz.k@gmail.com>
parents: 27638
diff changeset
1746
5711
5aa3984f5f80 [gaim-migrate @ 6132]
Christian Hammond <chipx86@chipx86.com>
parents: 5710
diff changeset
1747 g_return_if_fail(account != NULL);
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1748
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
1749 g_free(account->username);
14097
0c340861ab79 [gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents: 13735
diff changeset
1750 account->username = g_strdup(username);
5573
633880e3f137 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5565
diff changeset
1751
633880e3f137 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5565
diff changeset
1752 schedule_accounts_save();
15163
168bfdeffed8 [gaim-migrate @ 17887]
Nathan Walp <nwalp@pidgin.im>
parents: 15132
diff changeset
1753
168bfdeffed8 [gaim-migrate @ 17887]
Nathan Walp <nwalp@pidgin.im>
parents: 15132
diff changeset
1754 /* if the name changes, we should re-write the buddy list
168bfdeffed8 [gaim-migrate @ 17887]
Nathan Walp <nwalp@pidgin.im>
parents: 15132
diff changeset
1755 * to disk with the new name */
27969
ed5bf3c3e328 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
Jan Kaluza <hanzz.k@gmail.com>
parents: 27638
diff changeset
1756 blist_ops = purple_blist_get_ui_ops();
ed5bf3c3e328 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
Jan Kaluza <hanzz.k@gmail.com>
parents: 27638
diff changeset
1757 if (blist_ops != NULL && blist_ops->save_account != NULL)
ed5bf3c3e328 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
Jan Kaluza <hanzz.k@gmail.com>
parents: 27638
diff changeset
1758 blist_ops->save_account(account);
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1759 }
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1760
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
1761 void
34145
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
1762 purple_account_set_password(PurpleAccount *account, const gchar *password,
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
1763 PurpleKeyringSaveCallback cb, gpointer data)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1764 {
5777
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
1765 g_return_if_fail(account != NULL);
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1766
34146
99bad5c80d1e More password wiping, better password management withing account.c, using actual UI name with KWallet
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34145
diff changeset
1767 purple_str_wipe(account->password);
14097
0c340861ab79 [gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents: 13735
diff changeset
1768 account->password = g_strdup(password);
5573
633880e3f137 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5565
diff changeset
1769
633880e3f137 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5565
diff changeset
1770 schedule_accounts_save();
34056
07643afffcdc Replace one hack with another. Maybe we want to think about something
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34029
diff changeset
1771
34145
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
1772 if (!purple_account_get_remember_password(account)) {
33997
035d8594b66a Wrote a caching system that uses account->password to store password.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33996
diff changeset
1773 purple_debug_info("account",
035d8594b66a Wrote a caching system that uses account->password to store password.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33996
diff changeset
1774 "Password for %s set, not sent to keyring.\n",
035d8594b66a Wrote a caching system that uses account->password to store password.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33996
diff changeset
1775 purple_account_get_username(account));
035d8594b66a Wrote a caching system that uses account->password to store password.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33996
diff changeset
1776
035d8594b66a Wrote a caching system that uses account->password to store password.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33996
diff changeset
1777 if (cb != NULL)
035d8594b66a Wrote a caching system that uses account->password to store password.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33996
diff changeset
1778 cb(account, NULL, data);
035d8594b66a Wrote a caching system that uses account->password to store password.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33996
diff changeset
1779 } else {
34029
059c1270db1f Remove the silly destroy argument from purple_account_set_password and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34028
diff changeset
1780 purple_keyring_set_password(account, password, cb, data);
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
1781 }
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1782 }
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1783
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1784 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1785 purple_account_set_alias(PurpleAccount *account, const char *alias)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1786 {
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1787 g_return_if_fail(account != NULL);
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1788
13731
220d399fc026 [gaim-migrate @ 16140]
Mark Doliner <markdoliner@pidgin.im>
parents: 13678
diff changeset
1789 /*
220d399fc026 [gaim-migrate @ 16140]
Mark Doliner <markdoliner@pidgin.im>
parents: 13678
diff changeset
1790 * Do nothing if alias and account->alias are both NULL. Or if
220d399fc026 [gaim-migrate @ 16140]
Mark Doliner <markdoliner@pidgin.im>
parents: 13678
diff changeset
1791 * they're the exact same string.
220d399fc026 [gaim-migrate @ 16140]
Mark Doliner <markdoliner@pidgin.im>
parents: 13678
diff changeset
1792 */
220d399fc026 [gaim-migrate @ 16140]
Mark Doliner <markdoliner@pidgin.im>
parents: 13678
diff changeset
1793 if (alias == account->alias)
220d399fc026 [gaim-migrate @ 16140]
Mark Doliner <markdoliner@pidgin.im>
parents: 13678
diff changeset
1794 return;
220d399fc026 [gaim-migrate @ 16140]
Mark Doliner <markdoliner@pidgin.im>
parents: 13678
diff changeset
1795
13282
83e33fe74de3 [gaim-migrate @ 15647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13120
diff changeset
1796 if ((!alias && account->alias) || (alias && !account->alias) ||
83e33fe74de3 [gaim-migrate @ 15647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13120
diff changeset
1797 g_utf8_collate(account->alias, alias))
83e33fe74de3 [gaim-migrate @ 15647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13120
diff changeset
1798 {
83e33fe74de3 [gaim-migrate @ 15647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13120
diff changeset
1799 char *old = account->alias;
83e33fe74de3 [gaim-migrate @ 15647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13120
diff changeset
1800
14097
0c340861ab79 [gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents: 13735
diff changeset
1801 account->alias = g_strdup(alias);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1802 purple_signal_emit(purple_accounts_get_handle(), "account-alias-changed",
13282
83e33fe74de3 [gaim-migrate @ 15647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13120
diff changeset
1803 account, old);
83e33fe74de3 [gaim-migrate @ 15647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13120
diff changeset
1804 g_free(old);
83e33fe74de3 [gaim-migrate @ 15647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13120
diff changeset
1805
83e33fe74de3 [gaim-migrate @ 15647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13120
diff changeset
1806 schedule_accounts_save();
83e33fe74de3 [gaim-migrate @ 15647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13120
diff changeset
1807 }
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1808 }
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1809
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1810 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1811 purple_account_set_user_info(PurpleAccount *account, const char *user_info)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1812 {
5777
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
1813 g_return_if_fail(account != NULL);
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1814
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
1815 g_free(account->user_info);
14097
0c340861ab79 [gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents: 13735
diff changeset
1816 account->user_info = g_strdup(user_info);
5573
633880e3f137 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5565
diff changeset
1817
633880e3f137 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5565
diff changeset
1818 schedule_accounts_save();
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1819 }
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1820
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1821 void purple_account_set_buddy_icon_path(PurpleAccount *account, const char *path)
15132
672c39839af1 [gaim-migrate @ 17854]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents: 15119
diff changeset
1822 {
672c39839af1 [gaim-migrate @ 17854]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents: 15119
diff changeset
1823 g_return_if_fail(account != NULL);
672c39839af1 [gaim-migrate @ 17854]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents: 15119
diff changeset
1824
672c39839af1 [gaim-migrate @ 17854]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents: 15119
diff changeset
1825 g_free(account->buddy_icon_path);
672c39839af1 [gaim-migrate @ 17854]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents: 15119
diff changeset
1826 account->buddy_icon_path = g_strdup(path);
672c39839af1 [gaim-migrate @ 17854]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents: 15119
diff changeset
1827
672c39839af1 [gaim-migrate @ 17854]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents: 15119
diff changeset
1828 schedule_accounts_save();
672c39839af1 [gaim-migrate @ 17854]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents: 15119
diff changeset
1829 }
672c39839af1 [gaim-migrate @ 17854]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents: 15119
diff changeset
1830
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1831 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1832 purple_account_set_protocol_id(PurpleAccount *account, const char *protocol_id)
5943
8a052155157a [gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents: 5942
diff changeset
1833 {
8a052155157a [gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents: 5942
diff changeset
1834 g_return_if_fail(account != NULL);
8a052155157a [gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents: 5942
diff changeset
1835 g_return_if_fail(protocol_id != NULL);
5573
633880e3f137 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5565
diff changeset
1836
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
1837 g_free(account->protocol_id);
5943
8a052155157a [gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents: 5942
diff changeset
1838 account->protocol_id = g_strdup(protocol_id);
5665
0115e8068f51 [gaim-migrate @ 6081]
Christian Hammond <chipx86@chipx86.com>
parents: 5659
diff changeset
1839
5573
633880e3f137 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5565
diff changeset
1840 schedule_accounts_save();
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1841 }
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1842
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1843 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1844 purple_account_set_connection(PurpleAccount *account, PurpleConnection *gc)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1845 {
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1846 g_return_if_fail(account != NULL);
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1847
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1848 account->gc = gc;
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1849 }
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1850
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1851 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1852 purple_account_set_remember_password(PurpleAccount *account, gboolean value)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1853 {
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1854 g_return_if_fail(account != NULL);
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1855
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1856 account->remember_pass = value;
5573
633880e3f137 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5565
diff changeset
1857
633880e3f137 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5565
diff changeset
1858 schedule_accounts_save();
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1859 }
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1860
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1861 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1862 purple_account_set_check_mail(PurpleAccount *account, gboolean value)
5659
b263ee0ceaac [gaim-migrate @ 6073]
Christian Hammond <chipx86@chipx86.com>
parents: 5643
diff changeset
1863 {
b263ee0ceaac [gaim-migrate @ 6073]
Christian Hammond <chipx86@chipx86.com>
parents: 5643
diff changeset
1864 g_return_if_fail(account != NULL);
b263ee0ceaac [gaim-migrate @ 6073]
Christian Hammond <chipx86@chipx86.com>
parents: 5643
diff changeset
1865
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1866 purple_account_set_bool(account, "check-mail", value);
5659
b263ee0ceaac [gaim-migrate @ 6073]
Christian Hammond <chipx86@chipx86.com>
parents: 5643
diff changeset
1867 }
b263ee0ceaac [gaim-migrate @ 6073]
Christian Hammond <chipx86@chipx86.com>
parents: 5643
diff changeset
1868
b263ee0ceaac [gaim-migrate @ 6073]
Christian Hammond <chipx86@chipx86.com>
parents: 5643
diff changeset
1869 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1870 purple_account_set_enabled(PurpleAccount *account, const char *ui,
10400
5f11925078e5 [gaim-migrate @ 11631]
Sean Egan <seanegan@pidgin.im>
parents: 10399
diff changeset
1871 gboolean value)
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
1872 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1873 PurpleConnection *gc;
12070
e678eea4d899 [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 11985
diff changeset
1874 gboolean was_enabled = FALSE;
11638
1821b40269a3 [gaim-migrate @ 13914]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11628
diff changeset
1875
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
1876 g_return_if_fail(account != NULL);
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
1877 g_return_if_fail(ui != NULL);
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
1878
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1879 was_enabled = purple_account_get_enabled(account, ui);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1880
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1881 purple_account_set_ui_bool(account, ui, "auto-login", value);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1882 gc = purple_account_get_connection(account);
11638
1821b40269a3 [gaim-migrate @ 13914]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11628
diff changeset
1883
12070
e678eea4d899 [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 11985
diff changeset
1884 if(was_enabled && !value)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1885 purple_signal_emit(purple_accounts_get_handle(), "account-disabled", account);
12070
e678eea4d899 [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 11985
diff changeset
1886 else if(!was_enabled && value)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1887 purple_signal_emit(purple_accounts_get_handle(), "account-enabled", account);
12070
e678eea4d899 [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 11985
diff changeset
1888
11638
1821b40269a3 [gaim-migrate @ 13914]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11628
diff changeset
1889 if ((gc != NULL) && (gc->wants_to_die == TRUE))
1821b40269a3 [gaim-migrate @ 13914]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11628
diff changeset
1890 return;
1821b40269a3 [gaim-migrate @ 13914]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11628
diff changeset
1891
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1892 if (value && purple_presence_is_online(account->presence))
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1893 purple_account_connect(account);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1894 else if (!value && !purple_account_is_disconnected(account))
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1895 purple_account_disconnect(account);
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
1896 }
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
1897
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
1898 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1899 purple_account_set_proxy_info(PurpleAccount *account, PurpleProxyInfo *info)
5681
514fbc5374dc [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5666
diff changeset
1900 {
514fbc5374dc [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5666
diff changeset
1901 g_return_if_fail(account != NULL);
514fbc5374dc [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5666
diff changeset
1902
5695
d0352e790c0a [gaim-migrate @ 6116]
Christian Hammond <chipx86@chipx86.com>
parents: 5694
diff changeset
1903 if (account->proxy_info != NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1904 purple_proxy_info_destroy(account->proxy_info);
5695
d0352e790c0a [gaim-migrate @ 6116]
Christian Hammond <chipx86@chipx86.com>
parents: 5694
diff changeset
1905
5681
514fbc5374dc [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5666
diff changeset
1906 account->proxy_info = info;
514fbc5374dc [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5666
diff changeset
1907
514fbc5374dc [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5666
diff changeset
1908 schedule_accounts_save();
514fbc5374dc [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5666
diff changeset
1909 }
514fbc5374dc [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5666
diff changeset
1910
514fbc5374dc [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5666
diff changeset
1911 void
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
1912 purple_account_set_privacy_type(PurpleAccount *account, PurpleAccountPrivacyType privacy_type)
30021
3c7a689ae32e Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <markdoliner@pidgin.im>
parents: 29992
diff changeset
1913 {
3c7a689ae32e Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <markdoliner@pidgin.im>
parents: 29992
diff changeset
1914 g_return_if_fail(account != NULL);
3c7a689ae32e Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <markdoliner@pidgin.im>
parents: 29992
diff changeset
1915
3c7a689ae32e Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <markdoliner@pidgin.im>
parents: 29992
diff changeset
1916 account->perm_deny = privacy_type;
3c7a689ae32e Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <markdoliner@pidgin.im>
parents: 29992
diff changeset
1917 }
3c7a689ae32e Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <markdoliner@pidgin.im>
parents: 29992
diff changeset
1918
3c7a689ae32e Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <markdoliner@pidgin.im>
parents: 29992
diff changeset
1919 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1920 purple_account_set_status_types(PurpleAccount *account, GList *status_types)
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
1921 {
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
1922 g_return_if_fail(account != NULL);
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
1923
14724
309cc2f335c6 [gaim-migrate @ 17408]
Etan Reisner <deryni@pidgin.im>
parents: 14705
diff changeset
1924 /* Out with the old... */
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
1925 if (account->status_types != NULL)
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
1926 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1927 g_list_foreach(account->status_types, (GFunc)purple_status_type_destroy, NULL);
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
1928 g_list_free(account->status_types);
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
1929 }
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
1930
10005
1d711ab1de4e [gaim-migrate @ 10922]
Mark Doliner <markdoliner@pidgin.im>
parents: 9989
diff changeset
1931 /* In with the new... */
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
1932 account->status_types = status_types;
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
1933 }
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
1934
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
1935 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1936 purple_account_set_status(PurpleAccount *account, const char *status_id,
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
1937 gboolean active, ...)
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
1938 {
14705
c7b02232f020 [gaim-migrate @ 17389]
Mark Doliner <markdoliner@pidgin.im>
parents: 14669
diff changeset
1939 GList *attrs = NULL;
c7b02232f020 [gaim-migrate @ 17389]
Mark Doliner <markdoliner@pidgin.im>
parents: 14669
diff changeset
1940 const gchar *id;
c7b02232f020 [gaim-migrate @ 17389]
Mark Doliner <markdoliner@pidgin.im>
parents: 14669
diff changeset
1941 gpointer data;
10738
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
1942 va_list args;
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
1943
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
1944 va_start(args, active);
14705
c7b02232f020 [gaim-migrate @ 17389]
Mark Doliner <markdoliner@pidgin.im>
parents: 14669
diff changeset
1945 while ((id = va_arg(args, const char *)) != NULL)
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
1946 {
14705
c7b02232f020 [gaim-migrate @ 17389]
Mark Doliner <markdoliner@pidgin.im>
parents: 14669
diff changeset
1947 attrs = g_list_append(attrs, (char *)id);
c7b02232f020 [gaim-migrate @ 17389]
Mark Doliner <markdoliner@pidgin.im>
parents: 14669
diff changeset
1948 data = va_arg(args, void *);
c7b02232f020 [gaim-migrate @ 17389]
Mark Doliner <markdoliner@pidgin.im>
parents: 14669
diff changeset
1949 attrs = g_list_append(attrs, data);
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
1950 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1951 purple_account_set_status_list(account, status_id, active, attrs);
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
1952 g_list_free(attrs);
14705
c7b02232f020 [gaim-migrate @ 17389]
Mark Doliner <markdoliner@pidgin.im>
parents: 14669
diff changeset
1953 va_end(args);
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
1954 }
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
1955
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
1956 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1957 purple_account_set_status_list(PurpleAccount *account, const char *status_id,
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
1958 gboolean active, GList *attrs)
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
1959 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1960 PurpleStatus *status;
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
1961
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
1962 g_return_if_fail(account != NULL);
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
1963 g_return_if_fail(status_id != NULL);
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
1964
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1965 status = purple_account_get_status(account, status_id);
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
1966 if (status == NULL)
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
1967 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1968 purple_debug_error("account",
22055
95cdc03c44be Infinitesimally better debug message
Mark Doliner <markdoliner@pidgin.im>
parents: 21961
diff changeset
1969 "Invalid status ID '%s' for account %s (%s)\n",
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1970 status_id, purple_account_get_username(account),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1971 purple_account_get_protocol_id(account));
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
1972 return;
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
1973 }
10720
e8c25145480c [gaim-migrate @ 12318]
Mark Doliner <markdoliner@pidgin.im>
parents: 10714
diff changeset
1974
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1975 if (active || purple_status_is_independent(status))
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1976 purple_status_set_active_with_attrs_list(status, active, attrs);
10862
74aef8a7afcb [gaim-migrate @ 12545]
Mark Doliner <markdoliner@pidgin.im>
parents: 10774
diff changeset
1977
74aef8a7afcb [gaim-migrate @ 12545]
Mark Doliner <markdoliner@pidgin.im>
parents: 10774
diff changeset
1978 /*
74aef8a7afcb [gaim-migrate @ 12545]
Mark Doliner <markdoliner@pidgin.im>
parents: 10774
diff changeset
1979 * Our current statuses are saved to accounts.xml (so that when we
74aef8a7afcb [gaim-migrate @ 12545]
Mark Doliner <markdoliner@pidgin.im>
parents: 10774
diff changeset
1980 * reconnect, we go back to the previous status).
74aef8a7afcb [gaim-migrate @ 12545]
Mark Doliner <markdoliner@pidgin.im>
parents: 10774
diff changeset
1981 */
74aef8a7afcb [gaim-migrate @ 12545]
Mark Doliner <markdoliner@pidgin.im>
parents: 10774
diff changeset
1982 schedule_accounts_save();
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
1983 }
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
1984
30138
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
1985 struct public_alias_closure
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
1986 {
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
1987 PurpleAccount *account;
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
1988 gpointer failure_cb;
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
1989 };
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
1990
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
1991 static gboolean
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
1992 set_public_alias_unsupported(gpointer data)
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
1993 {
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
1994 struct public_alias_closure *closure = data;
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
1995 PurpleSetPublicAliasFailureCallback failure_cb = closure->failure_cb;
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
1996
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
1997 failure_cb(closure->account,
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
1998 _("This protocol does not support setting a public alias."));
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
1999 g_free(closure);
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2000
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2001 return FALSE;
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2002 }
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2003
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2004 void
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2005 purple_account_set_public_alias(PurpleAccount *account,
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2006 const char *alias, PurpleSetPublicAliasSuccessCallback success_cb,
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2007 PurpleSetPublicAliasFailureCallback failure_cb)
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2008 {
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2009 PurpleConnection *gc;
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2010 PurplePlugin *prpl = NULL;
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2011 PurplePluginProtocolInfo *prpl_info = NULL;
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2012
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2013 g_return_if_fail(account != NULL);
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2014 g_return_if_fail(purple_account_is_connected(account));
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2015
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2016 gc = purple_account_get_connection(account);
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2017 prpl = purple_connection_get_prpl(gc);
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2018 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2019
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2020 if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, set_public_alias))
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2021 prpl_info->set_public_alias(gc, alias, success_cb, failure_cb);
30456
feb80e82b728 Only call failure_cb if it exists for the [gs]et_public_alias functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 30138
diff changeset
2022 else if (failure_cb) {
30138
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2023 struct public_alias_closure *closure =
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2024 g_new0(struct public_alias_closure, 1);
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2025 closure->account = account;
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2026 closure->failure_cb = failure_cb;
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2027 purple_timeout_add(0, set_public_alias_unsupported, closure);
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2028 }
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2029 }
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2030
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2031 static gboolean
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2032 get_public_alias_unsupported(gpointer data)
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2033 {
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2034 struct public_alias_closure *closure = data;
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2035 PurpleGetPublicAliasFailureCallback failure_cb = closure->failure_cb;
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2036
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2037 failure_cb(closure->account,
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2038 _("This protocol does not support fetching the public alias."));
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2039 g_free(closure);
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2040
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2041 return FALSE;
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2042 }
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2043
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2044 void
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2045 purple_account_get_public_alias(PurpleAccount *account,
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2046 PurpleGetPublicAliasSuccessCallback success_cb,
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2047 PurpleGetPublicAliasFailureCallback failure_cb)
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2048 {
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2049 PurpleConnection *gc;
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2050 PurplePlugin *prpl = NULL;
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2051 PurplePluginProtocolInfo *prpl_info = NULL;
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2052
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2053 g_return_if_fail(account != NULL);
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2054 g_return_if_fail(purple_account_is_connected(account));
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2055
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2056 gc = purple_account_get_connection(account);
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2057 prpl = purple_connection_get_prpl(gc);
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2058 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2059
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2060 if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_public_alias))
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2061 prpl_info->get_public_alias(gc, success_cb, failure_cb);
30456
feb80e82b728 Only call failure_cb if it exists for the [gs]et_public_alias functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 30138
diff changeset
2062 else if (failure_cb) {
30138
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2063 struct public_alias_closure *closure =
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2064 g_new0(struct public_alias_closure, 1);
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2065 closure->account = account;
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2066 closure->failure_cb = failure_cb;
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2067 purple_timeout_add(0, get_public_alias_unsupported, closure);
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2068 }
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2069 }
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30021
diff changeset
2070
31566
fa37798387fa Make the simple silence suppression stuff optional per-account. Fixes #13180.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31325
diff changeset
2071 gboolean
fa37798387fa Make the simple silence suppression stuff optional per-account. Fixes #13180.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31325
diff changeset
2072 purple_account_get_silence_suppression(const PurpleAccount *account)
fa37798387fa Make the simple silence suppression stuff optional per-account. Fixes #13180.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31325
diff changeset
2073 {
fa37798387fa Make the simple silence suppression stuff optional per-account. Fixes #13180.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31325
diff changeset
2074 return purple_account_get_bool(account, "silence-suppression", FALSE);
fa37798387fa Make the simple silence suppression stuff optional per-account. Fixes #13180.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31325
diff changeset
2075 }
fa37798387fa Make the simple silence suppression stuff optional per-account. Fixes #13180.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31325
diff changeset
2076
fa37798387fa Make the simple silence suppression stuff optional per-account. Fixes #13180.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31325
diff changeset
2077 void
fa37798387fa Make the simple silence suppression stuff optional per-account. Fixes #13180.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31325
diff changeset
2078 purple_account_set_silence_suppression(PurpleAccount *account, gboolean value)
fa37798387fa Make the simple silence suppression stuff optional per-account. Fixes #13180.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31325
diff changeset
2079 {
fa37798387fa Make the simple silence suppression stuff optional per-account. Fixes #13180.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31325
diff changeset
2080 g_return_if_fail(account != NULL);
fa37798387fa Make the simple silence suppression stuff optional per-account. Fixes #13180.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31325
diff changeset
2081
fa37798387fa Make the simple silence suppression stuff optional per-account. Fixes #13180.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31325
diff changeset
2082 purple_account_set_bool(account, "silence-suppression", value);
fa37798387fa Make the simple silence suppression stuff optional per-account. Fixes #13180.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31325
diff changeset
2083 }
fa37798387fa Make the simple silence suppression stuff optional per-account. Fixes #13180.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31325
diff changeset
2084
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2085 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2086 purple_account_clear_settings(PurpleAccount *account)
5694
46768356e6a1 [gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
2087 {
46768356e6a1 [gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
2088 g_return_if_fail(account != NULL);
46768356e6a1 [gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
2089
46768356e6a1 [gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
2090 g_hash_table_destroy(account->settings);
46768356e6a1 [gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
2091
46768356e6a1 [gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
2092 account->settings = g_hash_table_new_full(g_str_hash, g_str_equal,
5794
ebdbb7dc6658 [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5792
diff changeset
2093 g_free, delete_setting);
5694
46768356e6a1 [gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
2094 }
46768356e6a1 [gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
2095
46768356e6a1 [gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
2096 void
27562
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
2097 purple_account_remove_setting(PurpleAccount *account, const char *setting)
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
2098 {
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
2099 g_return_if_fail(account != NULL);
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
2100 g_return_if_fail(setting != NULL);
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
2101
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
2102 g_hash_table_remove(account->settings, setting);
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
2103 }
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
2104
2e34a10e7135 Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27497
diff changeset
2105 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2106 purple_account_set_int(PurpleAccount *account, const char *name, int value)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2107 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2108 PurpleAccountSetting *setting;
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2109
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2110 g_return_if_fail(account != NULL);
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2111 g_return_if_fail(name != NULL);
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2112
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2113 setting = g_new0(PurpleAccountSetting, 1);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2114
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2115 setting->type = PURPLE_PREF_INT;
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2116 setting->value.integer = value;
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2117
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2118 g_hash_table_insert(account->settings, g_strdup(name), setting);
5573
633880e3f137 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5565
diff changeset
2119
633880e3f137 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5565
diff changeset
2120 schedule_accounts_save();
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2121 }
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2122
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2123 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2124 purple_account_set_string(PurpleAccount *account, const char *name,
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2125 const char *value)
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2126 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2127 PurpleAccountSetting *setting;
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2128
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2129 g_return_if_fail(account != NULL);
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2130 g_return_if_fail(name != NULL);
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2131
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2132 setting = g_new0(PurpleAccountSetting, 1);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2133
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2134 setting->type = PURPLE_PREF_STRING;
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2135 setting->value.string = g_strdup(value);
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2136
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2137 g_hash_table_insert(account->settings, g_strdup(name), setting);
5573
633880e3f137 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5565
diff changeset
2138
633880e3f137 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5565
diff changeset
2139 schedule_accounts_save();
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2140 }
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2141
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2142 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2143 purple_account_set_bool(PurpleAccount *account, const char *name, gboolean value)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2144 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2145 PurpleAccountSetting *setting;
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2146
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2147 g_return_if_fail(account != NULL);
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2148 g_return_if_fail(name != NULL);
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2149
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2150 setting = g_new0(PurpleAccountSetting, 1);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2151
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2152 setting->type = PURPLE_PREF_BOOLEAN;
20246
161dd7a7f73a applied changes from 7a436ba53de6adebccf4e920ca62d544e13b1094
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
2153 setting->value.boolean = value;
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2154
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2155 g_hash_table_insert(account->settings, g_strdup(name), setting);
5573
633880e3f137 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5565
diff changeset
2156
633880e3f137 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5565
diff changeset
2157 schedule_accounts_save();
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2158 }
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2159
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2160 static GHashTable *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2161 get_ui_settings_table(PurpleAccount *account, const char *ui)
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2162 {
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2163 GHashTable *table;
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2164
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2165 table = g_hash_table_lookup(account->ui_settings, ui);
5979
d51d697d27fb [gaim-migrate @ 6426]
Christian Hammond <chipx86@chipx86.com>
parents: 5977
diff changeset
2166
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2167 if (table == NULL) {
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2168 table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
5794
ebdbb7dc6658 [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5792
diff changeset
2169 delete_setting);
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2170 g_hash_table_insert(account->ui_settings, g_strdup(ui), table);
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2171 }
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2172
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2173 return table;
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2174 }
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2175
5777
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2176 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2177 purple_account_set_ui_int(PurpleAccount *account, const char *ui,
5777
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2178 const char *name, int value)
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2179 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2180 PurpleAccountSetting *setting;
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2181 GHashTable *table;
5777
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2182
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2183 g_return_if_fail(account != NULL);
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2184 g_return_if_fail(ui != NULL);
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2185 g_return_if_fail(name != NULL);
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2186
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2187 setting = g_new0(PurpleAccountSetting, 1);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2188
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2189 setting->type = PURPLE_PREF_INT;
5777
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2190 setting->ui = g_strdup(ui);
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2191 setting->value.integer = value;
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2192
5794
ebdbb7dc6658 [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5792
diff changeset
2193 table = get_ui_settings_table(account, ui);
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2194
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2195 g_hash_table_insert(table, g_strdup(name), setting);
5777
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2196
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2197 schedule_accounts_save();
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2198 }
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2199
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2200 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2201 purple_account_set_ui_string(PurpleAccount *account, const char *ui,
5777
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2202 const char *name, const char *value)
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2203 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2204 PurpleAccountSetting *setting;
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2205 GHashTable *table;
5777
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2206
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2207 g_return_if_fail(account != NULL);
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2208 g_return_if_fail(ui != NULL);
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2209 g_return_if_fail(name != NULL);
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2210
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2211 setting = g_new0(PurpleAccountSetting, 1);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2212
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2213 setting->type = PURPLE_PREF_STRING;
5777
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2214 setting->ui = g_strdup(ui);
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2215 setting->value.string = g_strdup(value);
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2216
5794
ebdbb7dc6658 [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5792
diff changeset
2217 table = get_ui_settings_table(account, ui);
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2218
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2219 g_hash_table_insert(table, g_strdup(name), setting);
5777
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2220
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2221 schedule_accounts_save();
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2222 }
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2223
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2224 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2225 purple_account_set_ui_bool(PurpleAccount *account, const char *ui,
5777
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2226 const char *name, gboolean value)
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2227 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2228 PurpleAccountSetting *setting;
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2229 GHashTable *table;
5777
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2230
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2231 g_return_if_fail(account != NULL);
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2232 g_return_if_fail(ui != NULL);
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2233 g_return_if_fail(name != NULL);
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2234
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2235 setting = g_new0(PurpleAccountSetting, 1);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2236
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2237 setting->type = PURPLE_PREF_BOOLEAN;
5777
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2238 setting->ui = g_strdup(ui);
20246
161dd7a7f73a applied changes from 7a436ba53de6adebccf4e920ca62d544e13b1094
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
2239 setting->value.boolean = value;
5777
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2240
5794
ebdbb7dc6658 [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5792
diff changeset
2241 table = get_ui_settings_table(account, ui);
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2242
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2243 g_hash_table_insert(table, g_strdup(name), setting);
5777
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2244
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2245 schedule_accounts_save();
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2246 }
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
2247
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2248 static PurpleConnectionState
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2249 purple_account_get_state(const PurpleAccount *account)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2250 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2251 PurpleConnection *gc;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2252
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2253 g_return_val_if_fail(account != NULL, PURPLE_DISCONNECTED);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2254
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2255 gc = purple_account_get_connection(account);
11251
e38d86958a63 [gaim-migrate @ 13420]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11249
diff changeset
2256 if (!gc)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2257 return PURPLE_DISCONNECTED;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2258
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2259 return purple_connection_get_state(gc);
11251
e38d86958a63 [gaim-migrate @ 13420]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11249
diff changeset
2260 }
e38d86958a63 [gaim-migrate @ 13420]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11249
diff changeset
2261
e38d86958a63 [gaim-migrate @ 13420]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11249
diff changeset
2262 gboolean
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2263 purple_account_is_connected(const PurpleAccount *account)
11251
e38d86958a63 [gaim-migrate @ 13420]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11249
diff changeset
2264 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2265 return (purple_account_get_state(account) == PURPLE_CONNECTED);
11251
e38d86958a63 [gaim-migrate @ 13420]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11249
diff changeset
2266 }
e38d86958a63 [gaim-migrate @ 13420]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11249
diff changeset
2267
e38d86958a63 [gaim-migrate @ 13420]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11249
diff changeset
2268 gboolean
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2269 purple_account_is_connecting(const PurpleAccount *account)
11251
e38d86958a63 [gaim-migrate @ 13420]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11249
diff changeset
2270 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2271 return (purple_account_get_state(account) == PURPLE_CONNECTING);
11251
e38d86958a63 [gaim-migrate @ 13420]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11249
diff changeset
2272 }
e38d86958a63 [gaim-migrate @ 13420]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11249
diff changeset
2273
e38d86958a63 [gaim-migrate @ 13420]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11249
diff changeset
2274 gboolean
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2275 purple_account_is_disconnected(const PurpleAccount *account)
11251
e38d86958a63 [gaim-migrate @ 13420]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11249
diff changeset
2276 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2277 return (purple_account_get_state(account) == PURPLE_DISCONNECTED);
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2278 }
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2279
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2280 const char *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2281 purple_account_get_username(const PurpleAccount *account)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2282 {
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2283 g_return_val_if_fail(account != NULL, NULL);
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2284
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2285 return account->username;
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2286 }
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2287
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
2288 static void
34170
94102637e7c7 Coding style and entry description for GNOME Keyring
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34165
diff changeset
2289 purple_account_get_password_got(PurpleAccount *account,
34145
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
2290 const gchar *password, GError *error, gpointer data)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2291 {
34115
a0f9b38226eb Better name for CbInfo, revert cosmetic changes not related to master password branch
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34111
diff changeset
2292 PurpleCallbackBundle *cbb = data;
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
2293 PurpleKeyringReadCallback cb;
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
2294
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
2295 purple_debug_info("account",
34170
94102637e7c7 Coding style and entry description for GNOME Keyring
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34165
diff changeset
2296 "Read password for account %s from async keyring.\n",
94102637e7c7 Coding style and entry description for GNOME Keyring
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34165
diff changeset
2297 purple_account_get_username(account));
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
2298
34145
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
2299 purple_str_wipe(account->password);
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
2300 account->password = g_strdup(password);
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
2301
34115
a0f9b38226eb Better name for CbInfo, revert cosmetic changes not related to master password branch
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34111
diff changeset
2302 cb = (PurpleKeyringReadCallback)cbb->cb;
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
2303 if (cb != NULL)
34115
a0f9b38226eb Better name for CbInfo, revert cosmetic changes not related to master password branch
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34111
diff changeset
2304 cb(account, password, error, cbb->data);
a0f9b38226eb Better name for CbInfo, revert cosmetic changes not related to master password branch
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34111
diff changeset
2305
a0f9b38226eb Better name for CbInfo, revert cosmetic changes not related to master password branch
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34111
diff changeset
2306 g_free(cbb);
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
2307 }
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
2308
34028
a3050b6df38e Remove deprecated API since we're targeting 3.0.0 here. Don't mind the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34023
diff changeset
2309 void
a3050b6df38e Remove deprecated API since we're targeting 3.0.0 here. Don't mind the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34023
diff changeset
2310 purple_account_get_password(PurpleAccount *account,
34145
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
2311 PurpleKeyringReadCallback cb, gpointer data)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2312 {
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
2313 if (account == NULL) {
33997
035d8594b66a Wrote a caching system that uses account->password to store password.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33996
diff changeset
2314 cb(NULL, NULL, NULL, data);
035d8594b66a Wrote a caching system that uses account->password to store password.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33996
diff changeset
2315 return;
035d8594b66a Wrote a caching system that uses account->password to store password.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33996
diff changeset
2316 }
035d8594b66a Wrote a caching system that uses account->password to store password.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33996
diff changeset
2317
33996
ca5e901a5311 Implemented a password caching system to limit problems linked to the
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33995
diff changeset
2318 if (account->password != NULL) {
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
2319 purple_debug_info("account",
34170
94102637e7c7 Coding style and entry description for GNOME Keyring
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34165
diff changeset
2320 "Reading password for account %s from cache.\n",
94102637e7c7 Coding style and entry description for GNOME Keyring
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34165
diff changeset
2321 purple_account_get_username(account));
33996
ca5e901a5311 Implemented a password caching system to limit problems linked to the
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33995
diff changeset
2322 cb(account, account->password, NULL, data);
ca5e901a5311 Implemented a password caching system to limit problems linked to the
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33995
diff changeset
2323 } else {
34115
a0f9b38226eb Better name for CbInfo, revert cosmetic changes not related to master password branch
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34111
diff changeset
2324 PurpleCallbackBundle *cbb = g_new0(PurpleCallbackBundle, 1);
a0f9b38226eb Better name for CbInfo, revert cosmetic changes not related to master password branch
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34111
diff changeset
2325 cbb->cb = PURPLE_CALLBACK(cb);
a0f9b38226eb Better name for CbInfo, revert cosmetic changes not related to master password branch
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34111
diff changeset
2326 cbb->data = data;
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
2327
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
2328 purple_debug_info("account",
34170
94102637e7c7 Coding style and entry description for GNOME Keyring
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34165
diff changeset
2329 "Reading password for account %s from async keyring.\n",
94102637e7c7 Coding style and entry description for GNOME Keyring
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34165
diff changeset
2330 purple_account_get_username(account));
34028
a3050b6df38e Remove deprecated API since we're targeting 3.0.0 here. Don't mind the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34023
diff changeset
2331 purple_keyring_get_password(account,
34170
94102637e7c7 Coding style and entry description for GNOME Keyring
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34165
diff changeset
2332 purple_account_get_password_got, cbb);
33996
ca5e901a5311 Implemented a password caching system to limit problems linked to the
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33995
diff changeset
2333 }
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2334 }
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2335
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2336 const char *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2337 purple_account_get_alias(const PurpleAccount *account)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2338 {
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2339 g_return_val_if_fail(account != NULL, NULL);
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2340
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2341 return account->alias;
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2342 }
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2343
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2344 const char *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2345 purple_account_get_user_info(const PurpleAccount *account)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2346 {
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2347 g_return_val_if_fail(account != NULL, NULL);
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2348
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2349 return account->user_info;
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2350 }
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2351
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2352 const char *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2353 purple_account_get_buddy_icon_path(const PurpleAccount *account)
15132
672c39839af1 [gaim-migrate @ 17854]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents: 15119
diff changeset
2354 {
672c39839af1 [gaim-migrate @ 17854]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents: 15119
diff changeset
2355 g_return_val_if_fail(account != NULL, NULL);
672c39839af1 [gaim-migrate @ 17854]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents: 15119
diff changeset
2356
672c39839af1 [gaim-migrate @ 17854]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents: 15119
diff changeset
2357 return account->buddy_icon_path;
672c39839af1 [gaim-migrate @ 17854]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents: 15119
diff changeset
2358 }
672c39839af1 [gaim-migrate @ 17854]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents: 15119
diff changeset
2359
672c39839af1 [gaim-migrate @ 17854]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents: 15119
diff changeset
2360 const char *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2361 purple_account_get_protocol_id(const PurpleAccount *account)
5943
8a052155157a [gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents: 5942
diff changeset
2362 {
8a052155157a [gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents: 5942
diff changeset
2363 g_return_val_if_fail(account != NULL, NULL);
8a052155157a [gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents: 5942
diff changeset
2364 return account->protocol_id;
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2365 }
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2366
9699
d1ca5dd91cc2 [gaim-migrate @ 10558]
Mark Doliner <markdoliner@pidgin.im>
parents: 9619
diff changeset
2367 const char *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2368 purple_account_get_protocol_name(const PurpleAccount *account)
9699
d1ca5dd91cc2 [gaim-migrate @ 10558]
Mark Doliner <markdoliner@pidgin.im>
parents: 9619
diff changeset
2369 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2370 PurplePlugin *p;
9720
02c64e22341e [gaim-migrate @ 10581]
Mark Doliner <markdoliner@pidgin.im>
parents: 9699
diff changeset
2371
9699
d1ca5dd91cc2 [gaim-migrate @ 10558]
Mark Doliner <markdoliner@pidgin.im>
parents: 9619
diff changeset
2372 g_return_val_if_fail(account != NULL, NULL);
d1ca5dd91cc2 [gaim-migrate @ 10558]
Mark Doliner <markdoliner@pidgin.im>
parents: 9619
diff changeset
2373
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2374 p = purple_find_prpl(purple_account_get_protocol_id(account));
9988
f58c80ea22ee [gaim-migrate @ 10901]
Gary Kramlich <grim@pidgin.im>
parents: 9971
diff changeset
2375
f58c80ea22ee [gaim-migrate @ 10901]
Gary Kramlich <grim@pidgin.im>
parents: 9971
diff changeset
2376 return ((p && p->info->name) ? _(p->info->name) : _("Unknown"));
f58c80ea22ee [gaim-migrate @ 10901]
Gary Kramlich <grim@pidgin.im>
parents: 9971
diff changeset
2377 }
f58c80ea22ee [gaim-migrate @ 10901]
Gary Kramlich <grim@pidgin.im>
parents: 9971
diff changeset
2378
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2379 PurpleConnection *
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2380 purple_account_get_connection(const PurpleAccount *account)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2381 {
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2382 g_return_val_if_fail(account != NULL, NULL);
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2383
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2384 return account->gc;
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2385 }
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2386
29515
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2387 const gchar *
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2388 purple_account_get_name_for_display(const PurpleAccount *account)
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2389 {
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2390 PurpleBuddy *self = NULL;
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2391 PurpleConnection *gc = NULL;
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2392 const gchar *name = NULL, *username = NULL, *displayname = NULL;
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2393
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2394 name = purple_account_get_alias(account);
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2395
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2396 if (name) {
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2397 return name;
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2398 }
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2399
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2400 username = purple_account_get_username(account);
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2401 self = purple_find_buddy((PurpleAccount *)account, username);
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2402
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2403 if (self) {
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2404 const gchar *calias= purple_buddy_get_contact_alias(self);
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2405
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2406 /* We don't want to return the buddy name if the buddy/contact
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2407 * doesn't have an alias set. */
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2408 if (!purple_strequal(username, calias)) {
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2409 return calias;
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2410 }
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2411 }
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2412
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2413 gc = purple_account_get_connection(account);
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2414 displayname = purple_connection_get_display_name(gc);
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2415
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2416 if (displayname) {
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2417 return displayname;
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2418 }
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2419
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2420 return username;
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2421 }
7334e85a7a56 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28373
diff changeset
2422
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2423 gboolean
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2424 purple_account_get_remember_password(const PurpleAccount *account)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2425 {
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2426 g_return_val_if_fail(account != NULL, FALSE);
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2427
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2428 return account->remember_pass;
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2429 }
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2430
5565
687cc390b7dc [gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents: 5564
diff changeset
2431 gboolean
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2432 purple_account_get_check_mail(const PurpleAccount *account)
5565
687cc390b7dc [gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents: 5564
diff changeset
2433 {
687cc390b7dc [gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents: 5564
diff changeset
2434 g_return_val_if_fail(account != NULL, FALSE);
687cc390b7dc [gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents: 5564
diff changeset
2435
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2436 return purple_account_get_bool(account, "check-mail", FALSE);
5565
687cc390b7dc [gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents: 5564
diff changeset
2437 }
687cc390b7dc [gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents: 5564
diff changeset
2438
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2439 gboolean
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2440 purple_account_get_enabled(const PurpleAccount *account, const char *ui)
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2441 {
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2442 g_return_val_if_fail(account != NULL, FALSE);
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2443 g_return_val_if_fail(ui != NULL, FALSE);
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2444
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2445 return purple_account_get_ui_bool(account, ui, "auto-login", FALSE);
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2446 }
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2447
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2448 PurpleProxyInfo *
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2449 purple_account_get_proxy_info(const PurpleAccount *account)
5681
514fbc5374dc [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5666
diff changeset
2450 {
514fbc5374dc [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5666
diff changeset
2451 g_return_val_if_fail(account != NULL, NULL);
514fbc5374dc [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5666
diff changeset
2452
514fbc5374dc [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5666
diff changeset
2453 return account->proxy_info;
514fbc5374dc [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5666
diff changeset
2454 }
514fbc5374dc [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5666
diff changeset
2455
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2456 PurpleAccountPrivacyType
30021
3c7a689ae32e Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <markdoliner@pidgin.im>
parents: 29992
diff changeset
2457 purple_account_get_privacy_type(const PurpleAccount *account)
3c7a689ae32e Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <markdoliner@pidgin.im>
parents: 29992
diff changeset
2458 {
3c7a689ae32e Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <markdoliner@pidgin.im>
parents: 29992
diff changeset
2459 g_return_val_if_fail(account != NULL, PURPLE_PRIVACY_ALLOW_ALL);
3c7a689ae32e Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <markdoliner@pidgin.im>
parents: 29992
diff changeset
2460
3c7a689ae32e Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <markdoliner@pidgin.im>
parents: 29992
diff changeset
2461 return account->perm_deny;
3c7a689ae32e Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <markdoliner@pidgin.im>
parents: 29992
diff changeset
2462 }
3c7a689ae32e Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <markdoliner@pidgin.im>
parents: 29992
diff changeset
2463
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2464 gboolean
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2465 purple_account_privacy_permit_add(PurpleAccount *account, const char *who,
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2466 gboolean local_only)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2467 {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2468 GSList *l;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2469 char *name;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2470 PurpleBuddy *buddy;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2471 PurpleBlistUiOps *blist_ops;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2472
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2473 g_return_val_if_fail(account != NULL, FALSE);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2474 g_return_val_if_fail(who != NULL, FALSE);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2475
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2476 name = g_strdup(purple_normalize(account, who));
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2477
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2478 for (l = account->permit; l != NULL; l = l->next) {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2479 if (g_str_equal(name, l->data))
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2480 /* This buddy already exists */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2481 break;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2482 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2483
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2484 if (l != NULL)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2485 {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2486 /* This buddy already exists, so bail out */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2487 g_free(name);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2488 return FALSE;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2489 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2490
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2491 account->permit = g_slist_append(account->permit, name);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2492
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2493 if (!local_only && purple_account_is_connected(account))
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2494 serv_add_permit(purple_account_get_connection(account), who);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2495
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2496 if (privacy_ops != NULL && privacy_ops->permit_added != NULL)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2497 privacy_ops->permit_added(account, who);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2498
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2499 blist_ops = purple_blist_get_ui_ops();
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2500 if (blist_ops != NULL && blist_ops->save_account != NULL)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2501 blist_ops->save_account(account);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2502
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2503 /* This lets the UI know a buddy has had its privacy setting changed */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2504 buddy = purple_find_buddy(account, name);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2505 if (buddy != NULL) {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2506 purple_signal_emit(purple_blist_get_handle(),
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2507 "buddy-privacy-changed", buddy);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2508 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2509 return TRUE;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2510 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2511
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2512 gboolean
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2513 purple_account_privacy_permit_remove(PurpleAccount *account, const char *who,
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2514 gboolean local_only)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2515 {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2516 GSList *l;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2517 const char *name;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2518 PurpleBuddy *buddy;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2519 char *del;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2520 PurpleBlistUiOps *blist_ops;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2521
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2522 g_return_val_if_fail(account != NULL, FALSE);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2523 g_return_val_if_fail(who != NULL, FALSE);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2524
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2525 name = purple_normalize(account, who);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2526
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2527 for (l = account->permit; l != NULL; l = l->next) {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2528 if (g_str_equal(name, l->data))
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2529 /* We found the buddy we were looking for */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2530 break;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2531 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2532
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2533 if (l == NULL)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2534 /* We didn't find the buddy we were looking for, so bail out */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2535 return FALSE;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2536
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2537 /* We should not free l->data just yet. There can be occasions where
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2538 * l->data == who. In such cases, freeing l->data here can cause crashes
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2539 * later when who is used. */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2540 del = l->data;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2541 account->permit = g_slist_delete_link(account->permit, l);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2542
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2543 if (!local_only && purple_account_is_connected(account))
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2544 serv_rem_permit(purple_account_get_connection(account), who);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2545
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2546 if (privacy_ops != NULL && privacy_ops->permit_removed != NULL)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2547 privacy_ops->permit_removed(account, who);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2548
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2549 blist_ops = purple_blist_get_ui_ops();
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2550 if (blist_ops != NULL && blist_ops->save_account != NULL)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2551 blist_ops->save_account(account);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2552
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2553 buddy = purple_find_buddy(account, name);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2554 if (buddy != NULL) {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2555 purple_signal_emit(purple_blist_get_handle(),
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2556 "buddy-privacy-changed", buddy);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2557 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2558 g_free(del);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2559 return TRUE;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2560 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2561
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2562 gboolean
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2563 purple_account_privacy_deny_add(PurpleAccount *account, const char *who,
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2564 gboolean local_only)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2565 {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2566 GSList *l;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2567 char *name;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2568 PurpleBuddy *buddy;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2569 PurpleBlistUiOps *blist_ops;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2570
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2571 g_return_val_if_fail(account != NULL, FALSE);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2572 g_return_val_if_fail(who != NULL, FALSE);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2573
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2574 name = g_strdup(purple_normalize(account, who));
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2575
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2576 for (l = account->deny; l != NULL; l = l->next) {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2577 if (g_str_equal(name, l->data))
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2578 /* This buddy already exists */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2579 break;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2580 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2581
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2582 if (l != NULL)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2583 {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2584 /* This buddy already exists, so bail out */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2585 g_free(name);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2586 return FALSE;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2587 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2588
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2589 account->deny = g_slist_append(account->deny, name);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2590
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2591 if (!local_only && purple_account_is_connected(account))
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2592 serv_add_deny(purple_account_get_connection(account), who);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2593
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2594 if (privacy_ops != NULL && privacy_ops->deny_added != NULL)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2595 privacy_ops->deny_added(account, who);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2596
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2597 blist_ops = purple_blist_get_ui_ops();
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2598 if (blist_ops != NULL && blist_ops->save_account != NULL)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2599 blist_ops->save_account(account);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2600
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2601 buddy = purple_find_buddy(account, name);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2602 if (buddy != NULL) {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2603 purple_signal_emit(purple_blist_get_handle(),
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2604 "buddy-privacy-changed", buddy);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2605 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2606 return TRUE;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2607 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2608
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2609 gboolean
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2610 purple_account_privacy_deny_remove(PurpleAccount *account, const char *who,
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2611 gboolean local_only)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2612 {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2613 GSList *l;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2614 const char *normalized;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2615 char *name;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2616 PurpleBuddy *buddy;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2617 PurpleBlistUiOps *blist_ops;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2618
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2619 g_return_val_if_fail(account != NULL, FALSE);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2620 g_return_val_if_fail(who != NULL, FALSE);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2621
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2622 normalized = purple_normalize(account, who);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2623
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2624 for (l = account->deny; l != NULL; l = l->next) {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2625 if (g_str_equal(normalized, l->data))
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2626 /* We found the buddy we were looking for */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2627 break;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2628 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2629
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2630 if (l == NULL)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2631 /* We didn't find the buddy we were looking for, so bail out */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2632 return FALSE;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2633
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2634 buddy = purple_find_buddy(account, normalized);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2635
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2636 name = l->data;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2637 account->deny = g_slist_delete_link(account->deny, l);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2638
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2639 if (!local_only && purple_account_is_connected(account))
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2640 serv_rem_deny(purple_account_get_connection(account), name);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2641
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2642 if (privacy_ops != NULL && privacy_ops->deny_removed != NULL)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2643 privacy_ops->deny_removed(account, who);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2644
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2645 if (buddy != NULL) {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2646 purple_signal_emit(purple_blist_get_handle(),
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2647 "buddy-privacy-changed", buddy);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2648 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2649
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2650 g_free(name);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2651
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2652 blist_ops = purple_blist_get_ui_ops();
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2653 if (blist_ops != NULL && blist_ops->save_account != NULL)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2654 blist_ops->save_account(account);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2655
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2656 return TRUE;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2657 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2658
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2659 /**
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2660 * This makes sure your permit list contains all buddies from your
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2661 * buddy list and ONLY buddies from your buddy list.
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2662 */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2663 static void
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2664 add_all_buddies_to_permit_list(PurpleAccount *account, gboolean local)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2665 {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2666 GSList *list;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2667
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2668 /* Remove anyone in the permit list who is not in the buddylist */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2669 for (list = account->permit; list != NULL; ) {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2670 char *person = list->data;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2671 list = list->next;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2672 if (!purple_find_buddy(account, person))
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2673 purple_account_privacy_permit_remove(account, person, local);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2674 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2675
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2676 /* Now make sure everyone in the buddylist is in the permit list */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2677 list = purple_find_buddies(account, NULL);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2678 while (list != NULL)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2679 {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2680 PurpleBuddy *buddy = list->data;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2681 const gchar *name = purple_buddy_get_name(buddy);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2682
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2683 if (!g_slist_find_custom(account->permit, name, (GCompareFunc)g_utf8_collate))
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2684 purple_account_privacy_permit_add(account, name, local);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2685 list = g_slist_delete_link(list, list);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2686 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2687 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2688
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2689 /*
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2690 * TODO: All callers of this function pass in FALSE for local and
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2691 * restore and I don't understand when you would ever want to
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2692 * use TRUE for either of them. I think both parameters could
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2693 * safely be removed in the next major version bump.
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2694 */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2695 void
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2696 purple_account_privacy_allow(PurpleAccount *account, const char *who, gboolean local,
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2697 gboolean restore)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2698 {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2699 GSList *list;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2700 PurpleAccountPrivacyType type = purple_account_get_privacy_type(account);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2701
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2702 switch (type) {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2703 case PURPLE_ACCOUNT_PRIVACY_ALLOW_ALL:
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2704 return;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2705 case PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS:
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2706 purple_account_privacy_permit_add(account, who, local);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2707 break;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2708 case PURPLE_ACCOUNT_PRIVACY_DENY_USERS:
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2709 purple_account_privacy_deny_remove(account, who, local);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2710 break;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2711 case PURPLE_ACCOUNT_PRIVACY_DENY_ALL:
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2712 if (!restore) {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2713 /* Empty the allow-list. */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2714 const char *norm = purple_normalize(account, who);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2715 for (list = account->permit; list != NULL;) {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2716 char *person = list->data;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2717 list = list->next;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2718 if (!purple_strequal(norm, person))
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2719 purple_account_privacy_permit_remove(account, person, local);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2720 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2721 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2722 purple_account_privacy_permit_add(account, who, local);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2723 purple_account_set_privacy_type(account, PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2724 break;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2725 case PURPLE_ACCOUNT_PRIVACY_ALLOW_BUDDYLIST:
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2726 if (!purple_find_buddy(account, who)) {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2727 add_all_buddies_to_permit_list(account, local);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2728 purple_account_privacy_permit_add(account, who, local);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2729 purple_account_set_privacy_type(account, PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2730 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2731 break;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2732 default:
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2733 g_return_if_reached();
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2734 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2735
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2736 /* Notify the server if the privacy setting was changed */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2737 if (type != purple_account_get_privacy_type(account) && purple_account_is_connected(account))
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2738 serv_set_permit_deny(purple_account_get_connection(account));
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2739 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2740
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2741 /*
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2742 * TODO: All callers of this function pass in FALSE for local and
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2743 * restore and I don't understand when you would ever want to
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2744 * use TRUE for either of them. I think both parameters could
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2745 * safely be removed in the next major version bump.
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2746 */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2747 void
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2748 purple_account_privacy_deny(PurpleAccount *account, const char *who, gboolean local,
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2749 gboolean restore)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2750 {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2751 GSList *list;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2752 PurpleAccountPrivacyType type = purple_account_get_privacy_type(account);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2753
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2754 switch (type) {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2755 case PURPLE_ACCOUNT_PRIVACY_ALLOW_ALL:
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2756 if (!restore) {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2757 /* Empty the deny-list. */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2758 const char *norm = purple_normalize(account, who);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2759 for (list = account->deny; list != NULL; ) {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2760 char *person = list->data;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2761 list = list->next;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2762 if (!purple_strequal(norm, person))
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2763 purple_account_privacy_deny_remove(account, person, local);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2764 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2765 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2766 purple_account_privacy_deny_add(account, who, local);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2767 purple_account_set_privacy_type(account, PURPLE_ACCOUNT_PRIVACY_DENY_USERS);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2768 break;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2769 case PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS:
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2770 purple_account_privacy_permit_remove(account, who, local);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2771 break;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2772 case PURPLE_ACCOUNT_PRIVACY_DENY_USERS:
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2773 purple_account_privacy_deny_add(account, who, local);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2774 break;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2775 case PURPLE_ACCOUNT_PRIVACY_DENY_ALL:
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2776 break;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2777 case PURPLE_ACCOUNT_PRIVACY_ALLOW_BUDDYLIST:
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2778 if (purple_find_buddy(account, who)) {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2779 add_all_buddies_to_permit_list(account, local);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2780 purple_account_privacy_permit_remove(account, who, local);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2781 purple_account_set_privacy_type(account, PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2782 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2783 break;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2784 default:
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2785 g_return_if_reached();
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2786 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2787
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2788 /* Notify the server if the privacy setting was changed */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2789 if (type != purple_account_get_privacy_type(account) && purple_account_is_connected(account))
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2790 serv_set_permit_deny(purple_account_get_connection(account));
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2791 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2792
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2793 gboolean
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2794 purple_account_privacy_check(PurpleAccount *account, const char *who)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2795 {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2796 GSList *list;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2797
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2798 switch (purple_account_get_privacy_type(account)) {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2799 case PURPLE_ACCOUNT_PRIVACY_ALLOW_ALL:
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2800 return TRUE;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2801
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2802 case PURPLE_ACCOUNT_PRIVACY_DENY_ALL:
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2803 return FALSE;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2804
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2805 case PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS:
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2806 who = purple_normalize(account, who);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2807 for (list=account->permit; list!=NULL; list=list->next) {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2808 if (g_str_equal(who, list->data))
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2809 return TRUE;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2810 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2811 return FALSE;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2812
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2813 case PURPLE_ACCOUNT_PRIVACY_DENY_USERS:
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2814 who = purple_normalize(account, who);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2815 for (list=account->deny; list!=NULL; list=list->next) {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2816 if (g_str_equal(who, list->data))
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2817 return FALSE;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2818 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2819 return TRUE;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2820
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2821 case PURPLE_ACCOUNT_PRIVACY_ALLOW_BUDDYLIST:
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2822 return (purple_find_buddy(account, who) != NULL);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2823
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2824 default:
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2825 g_return_val_if_reached(TRUE);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2826 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2827 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
2828
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2829 PurpleStatus *
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2830 purple_account_get_active_status(const PurpleAccount *account)
10738
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
2831 {
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
2832 g_return_val_if_fail(account != NULL, NULL);
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
2833
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2834 return purple_presence_get_active_status(account->presence);
10738
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
2835 }
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10720
diff changeset
2836
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2837 PurpleStatus *
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2838 purple_account_get_status(const PurpleAccount *account, const char *status_id)
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2839 {
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2840 g_return_val_if_fail(account != NULL, NULL);
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2841 g_return_val_if_fail(status_id != NULL, NULL);
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2842
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2843 return purple_presence_get_status(account->presence, status_id);
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2844 }
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2845
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2846 PurpleStatusType *
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2847 purple_account_get_status_type(const PurpleAccount *account, const char *id)
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2848 {
18190
bcf28ef7e8ff Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@pidgin.im>
parents: 18122
diff changeset
2849 GList *l;
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2850
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2851 g_return_val_if_fail(account != NULL, NULL);
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2852 g_return_val_if_fail(id != NULL, NULL);
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2853
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2854 for (l = purple_account_get_status_types(account); l != NULL; l = l->next)
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2855 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2856 PurpleStatusType *status_type = (PurpleStatusType *)l->data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2857
25859
b42be7bb9dac 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 <darkrain42@pidgin.im>
parents: 25140
diff changeset
2858 if (purple_strequal(purple_status_type_get_id(status_type), id))
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2859 return status_type;
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2860 }
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2861
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2862 return NULL;
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2863 }
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2864
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2865 PurpleStatusType *
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2866 purple_account_get_status_type_with_primitive(const PurpleAccount *account, PurpleStatusPrimitive primitive)
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11736
diff changeset
2867 {
18190
bcf28ef7e8ff Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@pidgin.im>
parents: 18122
diff changeset
2868 GList *l;
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11736
diff changeset
2869
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11736
diff changeset
2870 g_return_val_if_fail(account != NULL, NULL);
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11736
diff changeset
2871
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2872 for (l = purple_account_get_status_types(account); l != NULL; l = l->next)
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11736
diff changeset
2873 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2874 PurpleStatusType *status_type = (PurpleStatusType *)l->data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2875
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2876 if (purple_status_type_get_primitive(status_type) == primitive)
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11736
diff changeset
2877 return status_type;
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11736
diff changeset
2878 }
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11736
diff changeset
2879
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11736
diff changeset
2880 return NULL;
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11736
diff changeset
2881 }
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11736
diff changeset
2882
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2883 PurplePresence *
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2884 purple_account_get_presence(const PurpleAccount *account)
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2885 {
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2886 g_return_val_if_fail(account != NULL, NULL);
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2887
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2888 return account->presence;
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2889 }
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2890
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2891 gboolean
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2892 purple_account_is_status_active(const PurpleAccount *account,
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2893 const char *status_id)
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2894 {
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2895 g_return_val_if_fail(account != NULL, FALSE);
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2896 g_return_val_if_fail(status_id != NULL, FALSE);
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2897
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2898 return purple_presence_is_status_active(account->presence, status_id);
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2899 }
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2900
18190
bcf28ef7e8ff Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@pidgin.im>
parents: 18122
diff changeset
2901 GList *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2902 purple_account_get_status_types(const PurpleAccount *account)
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2903 {
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2904 g_return_val_if_fail(account != NULL, NULL);
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2905
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2906 return account->status_types;
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2907 }
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
2908
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2909 int
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2910 purple_account_get_int(const PurpleAccount *account, const char *name,
5564
1779a1bfbdb8 [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5563
diff changeset
2911 int default_value)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2912 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2913 PurpleAccountSetting *setting;
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2914
5565
687cc390b7dc [gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents: 5564
diff changeset
2915 g_return_val_if_fail(account != NULL, default_value);
687cc390b7dc [gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents: 5564
diff changeset
2916 g_return_val_if_fail(name != NULL, default_value);
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2917
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2918 setting = g_hash_table_lookup(account->settings, name);
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2919
5564
1779a1bfbdb8 [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5563
diff changeset
2920 if (setting == NULL)
1779a1bfbdb8 [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5563
diff changeset
2921 return default_value;
1779a1bfbdb8 [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5563
diff changeset
2922
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2923 g_return_val_if_fail(setting->type == PURPLE_PREF_INT, default_value);
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2924
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2925 return setting->value.integer;
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2926 }
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2927
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2928 const char *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2929 purple_account_get_string(const PurpleAccount *account, const char *name,
5564
1779a1bfbdb8 [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5563
diff changeset
2930 const char *default_value)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2931 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2932 PurpleAccountSetting *setting;
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2933
5565
687cc390b7dc [gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents: 5564
diff changeset
2934 g_return_val_if_fail(account != NULL, default_value);
687cc390b7dc [gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents: 5564
diff changeset
2935 g_return_val_if_fail(name != NULL, default_value);
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2936
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2937 setting = g_hash_table_lookup(account->settings, name);
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2938
5564
1779a1bfbdb8 [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5563
diff changeset
2939 if (setting == NULL)
1779a1bfbdb8 [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5563
diff changeset
2940 return default_value;
1779a1bfbdb8 [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5563
diff changeset
2941
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2942 g_return_val_if_fail(setting->type == PURPLE_PREF_STRING, default_value);
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2943
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2944 return setting->value.string;
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2945 }
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2946
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2947 gboolean
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2948 purple_account_get_bool(const PurpleAccount *account, const char *name,
5564
1779a1bfbdb8 [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5563
diff changeset
2949 gboolean default_value)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2950 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2951 PurpleAccountSetting *setting;
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2952
5565
687cc390b7dc [gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents: 5564
diff changeset
2953 g_return_val_if_fail(account != NULL, default_value);
687cc390b7dc [gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents: 5564
diff changeset
2954 g_return_val_if_fail(name != NULL, default_value);
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2955
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2956 setting = g_hash_table_lookup(account->settings, name);
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2957
5564
1779a1bfbdb8 [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5563
diff changeset
2958 if (setting == NULL)
1779a1bfbdb8 [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5563
diff changeset
2959 return default_value;
1779a1bfbdb8 [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5563
diff changeset
2960
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2961 g_return_val_if_fail(setting->type == PURPLE_PREF_BOOLEAN, default_value);
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2962
20246
161dd7a7f73a applied changes from 7a436ba53de6adebccf4e920ca62d544e13b1094
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
2963 return setting->value.boolean;
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2964 }
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2965
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2966 int
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2967 purple_account_get_ui_int(const PurpleAccount *account, const char *ui,
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2968 const char *name, int default_value)
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2969 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2970 PurpleAccountSetting *setting;
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2971 GHashTable *table;
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2972
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2973 g_return_val_if_fail(account != NULL, default_value);
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2974 g_return_val_if_fail(ui != NULL, default_value);
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2975 g_return_val_if_fail(name != NULL, default_value);
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2976
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2977 if ((table = g_hash_table_lookup(account->ui_settings, ui)) == NULL)
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2978 return default_value;
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2979
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2980 if ((setting = g_hash_table_lookup(table, name)) == NULL)
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2981 return default_value;
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2982
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2983 g_return_val_if_fail(setting->type == PURPLE_PREF_INT, default_value);
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2984
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2985 return setting->value.integer;
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2986 }
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2987
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2988 const char *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2989 purple_account_get_ui_string(const PurpleAccount *account, const char *ui,
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2990 const char *name, const char *default_value)
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2991 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2992 PurpleAccountSetting *setting;
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2993 GHashTable *table;
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2994
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2995 g_return_val_if_fail(account != NULL, default_value);
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2996 g_return_val_if_fail(ui != NULL, default_value);
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2997 g_return_val_if_fail(name != NULL, default_value);
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2998
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
2999 if ((table = g_hash_table_lookup(account->ui_settings, ui)) == NULL)
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
3000 return default_value;
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
3001
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
3002 if ((setting = g_hash_table_lookup(table, name)) == NULL)
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
3003 return default_value;
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
3004
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3005 g_return_val_if_fail(setting->type == PURPLE_PREF_STRING, default_value);
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
3006
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
3007 return setting->value.string;
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
3008 }
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
3009
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
3010 gboolean
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3011 purple_account_get_ui_bool(const PurpleAccount *account, const char *ui,
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
3012 const char *name, gboolean default_value)
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
3013 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3014 PurpleAccountSetting *setting;
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
3015 GHashTable *table;
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
3016
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
3017 g_return_val_if_fail(account != NULL, default_value);
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
3018 g_return_val_if_fail(ui != NULL, default_value);
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
3019 g_return_val_if_fail(name != NULL, default_value);
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
3020
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
3021 if ((table = g_hash_table_lookup(account->ui_settings, ui)) == NULL)
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
3022 return default_value;
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
3023
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
3024 if ((setting = g_hash_table_lookup(table, name)) == NULL)
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
3025 return default_value;
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
3026
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3027 g_return_val_if_fail(setting->type == PURPLE_PREF_BOOLEAN, default_value);
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
3028
20246
161dd7a7f73a applied changes from 7a436ba53de6adebccf4e920ca62d544e13b1094
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
3029 return setting->value.boolean;
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
3030 }
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
3031
32630
461f208c04c0 Add accessors for _PurpleAccount.ui_data
Kevin Stange <kstange@pidgin.im>
parents: 32628
diff changeset
3032 gpointer
461f208c04c0 Add accessors for _PurpleAccount.ui_data
Kevin Stange <kstange@pidgin.im>
parents: 32628
diff changeset
3033 purple_account_get_ui_data(const PurpleAccount *account)
461f208c04c0 Add accessors for _PurpleAccount.ui_data
Kevin Stange <kstange@pidgin.im>
parents: 32628
diff changeset
3034 {
461f208c04c0 Add accessors for _PurpleAccount.ui_data
Kevin Stange <kstange@pidgin.im>
parents: 32628
diff changeset
3035 g_return_val_if_fail(account != NULL, NULL);
461f208c04c0 Add accessors for _PurpleAccount.ui_data
Kevin Stange <kstange@pidgin.im>
parents: 32628
diff changeset
3036
461f208c04c0 Add accessors for _PurpleAccount.ui_data
Kevin Stange <kstange@pidgin.im>
parents: 32628
diff changeset
3037 return account->ui_data;
461f208c04c0 Add accessors for _PurpleAccount.ui_data
Kevin Stange <kstange@pidgin.im>
parents: 32628
diff changeset
3038 }
461f208c04c0 Add accessors for _PurpleAccount.ui_data
Kevin Stange <kstange@pidgin.im>
parents: 32628
diff changeset
3039
461f208c04c0 Add accessors for _PurpleAccount.ui_data
Kevin Stange <kstange@pidgin.im>
parents: 32628
diff changeset
3040 void
32634
5d56f295adda I guess I shouldn't copy/paste code while running out the door.
Kevin Stange <kstange@pidgin.im>
parents: 32630
diff changeset
3041 purple_account_set_ui_data(PurpleAccount *account,
32630
461f208c04c0 Add accessors for _PurpleAccount.ui_data
Kevin Stange <kstange@pidgin.im>
parents: 32628
diff changeset
3042 gpointer ui_data)
461f208c04c0 Add accessors for _PurpleAccount.ui_data
Kevin Stange <kstange@pidgin.im>
parents: 32628
diff changeset
3043 {
32634
5d56f295adda I guess I shouldn't copy/paste code while running out the door.
Kevin Stange <kstange@pidgin.im>
parents: 32630
diff changeset
3044 g_return_if_fail(account != NULL);
32630
461f208c04c0 Add accessors for _PurpleAccount.ui_data
Kevin Stange <kstange@pidgin.im>
parents: 32628
diff changeset
3045
461f208c04c0 Add accessors for _PurpleAccount.ui_data
Kevin Stange <kstange@pidgin.im>
parents: 32628
diff changeset
3046 account->ui_data = ui_data;
461f208c04c0 Add accessors for _PurpleAccount.ui_data
Kevin Stange <kstange@pidgin.im>
parents: 32628
diff changeset
3047 }
461f208c04c0 Add accessors for _PurpleAccount.ui_data
Kevin Stange <kstange@pidgin.im>
parents: 32628
diff changeset
3048
461f208c04c0 Add accessors for _PurpleAccount.ui_data
Kevin Stange <kstange@pidgin.im>
parents: 32628
diff changeset
3049
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3050 PurpleLog *
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3051 purple_account_get_log(PurpleAccount *account, gboolean create)
8573
3f37bd7005c8 [gaim-migrate @ 9321]
Ka-Hing Cheung <khc@pidgin.im>
parents: 8549
diff changeset
3052 {
3f37bd7005c8 [gaim-migrate @ 9321]
Ka-Hing Cheung <khc@pidgin.im>
parents: 8549
diff changeset
3053 g_return_val_if_fail(account != NULL, NULL);
3f37bd7005c8 [gaim-migrate @ 9321]
Ka-Hing Cheung <khc@pidgin.im>
parents: 8549
diff changeset
3054
13508
3c66c5a0ca7c [gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents: 13282
diff changeset
3055 if(!account->system_log && create){
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3056 PurplePresence *presence;
11973
42a29ebcf30b [gaim-migrate @ 14266]
Mark Doliner <markdoliner@pidgin.im>
parents: 11920
diff changeset
3057 int login_time;
42a29ebcf30b [gaim-migrate @ 14266]
Mark Doliner <markdoliner@pidgin.im>
parents: 11920
diff changeset
3058
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3059 presence = purple_account_get_presence(account);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3060 login_time = purple_presence_get_login_time(presence);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3061
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3062 account->system_log = purple_log_new(PURPLE_LOG_SYSTEM,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3063 purple_account_get_username(account), account, NULL,
13120
c25222322810 [gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents: 12975
diff changeset
3064 (login_time != 0) ? login_time : time(NULL), NULL);
8573
3f37bd7005c8 [gaim-migrate @ 9321]
Ka-Hing Cheung <khc@pidgin.im>
parents: 8549
diff changeset
3065 }
3f37bd7005c8 [gaim-migrate @ 9321]
Ka-Hing Cheung <khc@pidgin.im>
parents: 8549
diff changeset
3066
3f37bd7005c8 [gaim-migrate @ 9321]
Ka-Hing Cheung <khc@pidgin.im>
parents: 8549
diff changeset
3067 return account->system_log;
3f37bd7005c8 [gaim-migrate @ 9321]
Ka-Hing Cheung <khc@pidgin.im>
parents: 8549
diff changeset
3068 }
3f37bd7005c8 [gaim-migrate @ 9321]
Ka-Hing Cheung <khc@pidgin.im>
parents: 8549
diff changeset
3069
3f37bd7005c8 [gaim-migrate @ 9321]
Ka-Hing Cheung <khc@pidgin.im>
parents: 8549
diff changeset
3070 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3071 purple_account_destroy_log(PurpleAccount *account)
8573
3f37bd7005c8 [gaim-migrate @ 9321]
Ka-Hing Cheung <khc@pidgin.im>
parents: 8549
diff changeset
3072 {
3f37bd7005c8 [gaim-migrate @ 9321]
Ka-Hing Cheung <khc@pidgin.im>
parents: 8549
diff changeset
3073 g_return_if_fail(account != NULL);
3f37bd7005c8 [gaim-migrate @ 9321]
Ka-Hing Cheung <khc@pidgin.im>
parents: 8549
diff changeset
3074
3f37bd7005c8 [gaim-migrate @ 9321]
Ka-Hing Cheung <khc@pidgin.im>
parents: 8549
diff changeset
3075 if(account->system_log){
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3076 purple_log_free(account->system_log);
8573
3f37bd7005c8 [gaim-migrate @ 9321]
Ka-Hing Cheung <khc@pidgin.im>
parents: 8549
diff changeset
3077 account->system_log = NULL;
3f37bd7005c8 [gaim-migrate @ 9321]
Ka-Hing Cheung <khc@pidgin.im>
parents: 8549
diff changeset
3078 }
3f37bd7005c8 [gaim-migrate @ 9321]
Ka-Hing Cheung <khc@pidgin.im>
parents: 8549
diff changeset
3079 }
3f37bd7005c8 [gaim-migrate @ 9321]
Ka-Hing Cheung <khc@pidgin.im>
parents: 8549
diff changeset
3080
5580
a5a3e6dfb409 [gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents: 5574
diff changeset
3081 void
32315
2550a39e0285 Rename the _with_invite functions to their counterparts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31992
diff changeset
3082 purple_account_add_buddy(PurpleAccount *account, PurpleBuddy *buddy, const char *message)
11643
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3083 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3084 PurplePluginProtocolInfo *prpl_info = NULL;
28392
4f4042de6782 Add assertions to purple_account_add_buddy; a NULL buddy is very bad. Refs #10115.
Paul Aurich <darkrain42@pidgin.im>
parents: 28373
diff changeset
3085 PurpleConnection *gc;
22357
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3086 PurplePlugin *prpl = NULL;
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25871
diff changeset
3087
28392
4f4042de6782 Add assertions to purple_account_add_buddy; a NULL buddy is very bad. Refs #10115.
Paul Aurich <darkrain42@pidgin.im>
parents: 28373
diff changeset
3088 g_return_if_fail(account != NULL);
4f4042de6782 Add assertions to purple_account_add_buddy; a NULL buddy is very bad. Refs #10115.
Paul Aurich <darkrain42@pidgin.im>
parents: 28373
diff changeset
3089 g_return_if_fail(buddy != NULL);
4f4042de6782 Add assertions to purple_account_add_buddy; a NULL buddy is very bad. Refs #10115.
Paul Aurich <darkrain42@pidgin.im>
parents: 28373
diff changeset
3090
4f4042de6782 Add assertions to purple_account_add_buddy; a NULL buddy is very bad. Refs #10115.
Paul Aurich <darkrain42@pidgin.im>
parents: 28373
diff changeset
3091 gc = purple_account_get_connection(account);
22357
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3092 if (gc != NULL)
29179
e60344f34d03 Fix some funny indenting.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28764
diff changeset
3093 prpl = purple_connection_get_prpl(gc);
22357
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3094
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3095 if (prpl != NULL)
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3096 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
11643
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3097
31594
ec0856af6477 Add new functions for adding buddies with an invite message. If the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31566
diff changeset
3098 if (prpl_info != NULL) {
32315
2550a39e0285 Rename the _with_invite functions to their counterparts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31992
diff changeset
3099 if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy))
2550a39e0285 Rename the _with_invite functions to their counterparts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31992
diff changeset
3100 prpl_info->add_buddy(gc, buddy, purple_buddy_get_group(buddy), message);
31594
ec0856af6477 Add new functions for adding buddies with an invite message. If the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31566
diff changeset
3101 }
ec0856af6477 Add new functions for adding buddies with an invite message. If the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31566
diff changeset
3102 }
ec0856af6477 Add new functions for adding buddies with an invite message. If the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31566
diff changeset
3103
ec0856af6477 Add new functions for adding buddies with an invite message. If the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31566
diff changeset
3104 void
32315
2550a39e0285 Rename the _with_invite functions to their counterparts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31992
diff changeset
3105 purple_account_add_buddies(PurpleAccount *account, GList *buddies, const char *message)
11643
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3106 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3107 PurplePluginProtocolInfo *prpl_info = NULL;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3108 PurpleConnection *gc = purple_account_get_connection(account);
22357
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3109 PurplePlugin *prpl = NULL;
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25871
diff changeset
3110
22357
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3111 if (gc != NULL)
29179
e60344f34d03 Fix some funny indenting.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28764
diff changeset
3112 prpl = purple_connection_get_prpl(gc);
22357
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3113
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3114 if (prpl != NULL)
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3115 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25871
diff changeset
3116
14669
df3f48ab4aff [gaim-migrate @ 17335]
Mark Doliner <markdoliner@pidgin.im>
parents: 14254
diff changeset
3117 if (prpl_info) {
11643
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3118 GList *cur, *groups = NULL;
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3119
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3120 /* Make a list of what group each buddy is in */
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3121 for (cur = buddies; cur != NULL; cur = cur->next) {
24957
647853a842da A couple of minor fixes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24955
diff changeset
3122 PurpleBuddy *buddy = cur->data;
647853a842da A couple of minor fixes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24955
diff changeset
3123 groups = g_list_append(groups, purple_buddy_get_group(buddy));
11643
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3124 }
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3125
32315
2550a39e0285 Rename the _with_invite functions to their counterparts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31992
diff changeset
3126 if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddies))
2550a39e0285 Rename the _with_invite functions to their counterparts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31992
diff changeset
3127 prpl_info->add_buddies(gc, buddies, groups, message);
31594
ec0856af6477 Add new functions for adding buddies with an invite message. If the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31566
diff changeset
3128 else if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy)) {
ec0856af6477 Add new functions for adding buddies with an invite message. If the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31566
diff changeset
3129 GList *curb = buddies, *curg = groups;
ec0856af6477 Add new functions for adding buddies with an invite message. If the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31566
diff changeset
3130
ec0856af6477 Add new functions for adding buddies with an invite message. If the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31566
diff changeset
3131 while ((curb != NULL) && (curg != NULL)) {
32315
2550a39e0285 Rename the _with_invite functions to their counterparts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31992
diff changeset
3132 prpl_info->add_buddy(gc, curb->data, curg->data, message);
11643
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3133 curb = curb->next;
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3134 curg = curg->next;
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3135 }
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3136 }
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3137
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3138 g_list_free(groups);
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3139 }
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3140 }
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3141
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3142 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3143 purple_account_remove_buddy(PurpleAccount *account, PurpleBuddy *buddy,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3144 PurpleGroup *group)
11643
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3145 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3146 PurplePluginProtocolInfo *prpl_info = NULL;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3147 PurpleConnection *gc = purple_account_get_connection(account);
22357
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3148 PurplePlugin *prpl = NULL;
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25871
diff changeset
3149
22357
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3150 if (gc != NULL)
29179
e60344f34d03 Fix some funny indenting.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28764
diff changeset
3151 prpl = purple_connection_get_prpl(gc);
22357
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3152
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3153 if (prpl != NULL)
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3154 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25871
diff changeset
3155
14669
df3f48ab4aff [gaim-migrate @ 17335]
Mark Doliner <markdoliner@pidgin.im>
parents: 14254
diff changeset
3156 if (prpl_info && prpl_info->remove_buddy)
11643
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3157 prpl_info->remove_buddy(gc, buddy, group);
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3158 }
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3159
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3160 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3161 purple_account_remove_buddies(PurpleAccount *account, GList *buddies, GList *groups)
11643
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3162 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3163 PurplePluginProtocolInfo *prpl_info = NULL;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3164 PurpleConnection *gc = purple_account_get_connection(account);
22357
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3165 PurplePlugin *prpl = NULL;
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25871
diff changeset
3166
22357
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3167 if (gc != NULL)
29179
e60344f34d03 Fix some funny indenting.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28764
diff changeset
3168 prpl = purple_connection_get_prpl(gc);
22357
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3169
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3170 if (prpl != NULL)
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3171 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25871
diff changeset
3172
14669
df3f48ab4aff [gaim-migrate @ 17335]
Mark Doliner <markdoliner@pidgin.im>
parents: 14254
diff changeset
3173 if (prpl_info) {
11643
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3174 if (prpl_info->remove_buddies)
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3175 prpl_info->remove_buddies(gc, buddies, groups);
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3176 else {
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3177 GList *curb = buddies;
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3178 GList *curg = groups;
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3179 while ((curb != NULL) && (curg != NULL)) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3180 purple_account_remove_buddy(account, curb->data, curg->data);
11643
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3181 curb = curb->next;
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3182 curg = curg->next;
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3183 }
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3184 }
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3185 }
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3186 }
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3187
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3188 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3189 purple_account_remove_group(PurpleAccount *account, PurpleGroup *group)
11643
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3190 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3191 PurplePluginProtocolInfo *prpl_info = NULL;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3192 PurpleConnection *gc = purple_account_get_connection(account);
22357
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3193 PurplePlugin *prpl = NULL;
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25871
diff changeset
3194
22357
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3195 if (gc != NULL)
29179
e60344f34d03 Fix some funny indenting.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28764
diff changeset
3196 prpl = purple_connection_get_prpl(gc);
22357
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3197
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3198 if (prpl != NULL)
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3199 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
11643
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3200
14669
df3f48ab4aff [gaim-migrate @ 17335]
Mark Doliner <markdoliner@pidgin.im>
parents: 14254
diff changeset
3201 if (prpl_info && prpl_info->remove_group)
11643
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3202 prpl_info->remove_group(gc, group);
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3203 }
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3204
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3205 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3206 purple_account_change_password(PurpleAccount *account, const char *orig_pw,
11643
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3207 const char *new_pw)
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3208 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3209 PurplePluginProtocolInfo *prpl_info = NULL;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3210 PurpleConnection *gc = purple_account_get_connection(account);
22357
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3211 PurplePlugin *prpl = NULL;
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25871
diff changeset
3212
34029
059c1270db1f Remove the silly destroy argument from purple_account_set_password and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34028
diff changeset
3213 purple_account_set_password(account, new_pw, NULL, NULL);
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25871
diff changeset
3214
22357
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3215 if (gc != NULL)
29179
e60344f34d03 Fix some funny indenting.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28764
diff changeset
3216 prpl = purple_connection_get_prpl(gc);
22357
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3217
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3218 if (prpl != NULL)
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3219 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
11643
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3220
14669
df3f48ab4aff [gaim-migrate @ 17335]
Mark Doliner <markdoliner@pidgin.im>
parents: 14254
diff changeset
3221 if (prpl_info && prpl_info->change_passwd)
11643
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3222 prpl_info->change_passwd(gc, orig_pw, new_pw);
11985
d4a210fb43e9 [gaim-migrate @ 14278]
Mark Doliner <markdoliner@pidgin.im>
parents: 11982
diff changeset
3223 }
11643
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
3224
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3225 gboolean purple_account_supports_offline_message(PurpleAccount *account, PurpleBuddy *buddy)
12645
a907ba243930 [gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12420
diff changeset
3226 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3227 PurpleConnection *gc;
22357
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3228 PurplePluginProtocolInfo *prpl_info = NULL;
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3229 PurplePlugin *prpl = NULL;
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25871
diff changeset
3230
12645
a907ba243930 [gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12420
diff changeset
3231 g_return_val_if_fail(account, FALSE);
a907ba243930 [gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12420
diff changeset
3232 g_return_val_if_fail(buddy, FALSE);
a907ba243930 [gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12420
diff changeset
3233
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3234 gc = purple_account_get_connection(account);
12645
a907ba243930 [gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12420
diff changeset
3235 if (gc == NULL)
a907ba243930 [gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12420
diff changeset
3236 return FALSE;
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25871
diff changeset
3237
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25871
diff changeset
3238 prpl = purple_connection_get_prpl(gc);
22357
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3239
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3240 if (prpl != NULL)
6f3b94a801a5 Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22235
diff changeset
3241 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
12645
a907ba243930 [gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12420
diff changeset
3242
a907ba243930 [gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12420
diff changeset
3243 if (!prpl_info || !prpl_info->offline_message)
a907ba243930 [gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12420
diff changeset
3244 return FALSE;
a907ba243930 [gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12420
diff changeset
3245 return prpl_info->offline_message(buddy);
a907ba243930 [gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12420
diff changeset
3246 }
a907ba243930 [gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12420
diff changeset
3247
21287
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
3248 static void
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
3249 signed_on_cb(PurpleConnection *gc,
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
3250 gpointer unused)
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
3251 {
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
3252 PurpleAccount *account = purple_connection_get_account(gc);
21311
bca57f8144a1 Add purple_account_clear_current_error(), which does what it says on the tin.
Will Thompson <resiak@pidgin.im>
parents: 21300
diff changeset
3253 purple_account_clear_current_error(account);
29992
9fee90090b04 account: Add copies of connection signed-(on|off) and connection-error.
Yonas Yanfa <yonas.yanfa@gmail.com>
parents: 29726
diff changeset
3254
9fee90090b04 account: Add copies of connection signed-(on|off) and connection-error.
Yonas Yanfa <yonas.yanfa@gmail.com>
parents: 29726
diff changeset
3255 purple_signal_emit(purple_accounts_get_handle(), "account-signed-on",
9fee90090b04 account: Add copies of connection signed-(on|off) and connection-error.
Yonas Yanfa <yonas.yanfa@gmail.com>
parents: 29726
diff changeset
3256 account);
9fee90090b04 account: Add copies of connection signed-(on|off) and connection-error.
Yonas Yanfa <yonas.yanfa@gmail.com>
parents: 29726
diff changeset
3257 }
9fee90090b04 account: Add copies of connection signed-(on|off) and connection-error.
Yonas Yanfa <yonas.yanfa@gmail.com>
parents: 29726
diff changeset
3258
9fee90090b04 account: Add copies of connection signed-(on|off) and connection-error.
Yonas Yanfa <yonas.yanfa@gmail.com>
parents: 29726
diff changeset
3259 static void
9fee90090b04 account: Add copies of connection signed-(on|off) and connection-error.
Yonas Yanfa <yonas.yanfa@gmail.com>
parents: 29726
diff changeset
3260 signed_off_cb(PurpleConnection *gc,
9fee90090b04 account: Add copies of connection signed-(on|off) and connection-error.
Yonas Yanfa <yonas.yanfa@gmail.com>
parents: 29726
diff changeset
3261 gpointer unused)
9fee90090b04 account: Add copies of connection signed-(on|off) and connection-error.
Yonas Yanfa <yonas.yanfa@gmail.com>
parents: 29726
diff changeset
3262 {
9fee90090b04 account: Add copies of connection signed-(on|off) and connection-error.
Yonas Yanfa <yonas.yanfa@gmail.com>
parents: 29726
diff changeset
3263 PurpleAccount *account = purple_connection_get_account(gc);
9fee90090b04 account: Add copies of connection signed-(on|off) and connection-error.
Yonas Yanfa <yonas.yanfa@gmail.com>
parents: 29726
diff changeset
3264
9fee90090b04 account: Add copies of connection signed-(on|off) and connection-error.
Yonas Yanfa <yonas.yanfa@gmail.com>
parents: 29726
diff changeset
3265 purple_signal_emit(purple_accounts_get_handle(), "account-signed-off",
9fee90090b04 account: Add copies of connection signed-(on|off) and connection-error.
Yonas Yanfa <yonas.yanfa@gmail.com>
parents: 29726
diff changeset
3266 account);
21287
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
3267 }
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
3268
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
3269 static void
22467
151133154190 Register and unregister the PurpleConnectionErrorInfo pointers with dbus, I
Etan Reisner <deryni@pidgin.im>
parents: 22357
diff changeset
3270 set_current_error(PurpleAccount *account, PurpleConnectionErrorInfo *new_err)
21312
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
3271 {
22469
b8c7242bd6a2 I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22357
diff changeset
3272 PurpleConnectionErrorInfo *old_err;
b8c7242bd6a2 I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22357
diff changeset
3273
b8c7242bd6a2 I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22357
diff changeset
3274 g_return_if_fail(account != NULL);
b8c7242bd6a2 I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22357
diff changeset
3275
32628
d3ad4cb046aa The intention is to make PurpleAccount a private structure in account.c, so merge
Andrew Victor <andrew.victor@mxit.com>
parents: 32582
diff changeset
3276 old_err = account->current_error;
21312
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
3277
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
3278 if(new_err == old_err)
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
3279 return;
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
3280
32628
d3ad4cb046aa The intention is to make PurpleAccount a private structure in account.c, so merge
Andrew Victor <andrew.victor@mxit.com>
parents: 32582
diff changeset
3281 account->current_error = new_err;
21312
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
3282
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
3283 purple_signal_emit(purple_accounts_get_handle(),
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
3284 "account-error-changed",
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
3285 account, old_err, new_err);
21314
b5c3b211f866 Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <resiak@pidgin.im>
parents: 21312
diff changeset
3286 schedule_accounts_save();
21312
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
3287
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
3288 if(old_err)
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
3289 g_free(old_err->description);
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
3290
22467
151133154190 Register and unregister the PurpleConnectionErrorInfo pointers with dbus, I
Etan Reisner <deryni@pidgin.im>
parents: 22357
diff changeset
3291 PURPLE_DBUS_UNREGISTER_POINTER(old_err);
21312
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
3292 g_free(old_err);
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
3293 }
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
3294
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
3295 static void
21287
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
3296 connection_error_cb(PurpleConnection *gc,
21312
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
3297 PurpleConnectionError type,
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
3298 const gchar *description,
21287
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
3299 gpointer unused)
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
3300 {
22469
b8c7242bd6a2 I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22357
diff changeset
3301 PurpleAccount *account;
b8c7242bd6a2 I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22357
diff changeset
3302 PurpleConnectionErrorInfo *err;
b8c7242bd6a2 I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22357
diff changeset
3303
b8c7242bd6a2 I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22357
diff changeset
3304 account = purple_connection_get_account(gc);
b8c7242bd6a2 I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22357
diff changeset
3305
b8c7242bd6a2 I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22357
diff changeset
3306 g_return_if_fail(account != NULL);
b8c7242bd6a2 I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22357
diff changeset
3307
b8c7242bd6a2 I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22357
diff changeset
3308 err = g_new0(PurpleConnectionErrorInfo, 1);
22484
669b07a614b1 Add this back, the merge lost it.
Etan Reisner <deryni@pidgin.im>
parents: 22473
diff changeset
3309 PURPLE_DBUS_REGISTER_POINTER(err, PurpleConnectionErrorInfo);
21312
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
3310
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
3311 err->type = type;
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
3312 err->description = g_strdup(description);
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
3313
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
3314 set_current_error(account, err);
29992
9fee90090b04 account: Add copies of connection signed-(on|off) and connection-error.
Yonas Yanfa <yonas.yanfa@gmail.com>
parents: 29726
diff changeset
3315
9fee90090b04 account: Add copies of connection signed-(on|off) and connection-error.
Yonas Yanfa <yonas.yanfa@gmail.com>
parents: 29726
diff changeset
3316 purple_signal_emit(purple_accounts_get_handle(), "account-connection-error",
9fee90090b04 account: Add copies of connection signed-(on|off) and connection-error.
Yonas Yanfa <yonas.yanfa@gmail.com>
parents: 29726
diff changeset
3317 account, type, description);
21287
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
3318 }
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
3319
34165
cdd4b0dfe92b keyring.c refactoring: use signal instead of hack depending on implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34157
diff changeset
3320 static void
cdd4b0dfe92b keyring.c refactoring: use signal instead of hack depending on implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34157
diff changeset
3321 password_migration_cb(PurpleAccount *account)
cdd4b0dfe92b keyring.c refactoring: use signal instead of hack depending on implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34157
diff changeset
3322 {
34196
3ba4989ede79 Complete master password implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34170
diff changeset
3323 /* account may be NULL (means: all) */
34165
cdd4b0dfe92b keyring.c refactoring: use signal instead of hack depending on implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34157
diff changeset
3324
cdd4b0dfe92b keyring.c refactoring: use signal instead of hack depending on implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34157
diff changeset
3325 schedule_accounts_save();
cdd4b0dfe92b keyring.c refactoring: use signal instead of hack depending on implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34157
diff changeset
3326 }
cdd4b0dfe92b keyring.c refactoring: use signal instead of hack depending on implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34157
diff changeset
3327
21298
d0d9cfaf3fe7 Mark pointed out that PurpleConnectionErrorPair is not a very good name for the
Will Thompson <resiak@pidgin.im>
parents: 21295
diff changeset
3328 const PurpleConnectionErrorInfo *
21287
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
3329 purple_account_get_current_error(PurpleAccount *account)
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
3330 {
32628
d3ad4cb046aa The intention is to make PurpleAccount a private structure in account.c, so merge
Andrew Victor <andrew.victor@mxit.com>
parents: 32582
diff changeset
3331 return account->current_error;
21287
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
3332 }
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
3333
21504
0c78851f576b Propagating ipp to im.pidgin.cpw.resiak.disconnectreason caused
Will Thompson <resiak@pidgin.im>
parents: 21503
diff changeset
3334 void
0c78851f576b Propagating ipp to im.pidgin.cpw.resiak.disconnectreason caused
Will Thompson <resiak@pidgin.im>
parents: 21503
diff changeset
3335 purple_account_clear_current_error(PurpleAccount *account)
21311
bca57f8144a1 Add purple_account_clear_current_error(), which does what it says on the tin.
Will Thompson <resiak@pidgin.im>
parents: 21300
diff changeset
3336 {
21504
0c78851f576b Propagating ipp to im.pidgin.cpw.resiak.disconnectreason caused
Will Thompson <resiak@pidgin.im>
parents: 21503
diff changeset
3337 set_current_error(account, NULL);
21311
bca57f8144a1 Add purple_account_clear_current_error(), which does what it says on the tin.
Will Thompson <resiak@pidgin.im>
parents: 21300
diff changeset
3338 }
21504
0c78851f576b Propagating ipp to im.pidgin.cpw.resiak.disconnectreason caused
Will Thompson <resiak@pidgin.im>
parents: 21503
diff changeset
3339
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
3340 GType
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
3341 purple_account_get_type(void)
6368
ab9f99269dfe [gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents: 6367
diff changeset
3342 {
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
3343 static GType type = 0;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
3344
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
3345 if(type == 0) {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
3346 static const GTypeInfo info = {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
3347 sizeof(PurpleAccountClass),
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
3348 NULL,
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
3349 NULL,
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
3350 NULL, /*TODO: (GClassInitFunc)purple_account_class_init,*/
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
3351 NULL,
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
3352 NULL,
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
3353 sizeof(PurpleAccount),
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
3354 0,
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
3355 NULL, /*TODO: (GInstanceInitFunc)purple_account_init,*/
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
3356 NULL,
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
3357 };
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
3358
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
3359 type = g_type_register_static(G_TYPE_OBJECT,
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
3360 "PurpleAccount",
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
3361 &info, 0);
5943
8a052155157a [gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents: 5942
diff changeset
3362 }
8a052155157a [gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents: 5942
diff changeset
3363
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
3364 return type;
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6368
diff changeset
3365 }

mercurial