libpurple/account.c

Fri, 10 Jun 2022 20:42:36 -0500

author
ivanhoe <ivanhoe@fiscari.de>
date
Fri, 10 Jun 2022 20:42:36 -0500
changeset 41432
aaff9cefb423
parent 41429
1f1a3fbb2759
child 41438
86beaec0fa35
permissions
-rw-r--r--

fix memory leak when using purple accounts

Testing Done:
ran test_account_manager and test_notification (from /r/1502 where I first encountered that leak) in valgrind -> no more leak and no new invalid read/write

Reviewed at https://reviews.imfreedom.org/r/1503/

20147
66f05a854eee applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents: 20093
diff changeset
1 /* purple
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3 * 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
4 * 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
5 * source distribution.
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6368
diff changeset
6 *
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
8 * 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
9 * the Free Software Foundation; either version 2 of the License, or
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 * (at your option) any later version.
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 *
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 * GNU General Public License for more details.
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 * You should have received a copy of the GNU General Public License
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * 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
19 * 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
20 */
40441
f23c7e772667 Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
21
f23c7e772667 Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
22 #include <glib/gi18n-lib.h>
f23c7e772667 Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
23
5872
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5870
diff changeset
24 #include "internal.h"
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
25
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
26 #include "accounts.h"
11053
6d2abb51e586 [gaim-migrate @ 12991]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11042
diff changeset
27 #include "core.h"
5717
2f3a377de638 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents: 5711
diff changeset
28 #include "debug.h"
14758
13b9adc9efd2 [gaim-migrate @ 17448]
Sean Egan <seanegan@pidgin.im>
parents: 14724
diff changeset
29 #include "network.h"
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
30 #include "notify.h"
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31 #include "prefs.h"
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
32 #include "purpleaccountmanager.h"
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40521
diff changeset
33 #include "purpleaccountpresence.h"
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
34 #include "purpleconversationmanager.h"
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
35 #include "purplecredentialmanager.h"
40439
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40332
diff changeset
36 #include "purpleprivate.h"
40634
4d3018b00ad4 Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
37 #include "purpleprotocolclient.h"
40803
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
38 #include "purpleprotocolmanager.h"
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
39 #include "purpleprotocolserver.h"
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
40 #include "request.h"
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
41 #include "server.h"
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6368
diff changeset
42 #include "signals.h"
5717
2f3a377de638 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents: 5711
diff changeset
43 #include "util.h"
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44
39663
d3c442966920 Remove PurpleAccount->ui_data and accessors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39514
diff changeset
45 /**
d3c442966920 Remove PurpleAccount->ui_data and accessors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39514
diff changeset
46 * PurpleAccount:
d3c442966920 Remove PurpleAccount->ui_data and accessors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39514
diff changeset
47 *
d3c442966920 Remove PurpleAccount->ui_data and accessors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39514
diff changeset
48 * Structure representing an account.
d3c442966920 Remove PurpleAccount->ui_data and accessors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39514
diff changeset
49 */
d3c442966920 Remove PurpleAccount->ui_data and accessors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39514
diff changeset
50 struct _PurpleAccount
d3c442966920 Remove PurpleAccount->ui_data and accessors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39514
diff changeset
51 {
d3c442966920 Remove PurpleAccount->ui_data and accessors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39514
diff changeset
52 GObject gparent;
d3c442966920 Remove PurpleAccount->ui_data and accessors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39514
diff changeset
53 };
d3c442966920 Remove PurpleAccount->ui_data and accessors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39514
diff changeset
54
21287
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
55 typedef struct
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
56 {
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
57 gchar *id;
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
58
35470
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
59 char *username; /* The username. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
60 char *alias; /* How you appear to yourself. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
61 char *user_info; /* User information. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
62
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
63 char *buddy_icon_path; /* The buddy icon's non-cached path. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
64
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
65 gboolean enabled;
35470
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
66 gboolean remember_pass; /* Remember the password. */
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
67
34593
318dcc5ef8e8 Added reminder to replace protocol_id member of account by a GObject
Ankit Vani <a@nevitus.org>
parents: 34591
diff changeset
68 /*
318dcc5ef8e8 Added reminder to replace protocol_id member of account by a GObject
Ankit Vani <a@nevitus.org>
parents: 34591
diff changeset
69 * TODO: After a GObject representing a protocol is ready, use it
318dcc5ef8e8 Added reminder to replace protocol_id member of account by a GObject
Ankit Vani <a@nevitus.org>
parents: 34591
diff changeset
70 * here instead of the protocol ID.
318dcc5ef8e8 Added reminder to replace protocol_id member of account by a GObject
Ankit Vani <a@nevitus.org>
parents: 34591
diff changeset
71 */
35470
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
72 char *protocol_id; /* The ID of the protocol. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
73
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
74 PurpleConnection *gc; /* The connection handle. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
75 gboolean disconnecting; /* The account is currently disconnecting */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
76
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
77 GHashTable *settings; /* Protocol-specific settings. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
78
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
79 PurpleProxyInfo *proxy_info; /* Proxy information. This will be set */
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
80 /* 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
81 /* proxy settings from global prefs. */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
82
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
83 /*
35152
bedba98d98f2 Change this comment to say that we should use a single, good-enough data
Mark Doliner <mark@kingant.net>
parents: 35150
diff changeset
84 * TODO: Instead of linked lists for permit and deny, use a data
bedba98d98f2 Change this comment to say that we should use a single, good-enough data
Mark Doliner <mark@kingant.net>
parents: 35150
diff changeset
85 * structure that allows fast lookups AND decent performance when
bedba98d98f2 Change this comment to say that we should use a single, good-enough data
Mark Doliner <mark@kingant.net>
parents: 35150
diff changeset
86 * iterating through all items. Fast lookups should help performance
bedba98d98f2 Change this comment to say that we should use a single, good-enough data
Mark Doliner <mark@kingant.net>
parents: 35150
diff changeset
87 * for protocols like MSN, where all your buddies exist in your permit
bedba98d98f2 Change this comment to say that we should use a single, good-enough data
Mark Doliner <mark@kingant.net>
parents: 35150
diff changeset
88 * list therefore the permit list is large. Possibly GTree or
bedba98d98f2 Change this comment to say that we should use a single, good-enough data
Mark Doliner <mark@kingant.net>
parents: 35150
diff changeset
89 * GHashTable.
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
90 */
35470
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
91 GSList *permit; /* Permit list. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
92 GSList *deny; /* Deny list. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
93 PurpleAccountPrivacyType privacy_type; /* The permit/deny setting. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
94
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
95 GList *status_types; /* Status types. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
96
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
97 PurplePresence *presence; /* Presence. */
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
98
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
99 PurpleAccountRegistrationCb registration_cb;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
100 void *registration_cb_user_data;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
101
35470
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
102 PurpleConnectionErrorInfo *current_error; /* Errors */
21287
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
103 } PurpleAccountPrivate;
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
104
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
105 typedef struct
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
106 {
5777
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
107 char *ui;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
108 GValue value;
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
109
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
110 } PurpleAccountSetting;
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
111
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
112 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
113 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
114 PurpleAccountRequestType type;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
115 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
116 void *ui_handle;
20421
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
117 char *user;
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
118 gpointer userdata;
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
119 PurpleAccountRequestAuthorizationCb auth_cb;
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
120 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
121 guint ref;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
122 } PurpleAccountRequestInfo;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
123
33996
ca5e901a5311 Implemented a password caching system to limit problems linked to the
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33995
diff changeset
124 typedef struct
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
125 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
126 PurpleAccount *account;
41312
c39de96b3daf Replace PurpleCallback by GCallback
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41220
diff changeset
127 GCallback 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
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
131 /* GObject Property enums */
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
132 enum
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
133 {
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
134 PROP_0,
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
135 PROP_ID,
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
136 PROP_USERNAME,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
137 PROP_PRIVATE_ALIAS,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
138 PROP_ENABLED,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
139 PROP_CONNECTION,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
140 PROP_PROTOCOL_ID,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
141 PROP_USER_INFO,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
142 PROP_BUDDY_ICON_PATH,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
143 PROP_REMEMBER_PASSWORD,
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
144 PROP_PROXY_INFO,
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
145 PROP_LAST
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
146 };
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
147
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
148 static GParamSpec *properties[PROP_LAST];
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
149 static GList *handles = NULL;
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
150
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
151 G_DEFINE_TYPE_WITH_PRIVATE(PurpleAccount, purple_account, G_TYPE_OBJECT);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
152
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
153 /******************************************************************************
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
154 * Helpers
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
155 *****************************************************************************/
30740
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30708
diff changeset
156 static void
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
157 purple_account_register_got_password_cb(GObject *obj, GAsyncResult *res,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
158 gpointer data)
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
159 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
160 PurpleCredentialManager *manager = PURPLE_CREDENTIAL_MANAGER(obj);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
161 PurpleAccount *account = PURPLE_ACCOUNT(data);
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
162 GError *error = NULL;
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
163 gchar *password = NULL;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
164
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
165 password = purple_credential_manager_read_password_finish(manager, res,
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
166 &error);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
167
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
168 if(error != NULL) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
169 purple_debug_warning("account", "failed to read password: %s",
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
170 error->message);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
171 g_error_free(error);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
172 }
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
173
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
174 _purple_connection_new(account, TRUE, password);
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
175
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
176 g_free(password);
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
177 }
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
178
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
179 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
180 purple_account_register(PurpleAccount *account)
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
181 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
182 PurpleCredentialManager *manager = NULL;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
183
34983
81638be26f41 Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents: 34955
diff changeset
184 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
185
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
186 purple_debug_info("account", "Registering account %s\n",
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
187 purple_account_get_username(account));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
188
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
189 manager = purple_credential_manager_get_default();
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
190 purple_credential_manager_read_password_async(manager, account, NULL,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
191 purple_account_register_got_password_cb,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
192 account);
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
193 }
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
194
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
195 static void
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
196 purple_account_unregister_got_password_cb(GObject *obj, GAsyncResult *res,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
197 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
198 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
199 PurpleCredentialManager *manager = PURPLE_CREDENTIAL_MANAGER(obj);
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
200 PurpleCallbackBundle *cbb = data;
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
201 PurpleAccountUnregistrationCb cb;
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
202 GError *error = NULL;
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
203 gchar *password = NULL;
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
204
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
205 cb = (PurpleAccountUnregistrationCb)cbb->cb;
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
206
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
207 password = purple_credential_manager_read_password_finish(manager, res,
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
208 &error);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
209
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
210 if(error != NULL) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
211 purple_debug_warning("account", "failed to read password: %s",
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
212 error->message);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
213
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
214 g_error_free(error);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
215 }
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
216
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
217 _purple_connection_new_unregister(cbb->account, password, cb, cbb->data);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
218
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
219 g_free(password);
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
220 g_free(cbb);
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
221 }
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
222
34992
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
223 struct register_completed_closure
32721
3a64afbc2da2 Introduce purple_account_register_completed() to handle the invoking of any
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
224 {
34992
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
225 PurpleAccount *account;
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
226 gboolean succeeded;
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
227 };
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
228
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
229 static gboolean
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
230 purple_account_register_completed_cb(gpointer data)
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
231 {
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
232 struct register_completed_closure *closure = data;
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
233 PurpleAccountPrivate *priv;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
234
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
235 priv = purple_account_get_instance_private(closure->account);
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
236
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
237 if (priv->registration_cb)
34992
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
238 (priv->registration_cb)(closure->account, closure->succeeded,
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
239 priv->registration_cb_user_data);
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
240
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
241 g_object_unref(closure->account);
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
242 g_free(closure);
34991
63c14353a0f4 Manage refcounts in some libpurple callbacks
Ankit Vani <a@nevitus.org>
parents: 34990
diff changeset
243
34990
6e2b46ef6743 Add a timeout for calling registration callback.
Ankit Vani <a@nevitus.org>
parents: 34987
diff changeset
244 return FALSE;
6e2b46ef6743 Add a timeout for calling registration callback.
Ankit Vani <a@nevitus.org>
parents: 34987
diff changeset
245 }
6e2b46ef6743 Add a timeout for calling registration callback.
Ankit Vani <a@nevitus.org>
parents: 34987
diff changeset
246
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
247 static void
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
248 request_password_write_cb(GObject *obj, GAsyncResult *res, gpointer data) {
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
249 PurpleCredentialManager *manager = PURPLE_CREDENTIAL_MANAGER(obj);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
250 PurpleAccount *account = PURPLE_ACCOUNT(data);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
251 GError *error = NULL;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
252 gchar *password = NULL;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
253
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
254 /* We stash the password on the account to get it to this call back... It's
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
255 * kind of gross but shouldn't be a big deal because any plugin has access
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
256 * to the credential store, so it's not really a security leak.
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
257 */
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
258 password = (gchar *)g_object_get_data(G_OBJECT(account), "_tmp_password");
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
259 g_object_set_data(G_OBJECT(account), "_tmp_password", NULL);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
260
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
261 if(!purple_credential_manager_write_password_finish(manager, res, &error)) {
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
262 const gchar *name = purple_account_get_name_for_display(account);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
263
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
264 /* we can't error an account without a connection, so we just drop a
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
265 * debug message for now and continue to connect the account.
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
266 */
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
267 purple_debug_info("account",
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
268 "failed to save password for account \"%s\": %s",
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
269 name,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
270 error != NULL ? error->message : "unknown error");
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
271 }
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
272
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
273 _purple_connection_new(account, FALSE, password);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
274
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
275 g_free(password);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
276 }
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
277
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
278 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
279 request_password_ok_cb(PurpleAccount *account, PurpleRequestFields *fields)
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
280 {
11042
d1ccf8d8a187 [gaim-migrate @ 12954]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11033
diff changeset
281 const char *entry;
d1ccf8d8a187 [gaim-migrate @ 12954]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11033
diff changeset
282 gboolean remember;
11985
d4a210fb43e9 [gaim-migrate @ 14278]
Mark Doliner <markdoliner@pidgin.im>
parents: 11982
diff changeset
283
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
284 entry = purple_request_fields_get_string(fields, "password");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
285 remember = purple_request_fields_get_bool(fields, "remember");
11985
d4a210fb43e9 [gaim-migrate @ 14278]
Mark Doliner <markdoliner@pidgin.im>
parents: 11982
diff changeset
286
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
287 if (!entry || !*entry)
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
288 {
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
289 purple_notify_error(account, NULL,
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
290 _("Password is required to sign on."), NULL,
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
291 purple_request_cpar_from_account(account));
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
292 return;
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
293 }
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
294
33996
ca5e901a5311 Implemented a password caching system to limit problems linked to the
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33995
diff changeset
295 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
296
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
297 if(remember) {
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
298 PurpleCredentialManager *manager = NULL;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
299
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
300 manager = purple_credential_manager_get_default();
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
301
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
302 /* The requests field can be invalidated by the time we write the
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
303 * password and we want to use it in the write callback, so we need to
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
304 * duplicate it for that callback.
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
305 */
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
306 g_object_set_data(G_OBJECT(account), "_tmp_password", g_strdup(entry));
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
307 purple_credential_manager_write_password_async(manager, account, entry,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
308 NULL,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
309 request_password_write_cb,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
310 account);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
311 } else {
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
312 _purple_connection_new(account, FALSE, entry);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
313 }
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
314 }
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
315
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
316 static void
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
317 request_password_cancel_cb(PurpleAccount *account, PurpleRequestFields *fields)
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
318 {
30708
535bec1e66fb Standardize on "cancelled".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30456
diff changeset
319 /* Disable the account as the user has cancelled connecting */
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
320 purple_account_set_enabled(account, FALSE);
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
321 }
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
322
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
323
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
324 static void
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
325 purple_account_connect_got_password_cb(GObject *obj, GAsyncResult *res,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
326 gpointer data)
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
327 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
328 PurpleCredentialManager *manager = PURPLE_CREDENTIAL_MANAGER(obj);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
329 PurpleAccount *account = PURPLE_ACCOUNT(data);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
330 PurpleProtocol *protocol = NULL;
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
331 GError *error = NULL;
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
332 gchar *password = NULL;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
333
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
334 password = purple_credential_manager_read_password_finish(manager, res,
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
335 &error);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
336
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
337 if(error != NULL) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
338 purple_debug_warning("account", "failed to read password %s",
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
339 error->message);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
340
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
341 g_error_free(error);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
342 }
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
343
40804
5496016b3c00 Port libpurple from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents: 40803
diff changeset
344 protocol = purple_account_get_protocol(account);
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
345
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
346 if((password == NULL || *password == '\0') &&
36607
7ad7681dcfd8 Use purple_protocol_get_* API instead of protocol->member
Ankit Vani <a@nevitus.org>
parents: 36606
diff changeset
347 !(purple_protocol_get_options(protocol) & OPT_PROTO_NO_PASSWORD) &&
7ad7681dcfd8 Use purple_protocol_get_* API instead of protocol->member
Ankit Vani <a@nevitus.org>
parents: 36606
diff changeset
348 !(purple_protocol_get_options(protocol) & OPT_PROTO_PASSWORD_OPTIONAL))
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
349 {
34145
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
350 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
351 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
352 G_CALLBACK(request_password_cancel_cb), account);
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
353 } else {
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
354 _purple_connection_new(account, FALSE, password);
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
355 }
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
356
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
357 g_free(password);
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
358 }
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
359
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
360 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
361 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
362 {
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
363 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
364 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
365
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
366 /* 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
367 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
368 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
369 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
370 }
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
371
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
372 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
373 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
374 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
375 PurpleAccountUiOps *ops;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
376
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
377 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
378
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
379 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
380 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
381
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
382 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
383 }
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
384
20421
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
385 static void
33687
0819d40769c8 Add a message to the authorization callbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33686
diff changeset
386 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
387 {
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
388 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
389
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
390 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
391
29046
1cae96b8e674 *** Plucked rev 0707f870a510922ae86ef379b5f01efa76d01402 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <datallah@pidgin.im>
parents: 28764
diff changeset
392 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
393 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
394
20421
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
395 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
396 "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
397
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
398 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
399 }
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
400
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
401 static void
33687
0819d40769c8 Add a message to the authorization callbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33686
diff changeset
402 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
403 {
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
404 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
405
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
406 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
407
29046
1cae96b8e674 *** Plucked rev 0707f870a510922ae86ef379b5f01efa76d01402 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <datallah@pidgin.im>
parents: 28764
diff changeset
408 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
409 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
410
20421
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
411 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
412 "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
413
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
414 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
415 }
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
416
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
417 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
418 change_password_cb(PurpleAccount *account, PurpleRequestFields *fields)
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
419 {
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
420 const char *orig_pass, *new_pass_1, *new_pass_2;
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
421
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
422 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
423 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
424 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
425
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
426 if (g_utf8_collate(new_pass_1, new_pass_2))
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
427 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
428 purple_notify_error(account, NULL,
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
429 _("New passwords do not match."), NULL,
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
430 purple_request_cpar_from_account(account));
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
431
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
432 return;
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
433 }
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
434
22854
0002c0556d57 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22484
diff changeset
435 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
436 (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
437 (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
438 (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
439 (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
440 (new_pass_2 == NULL || *new_pass_2 == '\0')))
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
441 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
442 purple_notify_error(account, NULL,
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
443 _("Fill out all fields completely."), NULL,
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
444 purple_request_cpar_from_account(account));
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
445 return;
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
446 }
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
447
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
448 purple_account_change_password(account, orig_pass, new_pass_1);
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
449 }
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
450
7067
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
451 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
452 set_user_info_cb(PurpleAccount *account, const char *user_info)
7067
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
453 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
454 PurpleConnection *gc;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
455
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
456 purple_account_set_user_info(account, user_info);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
457 gc = purple_account_get_connection(account);
35499
c4c5e0a670b1 Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
458 purple_serv_set_info(gc, user_info);
7067
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
459 }
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
460
34582
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
461 static void
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
462 delete_setting(void *data)
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
463 {
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
464 PurpleAccountSetting *setting = (PurpleAccountSetting *)data;
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
465
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
466 g_free(setting->ui);
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
467 g_value_unset(&setting->value);
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
468
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
469 g_free(setting);
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
470 }
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
471
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
472 static PurpleConnectionState
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
473 purple_account_get_state(PurpleAccount *account)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
474 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
475 PurpleConnection *gc;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
476
34983
81638be26f41 Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents: 34955
diff changeset
477 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), PURPLE_CONNECTION_DISCONNECTED);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
478
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
479 gc = purple_account_get_connection(account);
11251
e38d86958a63 [gaim-migrate @ 13420]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11249
diff changeset
480 if (!gc)
34746
dc9c911dbd35 Started GObjectification of PurpleConnection.
Ankit Vani <a@nevitus.org>
parents: 34745
diff changeset
481 return PURPLE_CONNECTION_DISCONNECTED;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
482
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
483 return purple_connection_get_state(gc);
11251
e38d86958a63 [gaim-migrate @ 13420]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11249
diff changeset
484 }
e38d86958a63 [gaim-migrate @ 13420]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11249
diff changeset
485
35458
385156e1b493 Fix some gtk-doc warnings from account to connection
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
486 /*
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
487 * 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
488 * 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
489 */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
490 static void
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
491 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
492 {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
493 GSList *list;
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
494 PurpleAccountPrivate *priv = purple_account_get_instance_private(account);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
495
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
496 /* Remove anyone in the permit list who is not in the buddylist */
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
497 for (list = priv->permit; list != NULL; ) {
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
498 char *person = list->data;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
499 list = list->next;
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
500 if (!purple_blist_find_buddy(account, person))
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
501 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
502 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
503
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
504 /* Now make sure everyone in the buddylist is in the permit list */
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
505 list = purple_blist_find_buddies(account, NULL);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
506 while (list != NULL)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
507 {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
508 PurpleBuddy *buddy = list->data;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
509 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
510
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
511 if (!g_slist_find_custom(priv->permit, name, (GCompareFunc)g_utf8_collate))
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
512 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
513 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
514 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
515 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
516
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
517 void
34767
38a5613c3e26 Prepended functions private to a subsystem but used over multiple files by underscore
Ankit Vani <a@nevitus.org>
parents: 34765
diff changeset
518 _purple_account_set_current_error(PurpleAccount *account,
34582
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
519 PurpleConnectionErrorInfo *new_err)
29992
9fee90090b04 account: Add copies of connection signed-(on|off) and connection-error.
Yonas Yanfa <yonas.yanfa@gmail.com>
parents: 29726
diff changeset
520 {
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
521 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
522 PurpleAccountPrivate *priv;
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
523
34983
81638be26f41 Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents: 34955
diff changeset
524 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
525 priv = purple_account_get_instance_private(account);
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
526
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
527 old_err = priv->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
528
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
529 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
530 return;
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
531
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
532 priv->current_error = new_err;
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
533
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
534 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
535 "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
536 account, old_err, new_err);
34582
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
537 purple_accounts_schedule_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
538
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
539 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
540 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
541
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
542 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
543 }
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
544
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
545 /******************************************************************************
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
546 * XmlNode Helpers
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
547 *****************************************************************************/
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
548 static PurpleXmlNode *
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
549 proxy_settings_to_xmlnode(PurpleProxyInfo *proxy_info)
5710
3c2bf5725bb0 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5707
diff changeset
550 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
551 PurpleXmlNode *node, *child;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
552 PurpleProxyType proxy_type;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
553 const char *value;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
554 int int_value;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
555 char buf[21];
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
556
35378
5d9e2581005b gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents: 35178
diff changeset
557 proxy_type = purple_proxy_info_get_proxy_type(proxy_info);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
558
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
559 node = purple_xmlnode_new("proxy");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
560
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
561 child = purple_xmlnode_new_child(node, "type");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
562 purple_xmlnode_insert_data(child,
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
563 (proxy_type == PURPLE_PROXY_TYPE_USE_GLOBAL ? "global" :
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
564 proxy_type == PURPLE_PROXY_TYPE_NONE ? "none" :
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
565 proxy_type == PURPLE_PROXY_TYPE_HTTP ? "http" :
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
566 proxy_type == PURPLE_PROXY_TYPE_SOCKS4 ? "socks4" :
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
567 proxy_type == PURPLE_PROXY_TYPE_SOCKS5 ? "socks5" :
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
568 proxy_type == PURPLE_PROXY_TYPE_TOR ? "tor" :
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
569 proxy_type == PURPLE_PROXY_TYPE_USE_ENVVAR ? "envvar" : "unknown"), -1);
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
570
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
571 if ((value = purple_proxy_info_get_hostname(proxy_info)) != NULL)
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
572 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
573 child = purple_xmlnode_new_child(node, "host");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
574 purple_xmlnode_insert_data(child, value, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
575 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
576
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
577 if ((int_value = purple_proxy_info_get_port(proxy_info)) != 0)
24955
77727fac30c6 Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents: 24569
diff changeset
578 {
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
579 g_snprintf(buf, sizeof(buf), "%d", int_value);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
580 child = purple_xmlnode_new_child(node, "port");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
581 purple_xmlnode_insert_data(child, buf, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
582 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
583
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
584 if ((value = purple_proxy_info_get_username(proxy_info)) != NULL)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
585 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
586 child = purple_xmlnode_new_child(node, "username");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
587 purple_xmlnode_insert_data(child, value, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
588 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
589
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
590 if ((value = purple_proxy_info_get_password(proxy_info)) != NULL)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
591 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
592 child = purple_xmlnode_new_child(node, "password");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
593 purple_xmlnode_insert_data(child, value, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
594 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
595
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
596 return node;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
597 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
598
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
599 static PurpleXmlNode *
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
600 current_error_to_xmlnode(PurpleConnectionErrorInfo *err)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
601 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
602 PurpleXmlNode *node, *child;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
603 char type_str[3];
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
604
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
605 node = purple_xmlnode_new("current_error");
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
606
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
607 if(err == NULL)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
608 return node;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
609
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
610 /* It doesn't make sense to have transient errors persist across a
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
611 * restart.
21300
1c23e08cb824 Document exactly how long the PurpleConnectionErrorInfo pointers given out by
Will Thompson <resiak@pidgin.im>
parents: 21298
diff changeset
612 */
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
613 if(!purple_connection_error_is_fatal (err->type))
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
614 return node;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
615
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
616 child = purple_xmlnode_new_child(node, "type");
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
617 g_snprintf(type_str, sizeof(type_str), "%u", err->type);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
618 purple_xmlnode_insert_data(child, type_str, -1);
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
619
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
620 child = purple_xmlnode_new_child(node, "description");
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
621 if(err->description) {
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
622 char *utf8ized = purple_utf8_try_convert(err->description);
40519
974dbfd7e52f Remove and replace a number of the purple utility functions
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
623 if(utf8ized == NULL) {
974dbfd7e52f Remove and replace a number of the purple utility functions
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
624 utf8ized = g_utf8_make_valid(err->description, -1);
974dbfd7e52f Remove and replace a number of the purple utility functions
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
625 }
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
626 purple_xmlnode_insert_data(child, utf8ized, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
627 g_free(utf8ized);
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
628 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
629
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
630 return node;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
631 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
632
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
633 static void
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
634 setting_to_xmlnode(gpointer key, gpointer value, gpointer user_data)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
635 {
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
636 const char *name;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
637 PurpleAccountSetting *setting;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
638 PurpleXmlNode *node, *child;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
639 char buf[21];
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
640
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
641 name = (const char *)key;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
642 setting = (PurpleAccountSetting *)value;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
643 node = (PurpleXmlNode *)user_data;
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
644
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
645 child = purple_xmlnode_new_child(node, "setting");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
646 purple_xmlnode_set_attrib(child, "name", name);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
647
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
648 if (G_VALUE_HOLDS_INT(&setting->value)) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
649 purple_xmlnode_set_attrib(child, "type", "int");
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
650 g_snprintf(buf, sizeof(buf), "%d", g_value_get_int(&setting->value));
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
651 purple_xmlnode_insert_data(child, buf, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
652 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
653 else if (G_VALUE_HOLDS_STRING(&setting->value) && g_value_get_string(&setting->value) != NULL) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
654 purple_xmlnode_set_attrib(child, "type", "string");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
655 purple_xmlnode_insert_data(child, g_value_get_string(&setting->value), -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
656 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
657 else if (G_VALUE_HOLDS_BOOLEAN(&setting->value)) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
658 purple_xmlnode_set_attrib(child, "type", "bool");
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
659 g_snprintf(buf, sizeof(buf), "%d", g_value_get_boolean(&setting->value));
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
660 purple_xmlnode_insert_data(child, buf, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
661 }
6368
ab9f99269dfe [gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents: 6367
diff changeset
662 }
ab9f99269dfe [gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents: 6367
diff changeset
663
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
664 PurpleXmlNode *
35178
7c775624f964 Move (_)purple_account_to_xmlnode to internal.h
Ankit Vani <a@nevitus.org>
parents: 35152
diff changeset
665 _purple_account_to_xmlnode(PurpleAccount *account)
6368
ab9f99269dfe [gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents: 6367
diff changeset
666 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
667 PurpleXmlNode *node, *child;
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
668 gchar *data = NULL;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
669 const char *tmp;
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
670 PurpleProxyInfo *proxy_info;
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
671 PurpleAccountPrivate *priv = purple_account_get_instance_private(account);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
672
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
673 node = purple_xmlnode_new("account");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
674
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
675 if(priv->id != NULL) {
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
676 child = purple_xmlnode_new_child(node, "id");
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
677 purple_xmlnode_insert_data(child, priv->id, -1);
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
678 }
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
679
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
680 child = purple_xmlnode_new_child(node, "protocol");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
681 purple_xmlnode_insert_data(child, purple_account_get_protocol_id(account), -1);
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
682
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
683 child = purple_xmlnode_new_child(node, "name");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
684 purple_xmlnode_insert_data(child, purple_account_get_username(account), -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
685
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
686 child = purple_xmlnode_new_child(node, "enabled");
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
687 data = g_strdup_printf("%d", priv->enabled);
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
688 purple_xmlnode_insert_data(child, data, -1);
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
689 g_clear_pointer(&data, g_free);
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
690
34589
428e92c79631 Renamed purple_account_[get,set]_alias to purple_account[get,set]_private_alias.
Ankit Vani <a@nevitus.org>
parents: 34582
diff changeset
691 if ((tmp = purple_account_get_private_alias(account)) != NULL)
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
692 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
693 child = purple_xmlnode_new_child(node, "alias");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
694 purple_xmlnode_insert_data(child, tmp, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
695 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
696
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
697 if ((tmp = purple_account_get_user_info(account)) != NULL)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
698 {
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
699 /* TODO: Do we need to call purple_str_strip_char(tmp, '\r') here? */
35010
9c2d352b1d96 Cleaned up properties and added g_object_notify calls for PurpleAccount and PurpleBlistNodes
Ankit Vani <a@nevitus.org>
parents: 34996
diff changeset
700 child = purple_xmlnode_new_child(node, "user-info");
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
701 purple_xmlnode_insert_data(child, tmp, -1);
18636
34c1a17a91d7 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18190
diff changeset
702 }
34c1a17a91d7 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18190
diff changeset
703
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
704 if (g_hash_table_size(priv->settings) > 0)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
705 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
706 child = purple_xmlnode_new_child(node, "settings");
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
707 g_hash_table_foreach(priv->settings, setting_to_xmlnode, child);
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
708 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
709
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
710 if ((proxy_info = purple_account_get_proxy_info(account)) != NULL)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
711 {
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
712 child = proxy_settings_to_xmlnode(proxy_info);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
713 purple_xmlnode_insert_child(node, child);
18636
34c1a17a91d7 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18190
diff changeset
714 }
34c1a17a91d7 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18190
diff changeset
715
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
716 child = current_error_to_xmlnode(priv->current_error);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
717 purple_xmlnode_insert_child(node, child);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
718
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
719 return node;
5710
3c2bf5725bb0 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5707
diff changeset
720 }
3c2bf5725bb0 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5707
diff changeset
721
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
722 /******************************************************************************
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
723 * Helpers
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
724 *****************************************************************************/
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
725 static void
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
726 purple_account_set_id(PurpleAccount *account, const gchar *id) {
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
727 PurpleAccountPrivate *priv = purple_account_get_instance_private(account);
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
728
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
729 g_free(priv->id);
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
730 priv->id = g_strdup(id);
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
731
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
732 g_object_notify_by_pspec(G_OBJECT(account), properties[PROP_ID]);
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
733 }
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
734
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
735 /******************************************************************************
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
736 * GObject Implementation
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
737 *****************************************************************************/
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
738 static void
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
739 purple_account_set_property(GObject *obj, guint param_id, const GValue *value,
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
740 GParamSpec *pspec)
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
741 {
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
742 PurpleAccount *account = PURPLE_ACCOUNT(obj);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
743
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
744 switch (param_id) {
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
745 case PROP_ID:
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
746 purple_account_set_id(account, g_value_get_string(value));
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
747 break;
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
748 case PROP_USERNAME:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
749 purple_account_set_username(account, g_value_get_string(value));
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
750 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
751 case PROP_PRIVATE_ALIAS:
34589
428e92c79631 Renamed purple_account_[get,set]_alias to purple_account[get,set]_private_alias.
Ankit Vani <a@nevitus.org>
parents: 34582
diff changeset
752 purple_account_set_private_alias(account, g_value_get_string(value));
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
753 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
754 case PROP_ENABLED:
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
755 purple_account_set_enabled(account, g_value_get_boolean(value));
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
756 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
757 case PROP_CONNECTION:
34753
b2c73469c1be GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents: 34751
diff changeset
758 purple_account_set_connection(account, g_value_get_object(value));
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
759 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
760 case PROP_PROTOCOL_ID:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
761 purple_account_set_protocol_id(account, g_value_get_string(value));
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
762 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
763 case PROP_USER_INFO:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
764 purple_account_set_user_info(account, g_value_get_string(value));
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
765 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
766 case PROP_BUDDY_ICON_PATH:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
767 purple_account_set_buddy_icon_path(account,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
768 g_value_get_string(value));
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
769 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
770 case PROP_REMEMBER_PASSWORD:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
771 purple_account_set_remember_password(account,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
772 g_value_get_boolean(value));
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
773 break;
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
774 case PROP_PROXY_INFO:
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
775 purple_account_set_proxy_info(account, g_value_get_object(value));
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
776 break;
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
777 default:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
778 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
779 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
780 }
5710
3c2bf5725bb0 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5707
diff changeset
781 }
3c2bf5725bb0 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5707
diff changeset
782
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
783 static void
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
784 purple_account_get_property(GObject *obj, guint param_id, GValue *value,
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
785 GParamSpec *pspec)
5580
a5a3e6dfb409 [gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents: 5574
diff changeset
786 {
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
787 PurpleAccount *account = PURPLE_ACCOUNT(obj);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
788
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
789 switch (param_id) {
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
790 case PROP_ID:
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
791 g_value_set_string(value, purple_account_get_id(account));
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
792 break;
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
793 case PROP_USERNAME:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
794 g_value_set_string(value, purple_account_get_username(account));
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
795 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
796 case PROP_PRIVATE_ALIAS:
34589
428e92c79631 Renamed purple_account_[get,set]_alias to purple_account[get,set]_private_alias.
Ankit Vani <a@nevitus.org>
parents: 34582
diff changeset
797 g_value_set_string(value, purple_account_get_private_alias(account));
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
798 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
799 case PROP_ENABLED:
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
800 g_value_set_boolean(value, purple_account_get_enabled(account));
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
801 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
802 case PROP_CONNECTION:
34753
b2c73469c1be GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents: 34751
diff changeset
803 g_value_set_object(value, purple_account_get_connection(account));
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
804 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
805 case PROP_PROTOCOL_ID:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
806 g_value_set_string(value, purple_account_get_protocol_id(account));
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
807 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
808 case PROP_USER_INFO:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
809 g_value_set_string(value, purple_account_get_user_info(account));
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
810 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
811 case PROP_BUDDY_ICON_PATH:
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
812 g_value_set_string(value,
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
813 purple_account_get_buddy_icon_path(account));
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
814 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
815 case PROP_REMEMBER_PASSWORD:
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
816 g_value_set_boolean(value,
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
817 purple_account_get_remember_password(account));
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
818 break;
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
819 case PROP_PROXY_INFO:
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
820 g_value_set_object(value, purple_account_get_proxy_info(account));
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
821 break;
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
822 default:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
823 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
824 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
825 }
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
826 }
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
827
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
828 static void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
829 purple_account_init(PurpleAccount *account)
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
830 {
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
831 PurpleAccountPrivate *priv = purple_account_get_instance_private(account);
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
832
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
833 priv->settings = g_hash_table_new_full(g_str_hash, g_str_equal,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
834 g_free, delete_setting);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
835
34590
9da48e98a77a Renamed PurpleAccount's private member perm_deny to privacy_type
Ankit Vani <a@nevitus.org>
parents: 34589
diff changeset
836 priv->privacy_type = PURPLE_ACCOUNT_PRIVACY_ALLOW_ALL;
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
837 }
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
838
34686
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
839 static void
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
840 purple_account_constructed(GObject *object)
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
841 {
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
842 PurpleAccount *account = PURPLE_ACCOUNT(object);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
843 PurpleAccountPrivate *priv = purple_account_get_instance_private(account);
34686
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
844 gchar *username, *protocol_id;
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36364
diff changeset
845 PurpleProtocol *protocol = NULL;
40804
5496016b3c00 Port libpurple from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents: 40803
diff changeset
846 PurpleProtocolManager *manager = NULL;
34686
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
847 PurpleStatusType *status_type;
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
848
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
849 G_OBJECT_CLASS(purple_account_parent_class)->constructed(object);
34686
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
850
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
851 /* If we didn't get an id, just generate a random one. */
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
852 if(priv->id == NULL) {
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
853 gchar *uuid = g_uuid_string_random();
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
854
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
855 purple_account_set_id(account, uuid);
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
856
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
857 g_free(uuid);
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
858 }
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
859
34686
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
860 g_object_get(object,
35010
9c2d352b1d96 Cleaned up properties and added g_object_notify calls for PurpleAccount and PurpleBlistNodes
Ankit Vani <a@nevitus.org>
parents: 34996
diff changeset
861 "username", &username,
9c2d352b1d96 Cleaned up properties and added g_object_notify calls for PurpleAccount and PurpleBlistNodes
Ankit Vani <a@nevitus.org>
parents: 34996
diff changeset
862 "protocol-id", &protocol_id,
34686
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
863 NULL);
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
864
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
865 purple_signal_emit(purple_accounts_get_handle(), "account-created",
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
866 account);
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
867
40804
5496016b3c00 Port libpurple from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents: 40803
diff changeset
868 manager = purple_protocol_manager_get_default();
5496016b3c00 Port libpurple from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents: 40803
diff changeset
869 protocol = purple_protocol_manager_find(manager, protocol_id);
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36364
diff changeset
870 if (protocol == NULL) {
34769
427725f8ed54 Free strings received from g_object_get
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
871 g_free(username);
427725f8ed54 Free strings received from g_object_get
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
872 g_free(protocol_id);
5580
a5a3e6dfb409 [gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents: 5574
diff changeset
873 return;
a5a3e6dfb409 [gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents: 5574
diff changeset
874 }
a5a3e6dfb409 [gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents: 5574
diff changeset
875
36720
465f02116328 Refactored account, blistnodetypes, buddylist, connection to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
876 purple_account_set_status_types(account,
40813
71305a7d7423 Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents: 40804
diff changeset
877 purple_protocol_get_status_types(protocol, account));
34686
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
878
34844
e341dbc04539 Refactored plugins, account, blistnodetypes to use the GObject presence API
Ankit Vani <a@nevitus.org>
parents: 34838
diff changeset
879 priv->presence = PURPLE_PRESENCE(purple_account_presence_new(account));
34686
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
880
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
881 status_type = purple_account_get_status_type_with_primitive(account,
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
882 PURPLE_STATUS_AVAILABLE);
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
883 if (status_type != NULL)
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
884 purple_presence_set_status_active(priv->presence,
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
885 purple_status_type_get_id(status_type),
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
886 TRUE);
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
887 else
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
888 purple_presence_set_status_active(priv->presence,
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
889 "offline",
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
890 TRUE);
34769
427725f8ed54 Free strings received from g_object_get
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
891
427725f8ed54 Free strings received from g_object_get
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
892 g_free(username);
427725f8ed54 Free strings received from g_object_get
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
893 g_free(protocol_id);
5580
a5a3e6dfb409 [gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents: 5574
diff changeset
894 }
5573
633880e3f137 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5565
diff changeset
895
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
896 static void
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
897 purple_account_dispose(GObject *object)
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
898 {
35512
8d6f1349b57a Fix crash on wrong password (backout 0f0d6ae2fb77)
Ankit Vani <a@nevitus.org>
parents: 35499
diff changeset
899 PurpleAccount *account = PURPLE_ACCOUNT(object);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
900 PurpleAccountPrivate *priv = purple_account_get_instance_private(account);
35512
8d6f1349b57a Fix crash on wrong password (backout 0f0d6ae2fb77)
Ankit Vani <a@nevitus.org>
parents: 35499
diff changeset
901
8d6f1349b57a Fix crash on wrong password (backout 0f0d6ae2fb77)
Ankit Vani <a@nevitus.org>
parents: 35499
diff changeset
902 if (!purple_account_is_disconnected(account))
8d6f1349b57a Fix crash on wrong password (backout 0f0d6ae2fb77)
Ankit Vani <a@nevitus.org>
parents: 35499
diff changeset
903 purple_account_disconnect(account);
34986
894c29e33300 Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
904
894c29e33300 Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
905 if (priv->presence) {
894c29e33300 Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
906 g_object_unref(priv->presence);
894c29e33300 Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
907 priv->presence = NULL;
894c29e33300 Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
908 }
894c29e33300 Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
909
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
910 G_OBJECT_CLASS(purple_account_parent_class)->dispose(object);
34986
894c29e33300 Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
911 }
894c29e33300 Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
912
894c29e33300 Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
913 static void
894c29e33300 Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
914 purple_account_finalize(GObject *object)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
915 {
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
916 GList *l;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
917 PurpleAccount *account = PURPLE_ACCOUNT(object);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
918 PurpleAccountPrivate *priv = purple_account_get_instance_private(account);
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
919 PurpleConversationManager *manager = NULL;
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
920
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
921 purple_debug_info("account", "Destroying account %p\n", account);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
922 purple_signal_emit(purple_accounts_get_handle(), "account-destroying",
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
923 account);
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
924
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
925 manager = purple_conversation_manager_get_default();
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
926 l = purple_conversation_manager_get_all(manager);
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
927 while(l != NULL) {
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
928 PurpleConversation *conv = PURPLE_CONVERSATION(l->data);
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
929
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
930 if (purple_conversation_get_account(conv) == account) {
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
931 purple_conversation_set_account(conv, NULL);
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
932 }
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
933
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
934 l = g_list_delete_link(l, l);
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
935 }
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
936
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
937 purple_account_set_status_types(account, NULL);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
938
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
939 g_clear_object(&priv->proxy_info);
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
940
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
941 if (priv->current_error) {
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
942 g_free(priv->current_error->description);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
943 g_free(priv->current_error);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
944 }
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
945
41432
aaff9cefb423 fix memory leak when using purple accounts
ivanhoe <ivanhoe@fiscari.de>
parents: 41429
diff changeset
946 g_free(priv->id);
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
947 g_free(priv->username);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
948 g_free(priv->alias);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
949 g_free(priv->user_info);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
950 g_free(priv->buddy_icon_path);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
951 g_free(priv->protocol_id);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
952
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
953 g_hash_table_destroy(priv->settings);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
954
40052
cc03b5af25ea Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39897
diff changeset
955 g_slist_free_full(priv->deny, g_free);
cc03b5af25ea Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39897
diff changeset
956 g_slist_free_full(priv->permit, g_free);
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
957
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
958 G_OBJECT_CLASS(purple_account_parent_class)->finalize(object);
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
959 }
5874
5e19273d3c6f [gaim-migrate @ 6306]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
960
34685
1690f822fbdd Use purple_account_constructed as a GObject constructed method to initialize account by parameters
Ankit Vani <a@nevitus.org>
parents: 34682
diff changeset
961 static void
1690f822fbdd Use purple_account_constructed as a GObject constructed method to initialize account by parameters
Ankit Vani <a@nevitus.org>
parents: 34682
diff changeset
962 purple_account_class_init(PurpleAccountClass *klass)
11053
6d2abb51e586 [gaim-migrate @ 12991]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11042
diff changeset
963 {
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
964 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
965
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
966 obj_class->dispose = purple_account_dispose;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
967 obj_class->finalize = purple_account_finalize;
34685
1690f822fbdd Use purple_account_constructed as a GObject constructed method to initialize account by parameters
Ankit Vani <a@nevitus.org>
parents: 34682
diff changeset
968 obj_class->constructed = purple_account_constructed;
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
969
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
970 /* Setup properties */
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
971 obj_class->get_property = purple_account_get_property;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
972 obj_class->set_property = purple_account_set_property;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
973
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
974 /**
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
975 * PurpleAccount::id
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
976 *
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
977 * An identifier for the account.
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
978 *
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
979 * Since: 3.0.0
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
980 */
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
981 properties[PROP_ID] = g_param_spec_string(
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
982 "id", "id",
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
983 "The identifier of the account",
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
984 NULL,
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
985 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
986
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
987 properties[PROP_USERNAME] = g_param_spec_string("username", "Username",
35058
506740af931c Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents: 35010
diff changeset
988 "The username for the account.", NULL,
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
989 G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
990
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
991 properties[PROP_PRIVATE_ALIAS] = g_param_spec_string("private-alias",
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
992 "Private Alias",
35058
506740af931c Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents: 35010
diff changeset
993 "The private alias for the account.", NULL,
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
994 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
995
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
996 properties[PROP_USER_INFO] = g_param_spec_string("user-info",
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
997 "User information",
35058
506740af931c Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents: 35010
diff changeset
998 "Detailed user information for the account.", NULL,
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
999 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1000
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1001 properties[PROP_BUDDY_ICON_PATH] = g_param_spec_string("buddy-icon-path",
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1002 "Buddy icon path",
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1003 "Path to the buddyicon for the account.", NULL,
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1004 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1005
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1006 properties[PROP_ENABLED] = g_param_spec_boolean("enabled", "Enabled",
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1007 "Whether the account is enabled or not.", FALSE,
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1008 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1009
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1010 properties[PROP_REMEMBER_PASSWORD] = g_param_spec_boolean(
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1011 "remember-password", "Remember password",
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1012 "Whether to remember and store the password for this account.",
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1013 FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1014
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1015 properties[PROP_CONNECTION] = g_param_spec_object("connection",
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1016 "Connection",
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1017 "The connection for the account.", PURPLE_TYPE_CONNECTION,
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1018 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1019
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1020 properties[PROP_PROTOCOL_ID] = g_param_spec_string("protocol-id",
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1021 "Protocol ID",
35058
506740af931c Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents: 35010
diff changeset
1022 "ID of the protocol that is responsible for the account.", NULL,
35066
f997e5384f79 libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents: 35058
diff changeset
1023 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1024 G_PARAM_STATIC_STRINGS);
35085
abab0adfa0ec libpurple: use g_object_class_install_properties instead of repeated g_object_class_install_property
Ankit Vani <a@nevitus.org>
parents: 35080
diff changeset
1025
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1026 properties[PROP_PROXY_INFO] = g_param_spec_object(
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1027 "proxy-info", "proxy-info",
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1028 "The PurpleProxyInfo for this account.",
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1029 PURPLE_TYPE_PROXY_INFO,
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1030 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1031
35085
abab0adfa0ec libpurple: use g_object_class_install_properties instead of repeated g_object_class_install_property
Ankit Vani <a@nevitus.org>
parents: 35080
diff changeset
1032 g_object_class_install_properties(obj_class, PROP_LAST, properties);
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1033 }
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1034
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1035 /******************************************************************************
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1036 * Public API
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1037 *****************************************************************************/
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1038 PurpleAccount *
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1039 purple_account_new(const gchar *username, const gchar *protocol_id) {
34685
1690f822fbdd Use purple_account_constructed as a GObject constructed method to initialize account by parameters
Ankit Vani <a@nevitus.org>
parents: 34682
diff changeset
1040 PurpleAccount *account;
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1041 PurpleAccountManager *manager = NULL;
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1042
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1043 g_return_val_if_fail(username != NULL, NULL);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1044 g_return_val_if_fail(protocol_id != NULL, NULL);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1045
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1046 manager = purple_account_manager_get_default();
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1047 account = purple_account_manager_find(manager, username, protocol_id);
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1048 if(account != NULL) {
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1049 return account;
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1050 }
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1051
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1052 account = g_object_new(
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1053 PURPLE_TYPE_ACCOUNT,
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1054 "username", username,
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1055 "protocol-id", protocol_id,
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1056 "enabled", FALSE,
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1057 NULL);
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1058
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1059 return account;
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6368
diff changeset
1060 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1061
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1062 const gchar *
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1063 purple_account_get_id(PurpleAccount *account) {
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1064 PurpleAccountPrivate *priv = NULL;
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1065
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1066 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1067
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1068 priv = purple_account_get_instance_private(account);
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1069
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1070 return priv->id;
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1071 }
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1072
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1073 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1074 purple_account_connect(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1075 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1076 PurpleCredentialManager *manager = NULL;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1077 PurpleProtocol *protocol = NULL;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1078 const char *username = NULL;
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1079
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1080 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1081
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1082 username = purple_account_get_username(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1083
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1084 if (!purple_account_get_enabled(account)) {
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1085 purple_debug_info("account",
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1086 "Account %s not enabled, not connecting.\n",
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1087 username);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1088 return;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1089 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1090
40804
5496016b3c00 Port libpurple from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents: 40803
diff changeset
1091 protocol = purple_account_get_protocol(account);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1092 if (protocol == NULL) {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1093 gchar *message;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1094
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1095 message = g_strdup_printf(_("Missing protocol for %s"), username);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1096 purple_notify_error(account, _("Connection Error"), message,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1097 NULL, purple_request_cpar_from_account(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1098 g_free(message);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1099 return;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1100 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1101
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1102 purple_debug_info("account", "Connecting to account %s.\n", username);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1103
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1104 manager = purple_credential_manager_get_default();
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1105 purple_credential_manager_read_password_async(manager, account, NULL,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1106 purple_account_connect_got_password_cb,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1107 account);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1108 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1109
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1110 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1111 purple_account_set_register_callback(PurpleAccount *account, PurpleAccountRegistrationCb cb, void *user_data)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1112 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1113 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1114
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1115 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1116
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1117 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1118
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1119 priv->registration_cb = cb;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1120 priv->registration_cb_user_data = user_data;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1121 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1122
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1123 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1124 purple_account_register_completed(PurpleAccount *account, gboolean succeeded)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1125 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1126 struct register_completed_closure *closure;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1127
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1128 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1129
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1130 closure = g_new0(struct register_completed_closure, 1);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1131 closure->account = g_object_ref(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1132 closure->succeeded = succeeded;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1133
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1134 g_timeout_add(0, purple_account_register_completed_cb, closure);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1135 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1136
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1137 void
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1138 purple_account_unregister(PurpleAccount *account,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1139 PurpleAccountUnregistrationCb cb, gpointer user_data)
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1140 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1141 PurpleCallbackBundle *cbb;
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1142 PurpleCredentialManager *manager = NULL;
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1143
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1144 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1145
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1146 purple_debug_info("account", "Unregistering account %s\n",
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1147 purple_account_get_username(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1148
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1149 cbb = g_new0(PurpleCallbackBundle, 1);
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1150 cbb->account = account;
41314
0dc72eacd8bf Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41312
diff changeset
1151 cbb->cb = G_CALLBACK(cb);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1152 cbb->data = user_data;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1153
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1154 manager = purple_credential_manager_get_default();
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1155 purple_credential_manager_read_password_async(manager, account, NULL,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1156 purple_account_unregister_got_password_cb,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1157 cbb);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1158 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1159
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1160 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1161 purple_account_disconnect(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1162 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1163 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1164 const char *username;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1165
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1166 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1167 g_return_if_fail(!purple_account_is_disconnecting(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1168 g_return_if_fail(!purple_account_is_disconnected(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1169
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1170 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1171
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1172 username = purple_account_get_username(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1173 purple_debug_info("account", "Disconnecting account %s (%p)\n",
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1174 username ? username : "(null)", account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1175
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1176 priv->disconnecting = TRUE;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1177
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1178 purple_account_set_connection(account, NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1179
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1180 priv->disconnecting = FALSE;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1181 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1182
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1183 gboolean
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1184 purple_account_is_disconnecting(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1185 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1186 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1187
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1188 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), TRUE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1189
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1190 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1191 return priv->disconnecting;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1192 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1193
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1194 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1195 purple_account_notify_added(PurpleAccount *account, const char *remote_user,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1196 const char *id, const char *alias,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1197 const char *message)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1198 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1199 PurpleAccountUiOps *ui_ops;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1200
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1201 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1202 g_return_if_fail(remote_user != NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1203
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1204 ui_ops = purple_accounts_get_ui_ops();
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1205
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1206 if (ui_ops != NULL && ui_ops->notify_added != NULL)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1207 ui_ops->notify_added(account, remote_user, id, alias, message);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1208 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1209
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1210 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1211 purple_account_request_add(PurpleAccount *account, const char *remote_user,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1212 const char *id, const char *alias,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1213 const char *message)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1214 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1215 PurpleAccountUiOps *ui_ops;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1216
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1217 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1218 g_return_if_fail(remote_user != NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1219
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1220 ui_ops = purple_accounts_get_ui_ops();
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1221
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1222 if (ui_ops != NULL && ui_ops->request_add != NULL)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1223 ui_ops->request_add(account, remote_user, id, alias, message);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1224 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1225
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1226 void *
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1227 purple_account_request_authorization(PurpleAccount *account, const char *remote_user,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1228 const char *id, const char *alias, const char *message, gboolean on_list,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1229 PurpleAccountRequestAuthorizationCb auth_cb, PurpleAccountRequestAuthorizationCb deny_cb, void *user_data)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1230 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1231 PurpleAccountUiOps *ui_ops;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1232 PurpleAccountRequestInfo *info;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1233 int plugin_return;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1234 char *response = NULL;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1235
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1236 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1237 g_return_val_if_fail(remote_user != NULL, NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1238
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1239 ui_ops = purple_accounts_get_ui_ops();
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1240
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1241 plugin_return = GPOINTER_TO_INT(
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1242 purple_signal_emit_return_1(
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1243 purple_accounts_get_handle(),
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1244 "account-authorization-requested",
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1245 account, remote_user, message, &response
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1246 ));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1247
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1248 switch (plugin_return)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1249 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1250 case PURPLE_ACCOUNT_RESPONSE_IGNORE:
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1251 g_free(response);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1252 return NULL;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1253 case PURPLE_ACCOUNT_RESPONSE_ACCEPT:
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1254 if (auth_cb != NULL)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1255 auth_cb(response, user_data);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1256 g_free(response);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1257 return NULL;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1258 case PURPLE_ACCOUNT_RESPONSE_DENY:
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1259 if (deny_cb != NULL)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1260 deny_cb(response, user_data);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1261 g_free(response);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1262 return NULL;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1263 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1264
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1265 g_free(response);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1266
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1267 if (ui_ops != NULL && ui_ops->request_authorize != NULL) {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1268 info = g_new0(PurpleAccountRequestInfo, 1);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1269 info->type = PURPLE_ACCOUNT_REQUEST_AUTHORIZATION;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1270 info->account = account;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1271 info->auth_cb = auth_cb;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1272 info->deny_cb = deny_cb;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1273 info->userdata = user_data;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1274 info->user = g_strdup(remote_user);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1275 info->ref = 2; /* We hold an extra ref to make sure info remains valid
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1276 if any of the callbacks are called synchronously. We
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1277 unref it after the function call */
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1278
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1279 info->ui_handle = ui_ops->request_authorize(account, remote_user, id, alias, message,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1280 on_list, request_auth_cb, request_deny_cb, info);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1281
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1282 info = purple_account_request_info_unref(info);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1283 if (info) {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1284 handles = g_list_append(handles, info);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1285 return info->ui_handle;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1286 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1287 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1288
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1289 return NULL;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1290 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1291
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1292 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1293 purple_account_request_close_with_account(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1294 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1295 GList *l, *l_next;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1296
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1297 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1298
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1299 for (l = handles; l != NULL; l = l_next) {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1300 PurpleAccountRequestInfo *info = l->data;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1301
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1302 l_next = l->next;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1303
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1304 if (info->account == account) {
40079
a37a1e349491 Replace g_[s]list_remove with g_[s]list_delete_link.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40052
diff changeset
1305 handles = g_list_delete_link(handles, l);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1306 purple_account_request_close_info(info);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1307 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1308 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1309 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1310
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1311 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1312 purple_account_request_close(void *ui_handle)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1313 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1314 GList *l, *l_next;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1315
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1316 g_return_if_fail(ui_handle != NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1317
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1318 for (l = handles; l != NULL; l = l_next) {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1319 PurpleAccountRequestInfo *info = l->data;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1320
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1321 l_next = l->next;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1322
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1323 if (info->ui_handle == ui_handle) {
40079
a37a1e349491 Replace g_[s]list_remove with g_[s]list_delete_link.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40052
diff changeset
1324 handles = g_list_delete_link(handles, l);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1325 purple_account_request_close_info(info);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1326 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1327 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1328 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1329
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1330 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1331 purple_account_request_password(PurpleAccount *account, GCallback ok_cb,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1332 GCallback cancel_cb, void *user_data)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1333 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1334 gchar *primary;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1335 const gchar *username;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1336 PurpleRequestFieldGroup *group;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1337 PurpleRequestField *field;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1338 PurpleRequestFields *fields;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1339
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1340 /* Close any previous password request windows */
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1341 purple_request_close_with_handle(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1342
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1343 username = purple_account_get_username(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1344 primary = g_strdup_printf(_("Enter password for %s (%s)"), username,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1345 purple_account_get_protocol_name(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1346
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1347 fields = purple_request_fields_new();
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1348 group = purple_request_field_group_new(NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1349 purple_request_fields_add_group(fields, group);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1350
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1351 field = purple_request_field_string_new("password", _("Enter Password"), NULL, FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1352 purple_request_field_string_set_masked(field, TRUE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1353 purple_request_field_set_required(field, TRUE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1354 purple_request_field_group_add_field(group, field);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1355
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1356 field = purple_request_field_bool_new("remember", _("Save password"), FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1357 purple_request_field_group_add_field(group, field);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1358
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1359 purple_request_fields(account, NULL, primary, NULL, fields, _("OK"),
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1360 ok_cb, _("Cancel"), cancel_cb,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1361 purple_request_cpar_from_account(account), user_data);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1362 g_free(primary);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1363 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1364
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1365 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1366 purple_account_request_change_password(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1367 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1368 PurpleRequestFields *fields;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1369 PurpleRequestFieldGroup *group;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1370 PurpleRequestField *field;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1371 PurpleConnection *gc;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1372 PurpleProtocol *protocol = NULL;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1373 char primary[256];
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1374
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1375 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1376 g_return_if_fail(purple_account_is_connected(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1377
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1378 gc = purple_account_get_connection(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1379 if (gc != NULL)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1380 protocol = purple_connection_get_protocol(gc);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1381
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1382 fields = purple_request_fields_new();
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1383
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1384 group = purple_request_field_group_new(NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1385 purple_request_fields_add_group(fields, group);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1386
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1387 field = purple_request_field_string_new("password", _("Original password"),
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1388 NULL, FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1389 purple_request_field_string_set_masked(field, TRUE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1390 if (!protocol || !(purple_protocol_get_options(protocol) & OPT_PROTO_PASSWORD_OPTIONAL))
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1391 purple_request_field_set_required(field, TRUE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1392 purple_request_field_group_add_field(group, field);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1393
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1394 field = purple_request_field_string_new("new_password_1",
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1395 _("New password"),
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1396 NULL, FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1397 purple_request_field_string_set_masked(field, TRUE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1398 if (!protocol || !(purple_protocol_get_options(protocol) & OPT_PROTO_PASSWORD_OPTIONAL))
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1399 purple_request_field_set_required(field, TRUE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1400 purple_request_field_group_add_field(group, field);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1401
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1402 field = purple_request_field_string_new("new_password_2",
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1403 _("New password (again)"),
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1404 NULL, FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1405 purple_request_field_string_set_masked(field, TRUE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1406 if (!protocol || !(purple_protocol_get_options(protocol) & OPT_PROTO_PASSWORD_OPTIONAL))
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1407 purple_request_field_set_required(field, TRUE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1408 purple_request_field_group_add_field(group, field);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1409
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1410 g_snprintf(primary, sizeof(primary), _("Change password for %s"),
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1411 purple_account_get_username(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1412
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1413 /* I'm sticking this somewhere in the code: bologna */
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1414
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1415 purple_request_fields(purple_account_get_connection(account), NULL,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1416 primary, _("Please enter your current password and your new "
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1417 "password."), fields, _("OK"), G_CALLBACK(change_password_cb),
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1418 _("Cancel"), NULL, purple_request_cpar_from_account(account),
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1419 account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1420 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1421
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1422 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1423 purple_account_request_change_user_info(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1424 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1425 PurpleConnection *gc;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1426 char primary[256];
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1427
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1428 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1429 g_return_if_fail(purple_account_is_connected(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1430
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1431 gc = purple_account_get_connection(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1432
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1433 g_snprintf(primary, sizeof(primary),
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1434 _("Change user information for %s"),
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1435 purple_account_get_username(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1436
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1437 purple_request_input(gc, _("Set User Info"), primary, NULL,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1438 purple_account_get_user_info(account),
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1439 TRUE, FALSE, ((gc != NULL) &&
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1440 (purple_connection_get_flags(gc) & PURPLE_CONNECTION_FLAG_HTML) ? "html" : NULL),
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1441 _("Save"), G_CALLBACK(set_user_info_cb),
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1442 _("Cancel"), NULL,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1443 purple_request_cpar_from_account(account),
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1444 account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1445 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1446
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1447 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1448 purple_account_set_username(PurpleAccount *account, const char *username)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1449 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1450 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1451
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1452 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1453
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1454 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1455
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1456 g_free(priv->username);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1457 priv->username = g_strdup(username);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1458
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1459 g_object_notify_by_pspec(G_OBJECT(account), properties[PROP_USERNAME]);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1460
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1461 purple_accounts_schedule_save();
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1462
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1463 /* if the name changes, we should re-write the buddy list
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1464 * to disk with the new name */
39676
1e8394d47205 Add list parameter to all buddy list UI ops.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
1465 purple_blist_save_account(purple_blist_get_default(), account);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1466 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1467
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1468 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1469 purple_account_set_private_alias(PurpleAccount *account, const char *alias)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1470 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1471 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1472
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1473 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1474
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1475 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1476
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1477 /*
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1478 * Do nothing if alias and priv->alias are both NULL. Or if
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1479 * they're the exact same string.
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1480 */
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1481 if (alias == priv->alias)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1482 return;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1483
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1484 if ((!alias && priv->alias) || (alias && !priv->alias) ||
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1485 g_utf8_collate(priv->alias, alias))
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1486 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1487 char *old = priv->alias;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1488
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1489 priv->alias = g_strdup(alias);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1490 g_object_notify_by_pspec(G_OBJECT(account),
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1491 properties[PROP_PRIVATE_ALIAS]);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1492 purple_signal_emit(purple_accounts_get_handle(), "account-alias-changed",
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1493 account, old);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1494 g_free(old);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1495
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1496 purple_accounts_schedule_save();
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1497 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1498 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1499
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1500 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1501 purple_account_set_user_info(PurpleAccount *account, const char *user_info)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1502 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1503 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1504
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1505 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1506
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1507 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1508
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1509 g_free(priv->user_info);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1510 priv->user_info = g_strdup(user_info);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1511
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1512 g_object_notify_by_pspec(G_OBJECT(account), properties[PROP_USER_INFO]);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1513
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1514 purple_accounts_schedule_save();
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1515 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1516
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1517 void purple_account_set_buddy_icon_path(PurpleAccount *account, const char *path)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1518 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1519 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1520
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1521 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1522
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1523 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1524
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1525 g_free(priv->buddy_icon_path);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1526 priv->buddy_icon_path = g_strdup(path);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1527
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1528 g_object_notify_by_pspec(G_OBJECT(account),
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1529 properties[PROP_BUDDY_ICON_PATH]);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1530
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1531 purple_accounts_schedule_save();
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1532 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1533
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1534 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1535 purple_account_set_protocol_id(PurpleAccount *account, const char *protocol_id)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1536 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1537 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1538
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1539 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1540 g_return_if_fail(protocol_id != NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1541
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1542 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1543
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1544 g_free(priv->protocol_id);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1545 priv->protocol_id = g_strdup(protocol_id);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1546
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1547 g_object_notify_by_pspec(G_OBJECT(account), properties[PROP_PROTOCOL_ID]);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1548
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1549 purple_accounts_schedule_save();
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1550 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1551
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1552 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1553 purple_account_set_connection(PurpleAccount *account, PurpleConnection *gc)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1554 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1555 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1556
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1557 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1558
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1559 priv = purple_account_get_instance_private(account);
41429
1f1a3fbb2759 Make PurpleAccount take ownership of the connection that was set.
Gary Kramlich <grim@reaperworld.com>
parents: 41393
diff changeset
1560
1f1a3fbb2759 Make PurpleAccount take ownership of the connection that was set.
Gary Kramlich <grim@reaperworld.com>
parents: 41393
diff changeset
1561 g_clear_object(&priv->gc);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1562 priv->gc = gc;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1563
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1564 g_object_notify_by_pspec(G_OBJECT(account), properties[PROP_CONNECTION]);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1565 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1566
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1567 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1568 purple_account_set_remember_password(PurpleAccount *account, gboolean value)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1569 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1570 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1571
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1572 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1573
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1574 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1575 priv->remember_pass = value;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1576
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1577 g_object_notify_by_pspec(G_OBJECT(account),
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1578 properties[PROP_REMEMBER_PASSWORD]);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1579
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1580 purple_accounts_schedule_save();
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1581 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1582
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1583 void
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1584 purple_account_set_enabled(PurpleAccount *account, gboolean value) {
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1585 PurpleConnection *gc;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1586 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1587 gboolean was_enabled = FALSE;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1588
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1589 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1590
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1591 priv = purple_account_get_instance_private(account);
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1592
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1593 was_enabled = priv->enabled;
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1594 priv->enabled = value;
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1595
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1596 gc = purple_account_get_connection(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1597 if(was_enabled && !value)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1598 purple_signal_emit(purple_accounts_get_handle(), "account-disabled", account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1599 else if(!was_enabled && value)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1600 purple_signal_emit(purple_accounts_get_handle(), "account-enabled", account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1601
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1602 g_object_notify_by_pspec(G_OBJECT(account), properties[PROP_ENABLED]);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1603
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1604 if ((gc != NULL) && (_purple_connection_wants_to_die(gc)))
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1605 return;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1606
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1607 if (value && purple_presence_is_online(priv->presence))
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1608 purple_account_connect(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1609 else if (!value && !purple_account_is_disconnected(account))
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1610 purple_account_disconnect(account);
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1611
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1612 purple_accounts_schedule_save();
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1613 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1614
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1615 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1616 purple_account_set_proxy_info(PurpleAccount *account, PurpleProxyInfo *info)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1617 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1618 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1619
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1620 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1621
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1622 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1623
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1624 if(g_set_object(&priv->proxy_info, info)) {
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1625 g_object_notify_by_pspec(G_OBJECT(account),
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1626 properties[PROP_PROXY_INFO]);
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1627
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1628 purple_accounts_schedule_save();
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1629 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1630 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1631
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1632 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1633 purple_account_set_privacy_type(PurpleAccount *account, PurpleAccountPrivacyType privacy_type)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1634 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1635 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1636
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1637 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1638
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1639 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1640 priv->privacy_type = privacy_type;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1641 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1642
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1643 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1644 purple_account_set_status_types(PurpleAccount *account, GList *status_types)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1645 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1646 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1647
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1648 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1649
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1650 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1651
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1652 /* Out with the old... */
39897
16b440d4ab36 Use g_list_free_full instead of g_list_foreach+g_list_free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39782
diff changeset
1653 g_list_free_full(priv->status_types,
16b440d4ab36 Use g_list_free_full instead of g_list_foreach+g_list_free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39782
diff changeset
1654 (GDestroyNotify)purple_status_type_destroy);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1655
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1656 /* In with the new... */
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1657 priv->status_types = status_types;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1658 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1659
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1660 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1661 purple_account_set_status(PurpleAccount *account, const char *status_id,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1662 gboolean active, ...)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1663 {
40328
45e719e8d3bc Replace lists of PurpleAttr with GHashTable
qarkai <qarkai@gmail.com>
parents: 40327
diff changeset
1664 GHashTable *attrs;
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1665 va_list args;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1666
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1667 va_start(args, active);
40328
45e719e8d3bc Replace lists of PurpleAttr with GHashTable
qarkai <qarkai@gmail.com>
parents: 40327
diff changeset
1668 attrs = purple_attrs_from_vargs(args);
40332
cd2da3a58f6d Rename purple_account_set_status_list and purple_status_set_active_with_attrs_list
qarkai <qarkai@gmail.com>
parents: 40328
diff changeset
1669 purple_account_set_status_attrs(account, status_id, active, attrs);
40328
45e719e8d3bc Replace lists of PurpleAttr with GHashTable
qarkai <qarkai@gmail.com>
parents: 40327
diff changeset
1670 g_hash_table_destroy(attrs);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1671 va_end(args);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1672 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1673
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1674 void
40332
cd2da3a58f6d Rename purple_account_set_status_list and purple_status_set_active_with_attrs_list
qarkai <qarkai@gmail.com>
parents: 40328
diff changeset
1675 purple_account_set_status_attrs(PurpleAccount *account, const char *status_id,
40328
45e719e8d3bc Replace lists of PurpleAttr with GHashTable
qarkai <qarkai@gmail.com>
parents: 40327
diff changeset
1676 gboolean active, GHashTable *attrs)
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1677 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1678 PurpleStatus *status;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1679
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1680 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1681 g_return_if_fail(status_id != NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1682
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1683 status = purple_account_get_status(account, status_id);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1684 if (status == NULL)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1685 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1686 purple_debug_error("account",
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1687 "Invalid status ID '%s' for account %s (%s)\n",
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1688 status_id, purple_account_get_username(account),
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1689 purple_account_get_protocol_id(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1690 return;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1691 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1692
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1693 if (active || purple_status_is_independent(status))
40332
cd2da3a58f6d Rename purple_account_set_status_list and purple_status_set_active_with_attrs_list
qarkai <qarkai@gmail.com>
parents: 40328
diff changeset
1694 purple_status_set_active_with_attrs_dict(status, active, attrs);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1695
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1696 /*
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1697 * Our current statuses are saved to accounts.xml (so that when we
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1698 * reconnect, we go back to the previous status).
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1699 */
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1700 purple_accounts_schedule_save();
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1701 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1702
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1703 gboolean
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1704 purple_account_get_silence_suppression(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1705 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1706 return purple_account_get_bool(account, "silence-suppression", FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1707 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1708
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1709 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1710 purple_account_set_silence_suppression(PurpleAccount *account, gboolean value)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1711 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1712 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1713
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1714 purple_account_set_bool(account, "silence-suppression", value);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1715 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1716
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1717 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1718 purple_account_clear_settings(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1719 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1720 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1721
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1722 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1723
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1724 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1725 g_hash_table_destroy(priv->settings);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1726
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1727 priv->settings = g_hash_table_new_full(g_str_hash, g_str_equal,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1728 g_free, delete_setting);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1729 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1730
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1731 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1732 purple_account_remove_setting(PurpleAccount *account, const char *setting)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1733 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1734 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1735
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1736 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1737 g_return_if_fail(setting != NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1738
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1739 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1740
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1741 g_hash_table_remove(priv->settings, setting);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1742 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1743
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1744 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1745 purple_account_set_int(PurpleAccount *account, const char *name, int value)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1746 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1747 PurpleAccountSetting *setting;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1748 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1749
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1750 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1751 g_return_if_fail(name != NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1752
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1753 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1754
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1755 setting = g_new0(PurpleAccountSetting, 1);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1756
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1757 g_value_init(&setting->value, G_TYPE_INT);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1758 g_value_set_int(&setting->value, value);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1759
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1760 g_hash_table_insert(priv->settings, g_strdup(name), setting);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1761
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1762 purple_accounts_schedule_save();
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1763 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1764
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1765 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1766 purple_account_set_string(PurpleAccount *account, const char *name,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1767 const char *value)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1768 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1769 PurpleAccountSetting *setting;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1770 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1771
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1772 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1773 g_return_if_fail(name != NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1774
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1775 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1776
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1777 setting = g_new0(PurpleAccountSetting, 1);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1778
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1779 g_value_init(&setting->value, G_TYPE_STRING);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1780 g_value_set_string(&setting->value, value);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1781
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1782 g_hash_table_insert(priv->settings, g_strdup(name), setting);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1783
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1784 purple_accounts_schedule_save();
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1785 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1786
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1787 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1788 purple_account_set_bool(PurpleAccount *account, const char *name, gboolean value)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1789 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1790 PurpleAccountSetting *setting;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1791 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1792
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1793 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1794 g_return_if_fail(name != NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1795
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1796 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1797
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1798 setting = g_new0(PurpleAccountSetting, 1);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1799
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1800 g_value_init(&setting->value, G_TYPE_BOOLEAN);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1801 g_value_set_boolean(&setting->value, value);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1802
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1803 g_hash_table_insert(priv->settings, g_strdup(name), setting);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1804
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1805 purple_accounts_schedule_save();
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1806 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1807
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1808 gboolean
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1809 purple_account_is_connected(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1810 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1811 return (purple_account_get_state(account) == PURPLE_CONNECTION_CONNECTED);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1812 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1813
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1814 gboolean
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1815 purple_account_is_connecting(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1816 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1817 return (purple_account_get_state(account) == PURPLE_CONNECTION_CONNECTING);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1818 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1819
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1820 gboolean
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1821 purple_account_is_disconnected(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1822 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1823 return (purple_account_get_state(account) == PURPLE_CONNECTION_DISCONNECTED);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1824 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1825
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1826 const char *
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1827 purple_account_get_username(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1828 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1829 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1830
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1831 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1832
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1833 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1834 return priv->username;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1835 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1836
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1837 const char *
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1838 purple_account_get_private_alias(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1839 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1840 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1841
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1842 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1843
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1844 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1845 return priv->alias;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1846 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1847
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1848 const char *
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1849 purple_account_get_user_info(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1850 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1851 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1852
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1853 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1854
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1855 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1856 return priv->user_info;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1857 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1858
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1859 const char *
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1860 purple_account_get_buddy_icon_path(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1861 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1862 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1863
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1864 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1865
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1866 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1867 return priv->buddy_icon_path;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1868 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1869
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1870 const char *
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1871 purple_account_get_protocol_id(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1872 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1873 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1874
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1875 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1876
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1877 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1878 return priv->protocol_id;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1879 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1880
40803
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1881 PurpleProtocol *
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1882 purple_account_get_protocol(PurpleAccount *account) {
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1883 PurpleAccountPrivate *priv = NULL;
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1884 PurpleProtocolManager *manager = NULL;
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1885
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1886 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1887
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1888 priv = purple_account_get_instance_private(account);
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1889 manager = purple_protocol_manager_get_default();
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1890
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1891 return purple_protocol_manager_find(manager, priv->protocol_id);
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1892 }
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1893
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1894 const char *
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1895 purple_account_get_protocol_name(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1896 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1897 PurpleProtocol *p;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1898
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1899 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1900
40804
5496016b3c00 Port libpurple from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents: 40803
diff changeset
1901 p = purple_account_get_protocol(account);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1902
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1903 return (p && purple_protocol_get_name(p) ?
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1904 _(purple_protocol_get_name(p)) : _("Unknown"));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1905 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1906
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1907 PurpleConnection *
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1908 purple_account_get_connection(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1909 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1910 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1911
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1912 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1913
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1914 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1915 return priv->gc;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1916 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1917
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1918 const gchar *
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1919 purple_account_get_name_for_display(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1920 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1921 PurpleBuddy *self = NULL;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1922 PurpleConnection *gc = NULL;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1923 const gchar *name = NULL, *username = NULL, *displayname = NULL;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1924
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1925 name = purple_account_get_private_alias(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1926
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1927 if (name) {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1928 return name;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1929 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1930
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1931 username = purple_account_get_username(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1932 self = purple_blist_find_buddy((PurpleAccount *)account, username);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1933
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1934 if (self) {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1935 const gchar *calias= purple_buddy_get_contact_alias(self);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1936
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1937 /* We don't want to return the buddy name if the buddy/contact
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1938 * doesn't have an alias set. */
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1939 if (!purple_strequal(username, calias)) {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1940 return calias;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1941 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1942 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1943
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1944 gc = purple_account_get_connection(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1945 displayname = purple_connection_get_display_name(gc);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1946
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1947 if (displayname) {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1948 return displayname;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1949 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1950
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1951 return username;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1952 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1953
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1954 gboolean
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1955 purple_account_get_remember_password(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1956 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1957 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1958
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1959 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1960
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1961 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1962 return priv->remember_pass;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1963 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1964
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1965 gboolean
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1966 purple_account_get_enabled(PurpleAccount *account) {
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1967 PurpleAccountPrivate *priv = NULL;
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1968
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1969 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), FALSE);
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1970
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1971 priv = purple_account_get_instance_private(account);
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1972
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1973 return priv->enabled;
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1974 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1975
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1976 PurpleProxyInfo *
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1977 purple_account_get_proxy_info(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1978 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1979 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1980
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1981 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1982
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1983 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1984 return priv->proxy_info;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1985 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1986
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1987 PurpleAccountPrivacyType
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1988 purple_account_get_privacy_type(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1989 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1990 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1991
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1992 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), PURPLE_ACCOUNT_PRIVACY_ALLOW_ALL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1993
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1994 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1995 return priv->privacy_type;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1996 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1997
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1998 gboolean
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1999 purple_account_privacy_permit_add(PurpleAccount *account, const char *who,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2000 gboolean local_only)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2001 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2002 char *name;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2003 PurpleBuddy *buddy;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2004 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2005 PurpleAccountUiOps *ui_ops = purple_accounts_get_ui_ops();
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2006
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2007 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2008 g_return_val_if_fail(who != NULL, FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2009
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2010 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2011 name = g_strdup(purple_normalize(account, who));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2012
40052
cc03b5af25ea Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39897
diff changeset
2013 if (g_slist_find_custom(priv->permit, name, (GCompareFunc)g_strcmp0) != NULL) {
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2014 /* This buddy already exists, so bail out */
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2015 g_free(name);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2016 return FALSE;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2017 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2018
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2019 priv->permit = g_slist_append(priv->permit, name);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2020
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2021 if (!local_only && purple_account_is_connected(account))
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2022 purple_serv_add_permit(purple_account_get_connection(account), who);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2023
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2024 if (ui_ops != NULL && ui_ops->permit_added != NULL)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2025 ui_ops->permit_added(account, who);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2026
39676
1e8394d47205 Add list parameter to all buddy list UI ops.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
2027 purple_blist_save_account(purple_blist_get_default(), account);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2028
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2029 /* This lets the UI know a buddy has had its privacy setting changed */
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2030 buddy = purple_blist_find_buddy(account, name);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2031 if (buddy != NULL) {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2032 purple_signal_emit(purple_blist_get_handle(),
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2033 "buddy-privacy-changed", buddy);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2034 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2035 return TRUE;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2036 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2037
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2038 gboolean
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2039 purple_account_privacy_permit_remove(PurpleAccount *account, const char *who,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2040 gboolean local_only)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2041 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2042 GSList *l;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2043 const char *name;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2044 PurpleBuddy *buddy;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2045 char *del;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2046 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2047 PurpleAccountUiOps *ui_ops = purple_accounts_get_ui_ops();
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2048
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2049 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2050 g_return_val_if_fail(who != NULL, FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2051
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2052 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2053 name = purple_normalize(account, who);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2054
40052
cc03b5af25ea Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39897
diff changeset
2055 l = g_slist_find_custom(priv->permit, name, (GCompareFunc)g_strcmp0);
40521
c4269b37a13a Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents: 40519
diff changeset
2056 if (l == NULL) {
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2057 /* We didn't find the buddy we were looking for, so bail out */
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2058 return FALSE;
40521
c4269b37a13a Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents: 40519
diff changeset
2059 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2060
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2061 /* We should not free l->data just yet. There can be occasions where
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2062 * l->data == who. In such cases, freeing l->data here can cause crashes
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2063 * later when who is used. */
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2064 del = l->data;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2065 priv->permit = g_slist_delete_link(priv->permit, l);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2066
40521
c4269b37a13a Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents: 40519
diff changeset
2067 if (!local_only && purple_account_is_connected(account)) {
c4269b37a13a Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents: 40519
diff changeset
2068 purple_serv_remove_permit(purple_account_get_connection(account), who);
c4269b37a13a Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents: 40519
diff changeset
2069 }
c4269b37a13a Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents: 40519
diff changeset
2070
c4269b37a13a Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents: 40519
diff changeset
2071 if (ui_ops != NULL && ui_ops->permit_removed != NULL) {
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2072 ui_ops->permit_removed(account, who);
40521
c4269b37a13a Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents: 40519
diff changeset
2073 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2074
39676
1e8394d47205 Add list parameter to all buddy list UI ops.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
2075 purple_blist_save_account(purple_blist_get_default(), account);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2076
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2077 buddy = purple_blist_find_buddy(account, name);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2078 if (buddy != NULL) {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2079 purple_signal_emit(purple_blist_get_handle(),
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2080 "buddy-privacy-changed", buddy);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2081 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2082 g_free(del);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2083 return TRUE;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2084 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2085
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2086 gboolean
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2087 purple_account_privacy_deny_add(PurpleAccount *account, const char *who,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2088 gboolean local_only)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2089 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2090 char *name;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2091 PurpleBuddy *buddy;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2092 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2093 PurpleAccountUiOps *ui_ops = purple_accounts_get_ui_ops();
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2094
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2095 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2096 g_return_val_if_fail(who != NULL, FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2097
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2098 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2099 name = g_strdup(purple_normalize(account, who));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2100
40052
cc03b5af25ea Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39897
diff changeset
2101 if (g_slist_find_custom(priv->deny, name, (GCompareFunc)g_strcmp0) != NULL) {
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2102 /* This buddy already exists, so bail out */
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2103 g_free(name);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2104 return FALSE;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2105 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2106
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2107 priv->deny = g_slist_append(priv->deny, name);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2108
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2109 if (!local_only && purple_account_is_connected(account))
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2110 purple_serv_add_deny(purple_account_get_connection(account), who);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2111
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2112 if (ui_ops != NULL && ui_ops->deny_added != NULL)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2113 ui_ops->deny_added(account, who);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2114
39676
1e8394d47205 Add list parameter to all buddy list UI ops.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
2115 purple_blist_save_account(purple_blist_get_default(), account);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2116
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2117 buddy = purple_blist_find_buddy(account, name);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2118 if (buddy != NULL) {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2119 purple_signal_emit(purple_blist_get_handle(),
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2120 "buddy-privacy-changed", buddy);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2121 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2122 return TRUE;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2123 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2124
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2125 gboolean
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2126 purple_account_privacy_deny_remove(PurpleAccount *account, const char *who,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2127 gboolean local_only)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2128 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2129 GSList *l;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2130 const char *normalized;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2131 char *name;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2132 PurpleBuddy *buddy;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2133 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2134 PurpleAccountUiOps *ui_ops = purple_accounts_get_ui_ops();
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2135
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2136 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2137 g_return_val_if_fail(who != NULL, FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2138
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2139 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2140 normalized = purple_normalize(account, who);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2141
40052
cc03b5af25ea Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39897
diff changeset
2142 l = g_slist_find_custom(priv->deny, normalized, (GCompareFunc)g_strcmp0);
40521
c4269b37a13a Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents: 40519
diff changeset
2143 if (l == NULL) {
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2144 /* We didn't find the buddy we were looking for, so bail out */
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2145 return FALSE;
40521
c4269b37a13a Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents: 40519
diff changeset
2146 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2147
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2148 buddy = purple_blist_find_buddy(account, normalized);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2149
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2150 name = l->data;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2151 priv->deny = g_slist_delete_link(priv->deny, l);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2152
40521
c4269b37a13a Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents: 40519
diff changeset
2153 if (!local_only && purple_account_is_connected(account)) {
c4269b37a13a Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents: 40519
diff changeset
2154 purple_serv_remove_deny(purple_account_get_connection(account), name);
c4269b37a13a Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents: 40519
diff changeset
2155 }
c4269b37a13a Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents: 40519
diff changeset
2156
c4269b37a13a Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents: 40519
diff changeset
2157 if (ui_ops != NULL && ui_ops->deny_removed != NULL) {
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2158 ui_ops->deny_removed(account, who);
40521
c4269b37a13a Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents: 40519
diff changeset
2159 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2160
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2161 if (buddy != NULL) {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2162 purple_signal_emit(purple_blist_get_handle(),
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2163 "buddy-privacy-changed", buddy);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2164 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2165
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2166 g_free(name);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2167
39676
1e8394d47205 Add list parameter to all buddy list UI ops.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
2168 purple_blist_save_account(purple_blist_get_default(), account);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2169
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2170 return TRUE;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2171 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2172
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2173 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2174 purple_account_privacy_allow(PurpleAccount *account, const char *who)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2175 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2176 GSList *list;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2177 PurpleAccountPrivacyType type = purple_account_get_privacy_type(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2178 PurpleAccountPrivate *priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2179
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2180 switch (type) {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2181 case PURPLE_ACCOUNT_PRIVACY_ALLOW_ALL:
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2182 return;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2183 case PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS:
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2184 purple_account_privacy_permit_add(account, who, FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2185 break;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2186 case PURPLE_ACCOUNT_PRIVACY_DENY_USERS:
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2187 purple_account_privacy_deny_remove(account, who, FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2188 break;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2189 case PURPLE_ACCOUNT_PRIVACY_DENY_ALL:
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2190 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2191 /* Empty the allow-list. */
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2192 const char *norm = purple_normalize(account, who);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2193 for (list = priv->permit; list != NULL;) {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2194 char *person = list->data;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2195 list = list->next;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2196 if (!purple_strequal(norm, person))
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2197 purple_account_privacy_permit_remove(account, person, FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2198 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2199 purple_account_privacy_permit_add(account, who, FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2200 purple_account_set_privacy_type(account, PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2201 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2202 break;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2203 case PURPLE_ACCOUNT_PRIVACY_ALLOW_BUDDYLIST:
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2204 if (!purple_blist_find_buddy(account, who)) {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2205 add_all_buddies_to_permit_list(account, FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2206 purple_account_privacy_permit_add(account, who, FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2207 purple_account_set_privacy_type(account, PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2208 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2209 break;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2210 default:
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2211 g_return_if_reached();
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2212 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2213
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2214 /* Notify the server if the privacy setting was changed */
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2215 if (type != purple_account_get_privacy_type(account) && purple_account_is_connected(account))
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2216 purple_serv_set_permit_deny(purple_account_get_connection(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2217 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2218
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2219 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2220 purple_account_privacy_deny(PurpleAccount *account, const char *who)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2221 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2222 GSList *list;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2223 PurpleAccountPrivacyType type = purple_account_get_privacy_type(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2224 PurpleAccountPrivate *priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2225
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2226 switch (type) {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2227 case PURPLE_ACCOUNT_PRIVACY_ALLOW_ALL:
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2228 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2229 /* Empty the deny-list. */
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2230 const char *norm = purple_normalize(account, who);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2231 for (list = priv->deny; list != NULL; ) {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2232 char *person = list->data;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2233 list = list->next;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2234 if (!purple_strequal(norm, person))
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2235 purple_account_privacy_deny_remove(account, person, FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2236 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2237 purple_account_privacy_deny_add(account, who, FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2238 purple_account_set_privacy_type(account, PURPLE_ACCOUNT_PRIVACY_DENY_USERS);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2239 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2240 break;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2241 case PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS:
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2242 purple_account_privacy_permit_remove(account, who, FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2243 break;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2244 case PURPLE_ACCOUNT_PRIVACY_DENY_USERS:
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2245 purple_account_privacy_deny_add(account, who, FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2246 break;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2247 case PURPLE_ACCOUNT_PRIVACY_DENY_ALL:
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2248 break;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2249 case PURPLE_ACCOUNT_PRIVACY_ALLOW_BUDDYLIST:
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2250 if (purple_blist_find_buddy(account, who)) {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2251 add_all_buddies_to_permit_list(account, FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2252 purple_account_privacy_permit_remove(account, who, FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2253 purple_account_set_privacy_type(account, PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2254 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2255 break;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2256 default:
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2257 g_return_if_reached();
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2258 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2259
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2260 /* Notify the server if the privacy setting was changed */
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2261 if (type != purple_account_get_privacy_type(account) && purple_account_is_connected(account))
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2262 purple_serv_set_permit_deny(purple_account_get_connection(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2263 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2264
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2265 GSList *
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2266 purple_account_privacy_get_permitted(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2267 {
39782
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39759
diff changeset
2268 PurpleAccountPrivate *priv = NULL;
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39759
diff changeset
2269
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39759
diff changeset
2270 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39759
diff changeset
2271
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39759
diff changeset
2272 priv = purple_account_get_instance_private(account);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2273 return priv->permit;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2274 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2275
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2276 GSList *
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2277 purple_account_privacy_get_denied(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2278 {
39782
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39759
diff changeset
2279 PurpleAccountPrivate *priv = NULL;
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39759
diff changeset
2280
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39759
diff changeset
2281 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39759
diff changeset
2282
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39759
diff changeset
2283 priv = purple_account_get_instance_private(account);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2284 return priv->deny;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2285 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2286
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2287 gboolean
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2288 purple_account_privacy_check(PurpleAccount *account, const char *who)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2289 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2290 PurpleAccountPrivate *priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2291
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2292 switch (purple_account_get_privacy_type(account)) {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2293 case PURPLE_ACCOUNT_PRIVACY_ALLOW_ALL:
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2294 return TRUE;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2295
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2296 case PURPLE_ACCOUNT_PRIVACY_DENY_ALL:
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2297 return FALSE;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2298
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2299 case PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS:
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2300 who = purple_normalize(account, who);
40052
cc03b5af25ea Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39897
diff changeset
2301 return (g_slist_find_custom(priv->permit, who, (GCompareFunc)g_strcmp0) != NULL);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2302
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2303 case PURPLE_ACCOUNT_PRIVACY_DENY_USERS:
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2304 who = purple_normalize(account, who);
40052
cc03b5af25ea Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39897
diff changeset
2305 return (g_slist_find_custom(priv->deny, who, (GCompareFunc)g_strcmp0) == NULL);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2306
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2307 case PURPLE_ACCOUNT_PRIVACY_ALLOW_BUDDYLIST:
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2308 return (purple_blist_find_buddy(account, who) != NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2309
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2310 default:
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2311 g_return_val_if_reached(TRUE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2312 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2313 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2314
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2315 PurpleStatus *
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2316 purple_account_get_active_status(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2317 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2318 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2319
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2320 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2321
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2322 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2323 return purple_presence_get_active_status(priv->presence);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2324 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2325
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2326 PurpleStatus *
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2327 purple_account_get_status(PurpleAccount *account, const char *status_id)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2328 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2329 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2330
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2331 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2332 g_return_val_if_fail(status_id != NULL, NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2333
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2334 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2335
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2336 return purple_presence_get_status(priv->presence, status_id);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2337 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2338
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2339 PurpleStatusType *
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2340 purple_account_get_status_type(PurpleAccount *account, const char *id)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2341 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2342 GList *l;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2343
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2344 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2345 g_return_val_if_fail(id != NULL, NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2346
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2347 for (l = purple_account_get_status_types(account); l != NULL; l = l->next)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2348 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2349 PurpleStatusType *status_type = (PurpleStatusType *)l->data;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2350
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2351 if (purple_strequal(purple_status_type_get_id(status_type), id))
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2352 return status_type;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2353 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2354
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2355 return NULL;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2356 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2357
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2358 PurpleStatusType *
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2359 purple_account_get_status_type_with_primitive(PurpleAccount *account, PurpleStatusPrimitive primitive)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2360 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2361 GList *l;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2362
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2363 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2364
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2365 for (l = purple_account_get_status_types(account); l != NULL; l = l->next)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2366 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2367 PurpleStatusType *status_type = (PurpleStatusType *)l->data;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2368
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2369 if (purple_status_type_get_primitive(status_type) == primitive)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2370 return status_type;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2371 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2372
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2373 return NULL;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2374 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2375
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2376 PurplePresence *
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2377 purple_account_get_presence(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2378 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2379 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2380
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2381 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2382
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2383 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2384 return priv->presence;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2385 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2386
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2387 gboolean
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2388 purple_account_is_status_active(PurpleAccount *account,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2389 const char *status_id)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2390 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2391 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2392
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2393 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2394 g_return_val_if_fail(status_id != NULL, FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2395
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2396 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2397
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2398 return purple_presence_is_status_active(priv->presence, status_id);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2399 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2400
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2401 GList *
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2402 purple_account_get_status_types(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2403 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2404 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2405
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2406 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2407
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2408 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2409 return priv->status_types;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2410 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2411
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2412 int
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2413 purple_account_get_int(PurpleAccount *account, const char *name,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2414 int default_value)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2415 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2416 PurpleAccountSetting *setting;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2417 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2418
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2419 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), default_value);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2420 g_return_val_if_fail(name != NULL, default_value);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2421
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2422 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2423
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2424 setting = g_hash_table_lookup(priv->settings, name);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2425
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2426 if (setting == NULL)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2427 return default_value;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2428
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2429 g_return_val_if_fail(G_VALUE_HOLDS_INT(&setting->value), default_value);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2430
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2431 return g_value_get_int(&setting->value);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2432 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2433
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2434 const char *
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2435 purple_account_get_string(PurpleAccount *account, const char *name,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2436 const char *default_value)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2437 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2438 PurpleAccountSetting *setting;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2439 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2440
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2441 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), default_value);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2442 g_return_val_if_fail(name != NULL, default_value);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2443
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2444 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2445
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2446 setting = g_hash_table_lookup(priv->settings, name);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2447
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2448 if (setting == NULL)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2449 return default_value;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2450
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2451 g_return_val_if_fail(G_VALUE_HOLDS_STRING(&setting->value), default_value);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2452
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2453 return g_value_get_string(&setting->value);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2454 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2455
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2456 gboolean
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2457 purple_account_get_bool(PurpleAccount *account, const char *name,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2458 gboolean default_value)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2459 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2460 PurpleAccountSetting *setting;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2461 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2462
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2463 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), default_value);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2464 g_return_val_if_fail(name != NULL, default_value);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2465
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2466 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2467
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2468 setting = g_hash_table_lookup(priv->settings, name);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2469
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2470 if (setting == NULL)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2471 return default_value;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2472
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2473 g_return_val_if_fail(G_VALUE_HOLDS_BOOLEAN(&setting->value), default_value);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2474
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2475 return g_value_get_boolean(&setting->value);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2476 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2477
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2478 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2479 purple_account_add_buddy(PurpleAccount *account, PurpleBuddy *buddy, const char *message)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2480 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2481 PurpleProtocol *protocol = NULL;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2482 PurpleConnection *gc;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2483
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2484 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2485 g_return_if_fail(PURPLE_IS_BUDDY(buddy));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2486
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2487 gc = purple_account_get_connection(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2488 if (gc != NULL)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2489 protocol = purple_connection_get_protocol(gc);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2490
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2491 if(PURPLE_IS_PROTOCOL_SERVER(protocol)) {
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2492 PurpleGroup *group = purple_buddy_get_group(buddy);
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2493
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2494 purple_protocol_server_add_buddy(PURPLE_PROTOCOL_SERVER(protocol), gc,
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2495 buddy, group, message);
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2496 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2497 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2498
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2499 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2500 purple_account_add_buddies(PurpleAccount *account, GList *buddies, const char *message)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2501 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2502 PurpleProtocol *protocol = NULL;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2503 PurpleConnection *gc = purple_account_get_connection(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2504
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2505 if (gc != NULL)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2506 protocol = purple_connection_get_protocol(gc);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2507
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2508 if (protocol) {
40783
4f197d3e42d6 Use g_list_copy_deep instead of manual copy/transform
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40708
diff changeset
2509 GList *groups;
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2510
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2511 /* Make a list of what group each buddy is in */
40783
4f197d3e42d6 Use g_list_copy_deep instead of manual copy/transform
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40708
diff changeset
2512 groups = g_list_copy_deep(buddies, (GCopyFunc)purple_buddy_get_group, NULL);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2513
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2514 if(PURPLE_IS_PROTOCOL_SERVER(protocol)) {
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2515 purple_protocol_server_add_buddies(PURPLE_PROTOCOL_SERVER(protocol),
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2516 gc, buddies, groups, message);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2517 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2518
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2519 g_list_free(groups);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2520 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2521 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2522
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2523 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2524 purple_account_remove_buddy(PurpleAccount *account, PurpleBuddy *buddy,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2525 PurpleGroup *group)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2526 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2527 PurpleProtocol *protocol = NULL;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2528 PurpleConnection *gc = purple_account_get_connection(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2529
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2530 if (gc != NULL)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2531 protocol = purple_connection_get_protocol(gc);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2532
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2533 if(PURPLE_IS_PROTOCOL_SERVER(protocol)) {
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2534 purple_protocol_server_remove_buddy(PURPLE_PROTOCOL_SERVER(protocol),
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2535 gc, buddy, group);
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2536 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2537 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2538
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2539 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2540 purple_account_remove_buddies(PurpleAccount *account, GList *buddies, GList *groups)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2541 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2542 PurpleProtocol *protocol = NULL;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2543 PurpleConnection *gc = purple_account_get_connection(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2544
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2545 if (gc != NULL)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2546 protocol = purple_connection_get_protocol(gc);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2547
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2548 if(PURPLE_IS_PROTOCOL_SERVER(protocol)) {
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2549 purple_protocol_server_remove_buddies(PURPLE_PROTOCOL_SERVER(protocol),
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2550 gc, buddies, groups);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2551 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2552 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2553
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2554 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2555 purple_account_remove_group(PurpleAccount *account, PurpleGroup *group)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2556 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2557 PurpleProtocol *protocol = NULL;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2558 PurpleConnection *gc = purple_account_get_connection(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2559
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2560 if (gc != NULL)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2561 protocol = purple_connection_get_protocol(gc);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2562
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2563 if(PURPLE_IS_PROTOCOL_SERVER(protocol)) {
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2564 purple_protocol_server_remove_group(PURPLE_PROTOCOL_SERVER(protocol),
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2565 gc, group);
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2566 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2567 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2568
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2569 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2570 purple_account_change_password(PurpleAccount *account, const char *orig_pw,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2571 const char *new_pw)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2572 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
2573 PurpleCredentialManager *manager = NULL;
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2574 PurpleProtocol *protocol = NULL;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2575 PurpleConnection *gc = purple_account_get_connection(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2576
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
2577 /* just going to fire and forget this for now as not many protocols even
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
2578 * implement the change password stuff.
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
2579 */
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
2580 manager = purple_credential_manager_get_default();
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
2581 purple_credential_manager_write_password_async(manager, account, new_pw,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
2582 NULL, NULL, NULL);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2583
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2584 if (gc != NULL)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2585 protocol = purple_connection_get_protocol(gc);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2586
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2587 if(PURPLE_IS_PROTOCOL_SERVER(protocol)) {
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2588 purple_protocol_server_change_passwd(PURPLE_PROTOCOL_SERVER(protocol),
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2589 gc, orig_pw, new_pw);
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2590 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2591 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2592
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2593 gboolean purple_account_supports_offline_message(PurpleAccount *account, PurpleBuddy *buddy)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2594 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2595 PurpleConnection *gc;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2596 PurpleProtocol *protocol = NULL;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2597
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2598 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2599 g_return_val_if_fail(PURPLE_IS_BUDDY(buddy), FALSE);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2600
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2601 gc = purple_account_get_connection(account);
40634
4d3018b00ad4 Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
2602 if(gc == NULL) {
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2603 return FALSE;
40634
4d3018b00ad4 Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
2604 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2605
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2606 protocol = purple_connection_get_protocol(gc);
40634
4d3018b00ad4 Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
2607 if(!protocol) {
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2608 return FALSE;
40634
4d3018b00ad4 Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
2609 }
4d3018b00ad4 Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
2610
4d3018b00ad4 Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
2611 return purple_protocol_client_offline_message(PURPLE_PROTOCOL_CLIENT(protocol), buddy);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2612 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2613
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2614 const PurpleConnectionErrorInfo *
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2615 purple_account_get_current_error(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2616 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2617 PurpleAccountPrivate *priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2618
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2619 return priv->current_error;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2620 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2621
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2622 void
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2623 purple_account_clear_current_error(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2624 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2625 _purple_account_set_current_error(account, NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2626 }

mercurial