libpurple/account.c

Fri, 12 Aug 2022 03:44:34 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Fri, 12 Aug 2022 03:44:34 -0500
branch
gtk4
changeset 41560
2579a5138f0c
parent 41517
5bafe75d3907
child 41685
ca22b00972d4
permissions
-rw-r--r--

A bunch of random fixes for the the gtk4 branch

Testing Done:
Compiled

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

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"
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
34 #include "purpleaddcontactrequest.h"
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
35 #include "purpleconversationmanager.h"
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
36 #include "purplecredentialmanager.h"
41438
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41432
diff changeset
37 #include "purplenotification.h"
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41432
diff changeset
38 #include "purplenotificationmanager.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
39 #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
40 #include "purpleprotocolclient.h"
40803
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
41 #include "purpleprotocolmanager.h"
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
42 #include "purpleprotocolserver.h"
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
43 #include "request.h"
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
44 #include "server.h"
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6368
diff changeset
45 #include "signals.h"
5717
2f3a377de638 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents: 5711
diff changeset
46 #include "util.h"
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47
39663
d3c442966920 Remove PurpleAccount->ui_data and accessors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39514
diff changeset
48 struct _PurpleAccount
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 GObject gparent;
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
21287
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
53 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
54 {
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
55 gchar *id;
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
56
35470
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
57 char *username; /* The username. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
58 char *alias; /* How you appear to yourself. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
59 char *user_info; /* User information. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
60
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
61 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
62
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
63 gboolean enabled;
35470
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
64 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
65
34593
318dcc5ef8e8 Added reminder to replace protocol_id member of account by a GObject
Ankit Vani <a@nevitus.org>
parents: 34591
diff changeset
66 /*
318dcc5ef8e8 Added reminder to replace protocol_id member of account by a GObject
Ankit Vani <a@nevitus.org>
parents: 34591
diff changeset
67 * 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
68 * 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
69 */
35470
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
70 char *protocol_id; /* The ID of the protocol. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
71
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
72 PurpleConnection *gc; /* The connection handle. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
73 gboolean disconnecting; /* The account is currently disconnecting */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
74
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
75 GHashTable *settings; /* Protocol-specific settings. */
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 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
78 /* 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
79 /* proxy settings from global prefs. */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
80
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
81 /*
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
82 * 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
83 * 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
84 * 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
85 * 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
86 * 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
87 * GHashTable.
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
88 */
35470
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
89 GSList *permit; /* Permit list. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
90 GSList *deny; /* Deny list. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
91 PurpleAccountPrivacyType privacy_type; /* The permit/deny setting. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
92
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
93 GList *status_types; /* Status types. */
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 PurplePresence *presence; /* Presence. */
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
96
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
97 PurpleAccountRegistrationCb registration_cb;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
98 void *registration_cb_user_data;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
99
35470
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
100 PurpleConnectionErrorInfo *current_error; /* Errors */
41438
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41432
diff changeset
101 PurpleNotification *error_notification;
21287
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
102 } PurpleAccountPrivate;
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
103
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
104 typedef struct
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
105 {
5777
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
106 char *ui;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
107 GValue value;
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
108
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
109 } PurpleAccountSetting;
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
110
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
111 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
112 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
113 PurpleAccount *account;
41312
c39de96b3daf Replace PurpleCallback by GCallback
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41220
diff changeset
114 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
115 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
116 } 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
117
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
118 /* GObject Property enums */
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
119 enum
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
120 {
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
121 PROP_0,
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
122 PROP_ID,
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
123 PROP_USERNAME,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
124 PROP_PRIVATE_ALIAS,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
125 PROP_ENABLED,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
126 PROP_CONNECTION,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
127 PROP_PROTOCOL_ID,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
128 PROP_USER_INFO,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
129 PROP_BUDDY_ICON_PATH,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
130 PROP_REMEMBER_PASSWORD,
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
131 PROP_PROXY_INFO,
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
132 PROP_LAST
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
133 };
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
134
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
135 static GParamSpec *properties[PROP_LAST];
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
136
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
137 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
138
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
139 /******************************************************************************
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
140 * 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
141 *****************************************************************************/
30740
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30708
diff changeset
142 static void
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
143 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
144 gpointer data)
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
145 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
146 PurpleCredentialManager *manager = PURPLE_CREDENTIAL_MANAGER(obj);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
147 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
148 GError *error = NULL;
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
149 gchar *password = NULL;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
150
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
151 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
152 &error);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
153
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
154 if(error != NULL) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
155 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
156 error->message);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
157 g_error_free(error);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
158 }
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
159
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
160 _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
161
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
162 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
163 }
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
164
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
165 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
166 purple_account_register(PurpleAccount *account)
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
167 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
168 PurpleCredentialManager *manager = NULL;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
169
34983
81638be26f41 Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents: 34955
diff changeset
170 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
171
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
172 purple_debug_info("account", "Registering account %s\n",
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
173 purple_account_get_username(account));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
174
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
175 manager = purple_credential_manager_get_default();
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
176 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
177 purple_account_register_got_password_cb,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
178 account);
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
179 }
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
180
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
181 static void
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
182 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
183 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
184 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
185 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
186 PurpleCallbackBundle *cbb = data;
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
187 PurpleAccountUnregistrationCb cb;
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
188 GError *error = NULL;
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
189 gchar *password = NULL;
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
190
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
191 cb = (PurpleAccountUnregistrationCb)cbb->cb;
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
192
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
193 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
194 &error);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
195
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
196 if(error != NULL) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
197 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
198 error->message);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
199
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
200 g_error_free(error);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
201 }
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
202
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
203 _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
204
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
205 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
206 g_free(cbb);
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
207 }
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
208
34992
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
209 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
210 {
34992
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
211 PurpleAccount *account;
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
212 gboolean succeeded;
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
213 };
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
214
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
215 static gboolean
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
216 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
217 {
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
218 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
219 PurpleAccountPrivate *priv;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
220
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
221 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
222
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
223 if (priv->registration_cb)
34992
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
224 (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
225 priv->registration_cb_user_data);
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
226
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
227 g_object_unref(closure->account);
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
228 g_free(closure);
34991
63c14353a0f4 Manage refcounts in some libpurple callbacks
Ankit Vani <a@nevitus.org>
parents: 34990
diff changeset
229
34990
6e2b46ef6743 Add a timeout for calling registration callback.
Ankit Vani <a@nevitus.org>
parents: 34987
diff changeset
230 return FALSE;
6e2b46ef6743 Add a timeout for calling registration callback.
Ankit Vani <a@nevitus.org>
parents: 34987
diff changeset
231 }
6e2b46ef6743 Add a timeout for calling registration callback.
Ankit Vani <a@nevitus.org>
parents: 34987
diff changeset
232
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
233 static void
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
234 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
235 PurpleCredentialManager *manager = PURPLE_CREDENTIAL_MANAGER(obj);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
236 PurpleAccount *account = PURPLE_ACCOUNT(data);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
237 GError *error = NULL;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
238 gchar *password = NULL;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
239
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
240 /* 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
241 * 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
242 * 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
243 */
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
244 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
245 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
246
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
247 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
248 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
249
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
250 /* 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
251 * 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
252 */
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
253 purple_debug_info("account",
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
254 "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
255 name,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
256 error != NULL ? error->message : "unknown error");
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
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
259 _purple_connection_new(account, FALSE, password);
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 g_free(password);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
262 }
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 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
265 request_password_ok_cb(PurpleAccount *account, PurpleRequestFields *fields)
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
266 {
11042
d1ccf8d8a187 [gaim-migrate @ 12954]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11033
diff changeset
267 const char *entry;
d1ccf8d8a187 [gaim-migrate @ 12954]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11033
diff changeset
268 gboolean remember;
11985
d4a210fb43e9 [gaim-migrate @ 14278]
Mark Doliner <markdoliner@pidgin.im>
parents: 11982
diff changeset
269
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
270 entry = purple_request_fields_get_string(fields, "password");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
271 remember = purple_request_fields_get_bool(fields, "remember");
11985
d4a210fb43e9 [gaim-migrate @ 14278]
Mark Doliner <markdoliner@pidgin.im>
parents: 11982
diff changeset
272
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
273 if (!entry || !*entry)
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
274 {
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
275 purple_notify_error(account, NULL,
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
276 _("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
277 purple_request_cpar_from_account(account));
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
278 return;
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
279 }
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
280
33996
ca5e901a5311 Implemented a password caching system to limit problems linked to the
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33995
diff changeset
281 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
282
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
283 if(remember) {
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
284 PurpleCredentialManager *manager = NULL;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
285
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
286 manager = purple_credential_manager_get_default();
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
287
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
288 /* 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
289 * 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
290 * duplicate it for that callback.
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
291 */
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
292 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
293 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
294 NULL,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
295 request_password_write_cb,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
296 account);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
297 } else {
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
298 _purple_connection_new(account, FALSE, entry);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
299 }
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
300 }
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
301
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
302 static void
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
303 request_password_cancel_cb(PurpleAccount *account, PurpleRequestFields *fields)
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
304 {
30708
535bec1e66fb Standardize on "cancelled".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30456
diff changeset
305 /* 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
306 purple_account_set_enabled(account, FALSE);
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
307 }
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
308
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
309
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
310 static void
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
311 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
312 gpointer data)
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
313 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
314 PurpleCredentialManager *manager = PURPLE_CREDENTIAL_MANAGER(obj);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
315 PurpleAccount *account = PURPLE_ACCOUNT(data);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
316 PurpleProtocol *protocol = NULL;
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
317 GError *error = NULL;
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
318 gchar *password = NULL;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
319
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
320 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
321 &error);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
322
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
323 if(error != NULL) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
324 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
325 error->message);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
326
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
327 g_error_free(error);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
328 }
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
329
40804
5496016b3c00 Port libpurple from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents: 40803
diff changeset
330 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
331
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
332 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
333 !(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
334 !(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
335 {
34145
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
336 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
337 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
338 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
339 } else {
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
340 _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
341 }
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
342
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
343 g_free(password);
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
344 }
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
345
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
346 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
347 change_password_cb(PurpleAccount *account, PurpleRequestFields *fields)
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
348 {
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
349 const char *orig_pass, *new_pass_1, *new_pass_2;
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
350
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
351 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
352 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
353 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
354
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
355 if (g_utf8_collate(new_pass_1, new_pass_2))
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
356 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
357 purple_notify_error(account, NULL,
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
358 _("New passwords do not match."), NULL,
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
359 purple_request_cpar_from_account(account));
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
360
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
361 return;
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
362 }
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
363
22854
0002c0556d57 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22484
diff changeset
364 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
365 (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
366 (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
367 (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
368 (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
369 (new_pass_2 == NULL || *new_pass_2 == '\0')))
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
370 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
371 purple_notify_error(account, NULL,
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
372 _("Fill out all fields completely."), NULL,
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
373 purple_request_cpar_from_account(account));
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
374 return;
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
375 }
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
376
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
377 purple_account_change_password(account, orig_pass, new_pass_1);
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
378 }
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
379
7067
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
380 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
381 set_user_info_cb(PurpleAccount *account, const char *user_info)
7067
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
382 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
383 PurpleConnection *gc;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
384
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
385 purple_account_set_user_info(account, user_info);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
386 gc = purple_account_get_connection(account);
35499
c4c5e0a670b1 Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
387 purple_serv_set_info(gc, user_info);
7067
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
388 }
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
389
34582
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
390 static void
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
391 delete_setting(void *data)
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
392 {
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
393 PurpleAccountSetting *setting = (PurpleAccountSetting *)data;
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
394
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
395 g_free(setting->ui);
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
396 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
397
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
398 g_free(setting);
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
399 }
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
400
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
401 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
402 purple_account_get_state(PurpleAccount *account)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
403 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
404 PurpleConnection *gc;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
405
34983
81638be26f41 Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents: 34955
diff changeset
406 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
407
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
408 gc = purple_account_get_connection(account);
11251
e38d86958a63 [gaim-migrate @ 13420]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11249
diff changeset
409 if (!gc)
34746
dc9c911dbd35 Started GObjectification of PurpleConnection.
Ankit Vani <a@nevitus.org>
parents: 34745
diff changeset
410 return PURPLE_CONNECTION_DISCONNECTED;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
411
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
412 return purple_connection_get_state(gc);
11251
e38d86958a63 [gaim-migrate @ 13420]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11249
diff changeset
413 }
e38d86958a63 [gaim-migrate @ 13420]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11249
diff changeset
414
35458
385156e1b493 Fix some gtk-doc warnings from account to connection
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
415 /*
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
416 * 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
417 * 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
418 */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
419 static void
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
420 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
421 {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
422 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
423 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
424
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
425 /* 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
426 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
427 char *person = list->data;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
428 list = list->next;
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
429 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
430 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
431 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
432
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
433 /* 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
434 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
435 while (list != NULL)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
436 {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
437 PurpleBuddy *buddy = list->data;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
438 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
439
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
440 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
441 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
442 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
443 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
444 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
445
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
446 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
447 _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
448 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
449 {
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
450 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
451 PurpleAccountPrivate *priv;
41438
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41432
diff changeset
452 PurpleNotificationManager *manager = NULL;
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
453
34983
81638be26f41 Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents: 34955
diff changeset
454 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
455 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
456
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
457 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
458
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
459 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
460 return;
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
461
41444
d8e0a25a57ac Properly set an account's current error.
Gary Kramlich <grim@reaperworld.com>
parents: 41441
diff changeset
462 priv->current_error = new_err;
d8e0a25a57ac Properly set an account's current error.
Gary Kramlich <grim@reaperworld.com>
parents: 41441
diff changeset
463
41438
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41432
diff changeset
464 manager = purple_notification_manager_get_default();
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41432
diff changeset
465
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41432
diff changeset
466 if(PURPLE_IS_NOTIFICATION(priv->error_notification)) {
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41432
diff changeset
467 purple_notification_manager_remove(manager, priv->error_notification);
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41432
diff changeset
468 g_clear_object(&priv->error_notification);
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41432
diff changeset
469 }
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41432
diff changeset
470
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41432
diff changeset
471 if(new_err != NULL) {
41441
e114ed471a1e Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
472 PurpleProtocol *protocol = NULL;
41500
9a1ad10a0940 When creating notifications for account errors, set the title so the UI's don't have to figure it out.
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
473 gchar *title = NULL;
41441
e114ed471a1e Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
474
41438
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41432
diff changeset
475 priv->error_notification =
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41432
diff changeset
476 purple_notification_new(PURPLE_NOTIFICATION_TYPE_CONNECTION_ERROR,
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41432
diff changeset
477 account, new_err, NULL);
41441
e114ed471a1e Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
478
41500
9a1ad10a0940 When creating notifications for account errors, set the title so the UI's don't have to figure it out.
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
479 if(priv->enabled) {
9a1ad10a0940 When creating notifications for account errors, set the title so the UI's don't have to figure it out.
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
480 title = g_strdup_printf(_("%s disconnected"), priv->username);
9a1ad10a0940 When creating notifications for account errors, set the title so the UI's don't have to figure it out.
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
481 } else {
9a1ad10a0940 When creating notifications for account errors, set the title so the UI's don't have to figure it out.
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
482 title = g_strdup_printf(_("%s disabled"), priv->username);
9a1ad10a0940 When creating notifications for account errors, set the title so the UI's don't have to figure it out.
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
483 }
9a1ad10a0940 When creating notifications for account errors, set the title so the UI's don't have to figure it out.
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
484
9a1ad10a0940 When creating notifications for account errors, set the title so the UI's don't have to figure it out.
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
485 purple_notification_set_title(priv->error_notification, title);
9a1ad10a0940 When creating notifications for account errors, set the title so the UI's don't have to figure it out.
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
486 g_free(title);
9a1ad10a0940 When creating notifications for account errors, set the title so the UI's don't have to figure it out.
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
487
41441
e114ed471a1e Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
488 protocol = purple_account_get_protocol(account);
e114ed471a1e Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
489 if(PURPLE_IS_PROTOCOL(protocol)) {
e114ed471a1e Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
490 const gchar *icon_name = purple_protocol_get_icon_name(protocol);
e114ed471a1e Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
491
e114ed471a1e Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
492 if(icon_name != NULL) {
e114ed471a1e Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
493 purple_notification_set_icon_name(priv->error_notification,
e114ed471a1e Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
494 icon_name);
e114ed471a1e Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
495 }
e114ed471a1e Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
496 }
e114ed471a1e Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
497
41438
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41432
diff changeset
498 purple_notification_manager_add(manager, priv->error_notification);
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41432
diff changeset
499 }
21312
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
500
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
501 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
502 "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
503 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
504 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
505
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
506 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
507 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
508
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
509 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
510 }
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
511
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
512 /******************************************************************************
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
513 * 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
514 *****************************************************************************/
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
515 static PurpleXmlNode *
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
516 proxy_settings_to_xmlnode(PurpleProxyInfo *proxy_info)
5710
3c2bf5725bb0 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5707
diff changeset
517 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
518 PurpleXmlNode *node, *child;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
519 PurpleProxyType proxy_type;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
520 const char *value;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
521 int int_value;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
522 char buf[21];
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
523
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
524 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
525
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
526 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
527
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
528 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
529 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
530 (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
531 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
532 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
533 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
534 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
535 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
536 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
537
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
538 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
539 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
540 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
541 purple_xmlnode_insert_data(child, value, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
542 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
543
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
544 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
545 {
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
546 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
547 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
548 purple_xmlnode_insert_data(child, buf, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
549 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
550
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
551 if ((value = purple_proxy_info_get_username(proxy_info)) != NULL)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
552 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
553 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
554 purple_xmlnode_insert_data(child, value, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
555 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
556
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
557 if ((value = purple_proxy_info_get_password(proxy_info)) != NULL)
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 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
560 purple_xmlnode_insert_data(child, value, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
561 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
562
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
563 return node;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
564 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
565
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
566 static PurpleXmlNode *
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
567 current_error_to_xmlnode(PurpleConnectionErrorInfo *err)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
568 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
569 PurpleXmlNode *node, *child;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
570 char type_str[3];
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
571
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
572 node = purple_xmlnode_new("current_error");
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
573
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
574 if(err == NULL)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
575 return node;
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 /* 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
578 * restart.
21300
1c23e08cb824 Document exactly how long the PurpleConnectionErrorInfo pointers given out by
Will Thompson <resiak@pidgin.im>
parents: 21298
diff changeset
579 */
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
580 if(!purple_connection_error_is_fatal (err->type))
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
581 return node;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
582
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
583 child = purple_xmlnode_new_child(node, "type");
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
584 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
585 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
586
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
587 child = purple_xmlnode_new_child(node, "description");
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
588 if(err->description) {
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
589 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
590 if(utf8ized == NULL) {
974dbfd7e52f Remove and replace a number of the purple utility functions
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
591 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
592 }
34935
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, utf8ized, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
594 g_free(utf8ized);
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
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
597 return node;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
598 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
599
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
600 static void
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
601 setting_to_xmlnode(gpointer key, gpointer value, gpointer user_data)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
602 {
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
603 const char *name;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
604 PurpleAccountSetting *setting;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
605 PurpleXmlNode *node, *child;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
606 char buf[21];
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
607
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
608 name = (const char *)key;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
609 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
610 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
611
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
612 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
613 purple_xmlnode_set_attrib(child, "name", name);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
614
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
615 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
616 purple_xmlnode_set_attrib(child, "type", "int");
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
617 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
618 purple_xmlnode_insert_data(child, buf, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
619 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
620 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
621 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
622 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
623 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
624 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
625 purple_xmlnode_set_attrib(child, "type", "bool");
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
626 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
627 purple_xmlnode_insert_data(child, buf, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
628 }
6368
ab9f99269dfe [gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents: 6367
diff changeset
629 }
ab9f99269dfe [gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents: 6367
diff changeset
630
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
631 PurpleXmlNode *
35178
7c775624f964 Move (_)purple_account_to_xmlnode to internal.h
Ankit Vani <a@nevitus.org>
parents: 35152
diff changeset
632 _purple_account_to_xmlnode(PurpleAccount *account)
6368
ab9f99269dfe [gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents: 6367
diff changeset
633 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
634 PurpleXmlNode *node, *child;
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
635 gchar *data = NULL;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
636 const char *tmp;
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
637 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
638 PurpleAccountPrivate *priv = purple_account_get_instance_private(account);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
639
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
640 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
641
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
642 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
643 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
644 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
645 }
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
646
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
647 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
648 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
649
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
650 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
651 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
652
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
653 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
654 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
655 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
656 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
657
34589
428e92c79631 Renamed purple_account_[get,set]_alias to purple_account[get,set]_private_alias.
Ankit Vani <a@nevitus.org>
parents: 34582
diff changeset
658 if ((tmp = purple_account_get_private_alias(account)) != NULL)
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
659 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
660 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
661 purple_xmlnode_insert_data(child, tmp, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
662 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
663
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
664 if ((tmp = purple_account_get_user_info(account)) != NULL)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
665 {
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
666 /* 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
667 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
668 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
669 }
34c1a17a91d7 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18190
diff changeset
670
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
671 if (g_hash_table_size(priv->settings) > 0)
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 child = purple_xmlnode_new_child(node, "settings");
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
674 g_hash_table_foreach(priv->settings, setting_to_xmlnode, child);
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
675 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
676
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
677 if ((proxy_info = purple_account_get_proxy_info(account)) != NULL)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
678 {
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
679 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
680 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
681 }
34c1a17a91d7 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18190
diff changeset
682
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
683 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
684 purple_xmlnode_insert_child(node, child);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
685
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
686 return node;
5710
3c2bf5725bb0 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5707
diff changeset
687 }
3c2bf5725bb0 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5707
diff changeset
688
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
689 /******************************************************************************
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
690 * Helpers
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
691 *****************************************************************************/
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
692 static void
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
693 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
694 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
695
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
696 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
697 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
698
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
699 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
700 }
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
701
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
702 /******************************************************************************
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
703 * 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
704 *****************************************************************************/
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
705 static void
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
706 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
707 GParamSpec *pspec)
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
708 {
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
709 PurpleAccount *account = PURPLE_ACCOUNT(obj);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
710
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
711 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
712 case PROP_ID:
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
713 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
714 break;
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
715 case PROP_USERNAME:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
716 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
717 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
718 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
719 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
720 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
721 case PROP_ENABLED:
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
722 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
723 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
724 case PROP_CONNECTION:
34753
b2c73469c1be GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents: 34751
diff changeset
725 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
726 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
727 case PROP_PROTOCOL_ID:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
728 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
729 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
730 case PROP_USER_INFO:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
731 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
732 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
733 case PROP_BUDDY_ICON_PATH:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
734 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
735 g_value_get_string(value));
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
736 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
737 case PROP_REMEMBER_PASSWORD:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
738 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
739 g_value_get_boolean(value));
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
740 break;
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
741 case PROP_PROXY_INFO:
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
742 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
743 break;
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
744 default:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
745 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
746 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
747 }
5710
3c2bf5725bb0 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5707
diff changeset
748 }
3c2bf5725bb0 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5707
diff changeset
749
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
750 static void
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
751 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
752 GParamSpec *pspec)
5580
a5a3e6dfb409 [gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents: 5574
diff changeset
753 {
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
754 PurpleAccount *account = PURPLE_ACCOUNT(obj);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
755
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
756 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
757 case PROP_ID:
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
758 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
759 break;
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
760 case PROP_USERNAME:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
761 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
762 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
763 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
764 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
765 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
766 case PROP_ENABLED:
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
767 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
768 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
769 case PROP_CONNECTION:
34753
b2c73469c1be GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents: 34751
diff changeset
770 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
771 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
772 case PROP_PROTOCOL_ID:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
773 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
774 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
775 case PROP_USER_INFO:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
776 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
777 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
778 case PROP_BUDDY_ICON_PATH:
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
779 g_value_set_string(value,
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
780 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
781 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
782 case PROP_REMEMBER_PASSWORD:
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
783 g_value_set_boolean(value,
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
784 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
785 break;
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
786 case PROP_PROXY_INFO:
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
787 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
788 break;
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
789 default:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
790 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
791 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
792 }
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
793 }
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
794
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
795 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
796 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
797 {
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
798 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
799
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
800 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
801 g_free, delete_setting);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
802
34590
9da48e98a77a Renamed PurpleAccount's private member perm_deny to privacy_type
Ankit Vani <a@nevitus.org>
parents: 34589
diff changeset
803 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
804 }
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
805
34686
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
806 static void
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
807 purple_account_constructed(GObject *object)
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
808 {
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
809 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
810 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
811 gchar *username, *protocol_id;
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36364
diff changeset
812 PurpleProtocol *protocol = NULL;
40804
5496016b3c00 Port libpurple from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents: 40803
diff changeset
813 PurpleProtocolManager *manager = NULL;
34686
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
814 PurpleStatusType *status_type;
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
815
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
816 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
817
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
818 /* 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
819 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
820 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
821
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
822 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
823
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
824 g_free(uuid);
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
825 }
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
826
34686
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
827 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
828 "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
829 "protocol-id", &protocol_id,
34686
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
830 NULL);
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
831
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
832 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
833 account);
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
834
40804
5496016b3c00 Port libpurple from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents: 40803
diff changeset
835 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
836 protocol = purple_protocol_manager_find(manager, protocol_id);
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36364
diff changeset
837 if (protocol == NULL) {
34769
427725f8ed54 Free strings received from g_object_get
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
838 g_free(username);
427725f8ed54 Free strings received from g_object_get
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
839 g_free(protocol_id);
5580
a5a3e6dfb409 [gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents: 5574
diff changeset
840 return;
a5a3e6dfb409 [gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents: 5574
diff changeset
841 }
a5a3e6dfb409 [gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents: 5574
diff changeset
842
36720
465f02116328 Refactored account, blistnodetypes, buddylist, connection to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
843 purple_account_set_status_types(account,
40813
71305a7d7423 Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents: 40804
diff changeset
844 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
845
34844
e341dbc04539 Refactored plugins, account, blistnodetypes to use the GObject presence API
Ankit Vani <a@nevitus.org>
parents: 34838
diff changeset
846 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
847
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
848 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
849 PURPLE_STATUS_AVAILABLE);
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
850 if (status_type != NULL)
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
851 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
852 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
853 TRUE);
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
854 else
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
855 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
856 "offline",
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
857 TRUE);
34769
427725f8ed54 Free strings received from g_object_get
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
858
427725f8ed54 Free strings received from g_object_get
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
859 g_free(username);
427725f8ed54 Free strings received from g_object_get
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
860 g_free(protocol_id);
5580
a5a3e6dfb409 [gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents: 5574
diff changeset
861 }
5573
633880e3f137 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5565
diff changeset
862
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
863 static void
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
864 purple_account_dispose(GObject *object)
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
865 {
35512
8d6f1349b57a Fix crash on wrong password (backout 0f0d6ae2fb77)
Ankit Vani <a@nevitus.org>
parents: 35499
diff changeset
866 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
867 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
868
8d6f1349b57a Fix crash on wrong password (backout 0f0d6ae2fb77)
Ankit Vani <a@nevitus.org>
parents: 35499
diff changeset
869 if (!purple_account_is_disconnected(account))
8d6f1349b57a Fix crash on wrong password (backout 0f0d6ae2fb77)
Ankit Vani <a@nevitus.org>
parents: 35499
diff changeset
870 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
871
894c29e33300 Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
872 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
873 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
874 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
875 }
894c29e33300 Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
876
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
877 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
878 }
894c29e33300 Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
879
894c29e33300 Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
880 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
881 purple_account_finalize(GObject *object)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
882 {
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
883 GList *l;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
884 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
885 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
886 PurpleConversationManager *manager = NULL;
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
887
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
888 purple_debug_info("account", "Destroying account %p\n", account);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
889 purple_signal_emit(purple_accounts_get_handle(), "account-destroying",
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
890 account);
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
891
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
892 manager = purple_conversation_manager_get_default();
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
893 l = purple_conversation_manager_get_all(manager);
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
894 while(l != NULL) {
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
895 PurpleConversation *conv = PURPLE_CONVERSATION(l->data);
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
896
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
897 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
898 purple_conversation_set_account(conv, NULL);
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
899 }
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
900
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
901 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
902 }
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
903
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
904 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
905
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
906 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
907
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
908 if (priv->current_error) {
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
909 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
910 g_free(priv->current_error);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
911 }
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
912
41438
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41432
diff changeset
913 g_clear_object(&priv->error_notification);
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41432
diff changeset
914
41432
aaff9cefb423 fix memory leak when using purple accounts
ivanhoe <ivanhoe@fiscari.de>
parents: 41429
diff changeset
915 g_free(priv->id);
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
916 g_free(priv->username);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
917 g_free(priv->alias);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
918 g_free(priv->user_info);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
919 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
920 g_free(priv->protocol_id);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
921
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
922 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
923
40052
cc03b5af25ea Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39897
diff changeset
924 g_slist_free_full(priv->deny, g_free);
cc03b5af25ea Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39897
diff changeset
925 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
926
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
927 G_OBJECT_CLASS(purple_account_parent_class)->finalize(object);
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
928 }
5874
5e19273d3c6f [gaim-migrate @ 6306]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
929
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
930 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
931 purple_account_class_init(PurpleAccountClass *klass)
11053
6d2abb51e586 [gaim-migrate @ 12991]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11042
diff changeset
932 {
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
933 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
934
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
935 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
936 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
937 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
938
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
939 /* Setup properties */
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
940 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
941 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
942
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
943 /**
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
944 * PurpleAccount::id
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
945 *
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
946 * 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
947 *
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
948 * 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
949 */
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
950 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
951 "id", "id",
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
952 "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
953 NULL,
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
954 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
955
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
956 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
957 "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
958 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
959
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
960 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
961 "Private Alias",
35058
506740af931c Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents: 35010
diff changeset
962 "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
963 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
964
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
965 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
966 "User information",
35058
506740af931c Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents: 35010
diff changeset
967 "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
968 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
969
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
970 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
971 "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
972 "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
973 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
974
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
975 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
976 "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
977 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
978
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
979 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
980 "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
981 "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
982 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
983
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
984 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
985 "Connection",
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
986 "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
987 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
988
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
989 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
990 "Protocol ID",
35058
506740af931c Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents: 35010
diff changeset
991 "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
992 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
993 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
994
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
995 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
996 "proxy-info", "proxy-info",
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
997 "The PurpleProxyInfo for this account.",
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
998 PURPLE_TYPE_PROXY_INFO,
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
999 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
1000
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
1001 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
1002 }
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1003
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
1004 /******************************************************************************
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1005 * 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
1006 *****************************************************************************/
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1007 PurpleAccount *
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1008 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
1009 PurpleAccount *account;
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1010 PurpleAccountManager *manager = NULL;
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1011
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1012 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
1013 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
1014
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1015 manager = purple_account_manager_get_default();
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1016 account = purple_account_manager_find(manager, username, protocol_id);
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1017 if(account != NULL) {
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1018 return account;
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1019 }
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1020
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1021 account = g_object_new(
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1022 PURPLE_TYPE_ACCOUNT,
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1023 "username", username,
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1024 "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
1025 "enabled", FALSE,
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1026 NULL);
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1027
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1028 return account;
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6368
diff changeset
1029 }
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
1030
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1031 const gchar *
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1032 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
1033 PurpleAccountPrivate *priv = NULL;
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1034
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1035 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
1036
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1037 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
1038
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1039 return priv->id;
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1040 }
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1041
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
1042 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
1043 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
1044 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1045 PurpleCredentialManager *manager = NULL;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1046 PurpleProtocol *protocol = NULL;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1047 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
1048
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1049 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
1050
41445
61d9b9e2b974 Remove the account error scrollbook from the blist as notifications have replaced it.
Gary Kramlich <grim@reaperworld.com>
parents: 41444
diff changeset
1051 purple_account_clear_current_error(account);
61d9b9e2b974 Remove the account error scrollbook from the blist as notifications have replaced it.
Gary Kramlich <grim@reaperworld.com>
parents: 41444
diff changeset
1052
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
1053 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
1054
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1055 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
1056 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
1057 "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
1058 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
1059 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
1060 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
40804
5496016b3c00 Port libpurple from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents: 40803
diff changeset
1062 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
1063 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
1064 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
1065
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1066 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
1067 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
1068 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
1069 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
1070 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
1071 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1072
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1074
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1075 manager = purple_credential_manager_get_default();
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1076 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
1077 purple_account_connect_got_password_cb,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1078 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1082 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
1083 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1084 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
1085
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1087
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
1091 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
1092 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1095 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
1096 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1098
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
1102 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
1103 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
1104
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1105 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
1106 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1107
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 void
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1109 purple_account_unregister(PurpleAccount *account,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1110 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
1111 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 PurpleCallbackBundle *cbb;
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1113 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
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 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
1118 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
1119
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 cbb = g_new0(PurpleCallbackBundle, 1);
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1121 cbb->account = account;
41314
0dc72eacd8bf Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41312
diff changeset
1122 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
1123 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
1124
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1125 manager = purple_credential_manager_get_default();
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1126 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
1127 purple_account_unregister_got_password_cb,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1128 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1132 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
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 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
1135 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
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 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
1138 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
1139 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
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 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
1142
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1144 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
1145 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
1146
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
1150
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1151 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
1152 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1154 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
1155 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
1156 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1157 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
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 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
1160
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1162 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
1163 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1166 purple_account_request_add(PurpleAccount *account, const char *remote_user,
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
1167 const char *alias, const char *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
1168 {
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
1169 PurpleAddContactRequest *request = NULL;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
1170 PurpleNotification *notification = NULL;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
1171 PurpleNotificationManager *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
1172
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1174 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
1175
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
1176 request = purple_add_contact_request_new(account, remote_user);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
1177 if(alias != NULL && *alias != '\0') {
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
1178 purple_add_contact_request_set_alias(request, alias);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
1179 }
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
1180
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
1181 if(message != NULL && *message != '\0') {
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
1182 purple_add_contact_request_set_message(request, message);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
1183 }
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
1184
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
1185 notification = purple_notification_new_from_add_contact_request(request);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
1186
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
1187 manager = purple_notification_manager_get_default();
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
1188 purple_notification_manager_add(manager, notification);
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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 void
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41500
diff changeset
1192 purple_account_request_close_with_account(PurpleAccount *account) {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41500
diff changeset
1193 PurpleNotificationManager *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
1194
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1196
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41500
diff changeset
1197 manager = purple_notification_manager_get_default();
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41500
diff changeset
1198 purple_notification_manager_remove_with_account(manager, 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
1199 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1202 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
1203 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
1204 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1206 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
1207 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
1208 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
1209 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
1210
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 /* 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
1212 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
1213
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1215 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
1216 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
1217
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1219 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
1220 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
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 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
1223 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
1224 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
1225 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
1226
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1228 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
1229
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1231 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
1232 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
1233 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
1234 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1237 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
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 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
1240 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
1241 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
1242 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
1243 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
1244 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
1245
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1247 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
1248
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1250 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
1251 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
1252
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1254
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1256 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
1257
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1259 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
1260 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
1261 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
1262 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
1263 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
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 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
1266 _("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
1267 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
1268 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
1269 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
1270 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
1271 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
1272
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1274 _("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
1275 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
1276 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
1277 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
1278 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
1279 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
1280
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1282 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
1283
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 /* 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
1285
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1287 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
1288 "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
1289 _("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
1290 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1294 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
1295 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1297 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
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 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
1300 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
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 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
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 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
1305 _("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
1306 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
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 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
1309 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
1310 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
1311 (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
1312 _("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
1313 _("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
1314 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
1315 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
1316 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1319 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
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 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
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 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
1324
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
1328 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
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 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
1331
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 /* 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
1335 * 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
1336 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
1337 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1340 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
1341 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1343
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1345
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1347
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 /*
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 * 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
1350 * 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
1351 */
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1353 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
1354
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1356 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
1357 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1359
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1361 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
1362 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
1363 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
1364 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
1365 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
1366
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1368 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1372 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
1373 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1375
9c7715998bbc Cleanup account.[ch] and status.[ch] 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_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
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 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
1379
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1381 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
1382
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1384
9c7715998bbc Cleanup account.[ch] and status.[ch] 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_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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1389 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1391
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
1395
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1397 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
1398
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1400 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
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 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
1403 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1406 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
1407 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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_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
1411 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
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 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
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 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
1416 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
1417
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1419
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1424 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
1425 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1431
1f1a3fbb2759 Make PurpleAccount take ownership of the connection that was set.
Gary Kramlich <grim@reaperworld.com>
parents: 41393
diff changeset
1432 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
1433 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
1434
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1439 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
1440 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1442
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1444
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1446 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
1447
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1449 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
1450
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1452 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 void
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1455 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
1456 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
1457 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
1458 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
1459
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1461
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1462 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
1463
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1464 was_enabled = priv->enabled;
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1465 priv->enabled = value;
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1466
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
1467 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
1468 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
1469 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
1470 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
1471 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
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_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
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 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
1476 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
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 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
1479 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
1480 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
1481 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
1482
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1483 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
1484 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1487 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
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 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
1490
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1492
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1494
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1495 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
1496 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
1497 properties[PROP_PROXY_INFO]);
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1498
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1499 purple_accounts_schedule_save();
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1500 }
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
1501 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1504 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
1505 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1507
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1509
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 = 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
1511 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
1512 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1515 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
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 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
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 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
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 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
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 /* 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
1524 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
1525 (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
1526
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 /* 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
1528 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
1529 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1532 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
1533 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
1534 {
40328
45e719e8d3bc Replace lists of PurpleAttr with GHashTable
qarkai <qarkai@gmail.com>
parents: 40327
diff changeset
1535 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
1536 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
1537
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 va_start(args, active);
40328
45e719e8d3bc Replace lists of PurpleAttr with GHashTable
qarkai <qarkai@gmail.com>
parents: 40327
diff changeset
1539 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
1540 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
1541 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
1542 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1546 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
1547 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
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 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
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 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
1552 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
1553
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1555 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
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 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
1558 "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
1559 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
1560 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
1561 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
1562 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1565 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
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 /*
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 * 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
1569 * 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
1570 */
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1572 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1575 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
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 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
1578 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1581 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
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 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
1584
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1586 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1589 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
1590 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1591 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
1592
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1593 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
1594
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1595 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
1596 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
1597
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1599 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
1600 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1603 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
1604 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
1608 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
1609
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1611
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1612 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
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_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
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 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
1619 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
1620
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1622 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
1623
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1624 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
1625
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1626 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
1627
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1628 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
1629 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
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 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
1632
9c7715998bbc Cleanup account.[ch] and status.[ch] 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_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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1637 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
1638 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
1639 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1641 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
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 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
1644 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
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 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
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 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
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 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
1651 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
1652
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1653 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
1654
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1656 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1659 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
1660 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1662 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
1663
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1664 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
1665 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
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 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
1668
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1669 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
1670
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1672 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
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 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
1675
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1676 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1680 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
1681 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1683 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1686 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
1687 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1689 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1692 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
1693 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1694 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
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 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
1698 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
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 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
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 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
1703
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1705 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
1706 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1709 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
1710 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1712
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1714
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1716 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
1717 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1720 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
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 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
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 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
1725
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1727 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
1728 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1731 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
1732 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1734
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1736
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1738 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
1739 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1742 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
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 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
1745
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1747
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1749 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
1750 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
40803
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1752 PurpleProtocol *
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1753 purple_account_get_protocol(PurpleAccount *account) {
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1754 PurpleAccountPrivate *priv = NULL;
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1755 PurpleProtocolManager *manager = NULL;
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1756
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1757 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
1758
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1759 priv = purple_account_get_instance_private(account);
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1760 manager = purple_protocol_manager_get_default();
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1761
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1762 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
1763 }
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1764
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
1765 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
1766 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
1767 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1769
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1771
40804
5496016b3c00 Port libpurple from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents: 40803
diff changeset
1772 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
1773
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1775 _(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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1779 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
1780 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1782
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1784
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1786 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
1787 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1790 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
1791 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1793 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
1794 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
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 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
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 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
1799 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
1800 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1803 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
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 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
1806 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
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 /* 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
1809 * 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
1810 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
1811 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1816 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
1817
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1819 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
1820 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1823 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1826 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
1827 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1829
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1831
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1833 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
1834 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 gboolean
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1837 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
1838 PurpleAccountPrivate *priv = NULL;
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1839
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
1840 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
1841
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1842 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
1843
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1844 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
1845 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1848 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
1849 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1851
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1853
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1855 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
1856 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1859 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
1860 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1862
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1864
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1866 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
1867 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1870 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
1871 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
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 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
1874 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
1875 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
1876 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
1877
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1879 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
1880
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1881 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
1882 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
1883
40052
cc03b5af25ea Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39897
diff changeset
1884 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
1885 /* 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
1886 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
1887 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
1888 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1889
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1890 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
1891
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1892 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
1893 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
1894
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1896 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
1897
39676
1e8394d47205 Add list parameter to all buddy list UI ops.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
1898 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
1899
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 /* 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
1901 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
1902 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
1903 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
1904 "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
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 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
1907 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1910 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
1911 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
1912 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1914 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
1915 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
1916 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
1917 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
1918 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
1919
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1921 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
1922
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1924 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
1925
40052
cc03b5af25ea Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39897
diff changeset
1926 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
1927 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
1928 /* 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
1929 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
1930 }
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
1931
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 /* 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
1933 * 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
1934 * 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
1935 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
1936 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
1937
40521
c4269b37a13a Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents: 40519
diff changeset
1938 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
1939 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
1940 }
c4269b37a13a Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents: 40519
diff changeset
1941
c4269b37a13a Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents: 40519
diff changeset
1942 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
1943 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
1944 }
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
1945
39676
1e8394d47205 Add list parameter to all buddy list UI ops.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
1946 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
1947
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1949 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
1950 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
1951 "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
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 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
1954 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
1955 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1958 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
1959 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
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 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
1962 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
1963 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
1964 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
1965
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1966 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
1967 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
1968
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1970 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
1971
40052
cc03b5af25ea Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39897
diff changeset
1972 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
1973 /* 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
1974 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
1975 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
1976 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1979
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1981 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
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 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
1984 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
1985
39676
1e8394d47205 Add list parameter to all buddy list UI ops.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
1986 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
1987
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1989 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
1990 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
1991 "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
1992 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1994 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1997 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
1998 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
1999 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2001 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
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 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
2012
40052
cc03b5af25ea Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39897
diff changeset
2013 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
2014 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
2015 /* 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
2016 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
2017 }
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
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 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
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 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
2022 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
2023
40521
c4269b37a13a Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents: 40519
diff changeset
2024 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
2025 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
2026 }
c4269b37a13a Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents: 40519
diff changeset
2027
c4269b37a13a Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents: 40519
diff changeset
2028 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
2029 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
2030 }
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
2031
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2033 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
2034 "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
2035 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2038
39676
1e8394d47205 Add list parameter to all buddy list UI ops.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
2039 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
2040
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2042 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2045 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
2046 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2048 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
2049 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
2050
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2052 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
2053 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
2054 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
2055 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
2056 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
2057 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
2058 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
2059 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
2060 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
2061 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 /* 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
2063 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
2064 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
2065 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
2066 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
2067 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
2068 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
2069 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2070 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
2071 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
2072 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2073 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
2074 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
2075 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
2076 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
2077 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
2078 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
2079 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2081 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
2082 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
2083 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 /* 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
2086 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
2087 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
2088 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2091 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
2092 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2094 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
2095 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
2096
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2098 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
2099 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 /* 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
2101 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
2102 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
2103 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
2104 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
2105 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
2106 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
2107 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2109 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
2110 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2112 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
2113 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
2114 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
2115 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
2116 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
2117 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
2118 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
2119 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
2120 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
2121 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
2122 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
2123 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
2124 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
2125 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2127 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
2128 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
2129 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 /* 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
2132 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
2133 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
2134 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2137 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
2138 {
39782
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39759
diff changeset
2139 PurpleAccountPrivate *priv = NULL;
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39759
diff changeset
2140
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39759
diff changeset
2141 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
2142
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39759
diff changeset
2143 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
2144 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
2145 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2146
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2148 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
2149 {
39782
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39759
diff changeset
2150 PurpleAccountPrivate *priv = NULL;
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39759
diff changeset
2151
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39759
diff changeset
2152 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
2153
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39759
diff changeset
2154 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
2155 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
2156 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2157
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2159 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
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 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
2162
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2164 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
2165 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
2166
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2168 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
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 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
2171 who = purple_normalize(account, who);
40052
cc03b5af25ea Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39897
diff changeset
2172 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
2173
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2175 who = purple_normalize(account, who);
40052
cc03b5af25ea Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39897
diff changeset
2176 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
2177
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2179 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
2180
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2182 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
2183 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2187 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
2188 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
2192
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2194 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
2195 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2198 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
2199 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
2203 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
2204
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2206
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2211 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
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 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
2214
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2216 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
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 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
2219 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
2223 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
2224 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2227 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2230 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
2231 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2233
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2235
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2237 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
2241 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
2242 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2245 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2248 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
2249 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2251
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2253
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2255 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
2256 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2259 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
2260 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
2261 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
2265 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
2266
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2268
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2269 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
2270 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2271
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2272 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
2273 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
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 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
2276
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2278
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2279 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
2280 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
2281 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2282
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2283 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
2284 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
2285 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
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 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
2288 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
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 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
2291 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
2292
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2294
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2296
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2298 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
2299
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2301
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2303 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2305 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
2306 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
2307 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
2308 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2310 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
2311
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2313 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
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 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
2316
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2318
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2320 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
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 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
2323
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2328 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
2329 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
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 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
2332 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
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 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
2335 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
2336
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
2340
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2342 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
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(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
2345
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2347 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2350 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
2351 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2353 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
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 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
2356 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
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 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
2359 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
2360 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
2361
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2362 if(PURPLE_IS_PROTOCOL_SERVER(protocol)) {
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2363 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
2364
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2365 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
2366 buddy, group, message);
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2367 }
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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2371 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
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 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
2374 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
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 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
2377 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
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 if (protocol) {
40783
4f197d3e42d6 Use g_list_copy_deep instead of manual copy/transform
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40708
diff changeset
2380 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
2381
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 /* 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
2383 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
2384
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2385 if(PURPLE_IS_PROTOCOL_SERVER(protocol)) {
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2386 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
2387 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
2388 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2391 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2395 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
2396 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
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 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
2399 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
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 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
2402 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
2403
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2404 if(PURPLE_IS_PROTOCOL_SERVER(protocol)) {
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2405 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
2406 gc, buddy, group);
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2407 }
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
2408 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2411 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
2412 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2414 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
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 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
2417 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
2418
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2419 if(PURPLE_IS_PROTOCOL_SERVER(protocol)) {
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2420 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
2421 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
2422 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2426 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
2427 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2429 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
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 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
2432 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
2433
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2434 if(PURPLE_IS_PROTOCOL_SERVER(protocol)) {
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2435 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
2436 gc, group);
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2437 }
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
2438 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2441 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
2442 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
2443 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
2444 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
2445 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
2446 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
2447
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
2448 /* 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
2449 * implement the change password stuff.
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
2450 */
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
2451 manager = purple_credential_manager_get_default();
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
2452 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
2453 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
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 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
2456 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
2457
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2458 if(PURPLE_IS_PROTOCOL_SERVER(protocol)) {
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2459 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
2460 gc, orig_pw, new_pw);
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2461 }
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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
2467 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
2468
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2470 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
2471
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2473 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
2474 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
2475 }
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
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 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
2478 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
2479 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
2480 }
4d3018b00ad4 Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
2481
4d3018b00ad4 Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
2482 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2486 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
2487 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2489
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2491 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2492
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2493 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
2494 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
2495 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2496 _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
2497 }

mercurial