libpurple/account.c

Fri, 25 Mar 2022 02:51:58 -0500

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Fri, 25 Mar 2022 02:51:58 -0500
changeset 41314
0dc72eacd8bf
parent 41312
c39de96b3daf
child 41318
56092ffeae95
permissions
-rw-r--r--

Replace PURPLE_CALLBACK by G_CALLBACK

Another straight search-and-replace for 'easy' review.

Testing Done:
Compile only.

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

20147
66f05a854eee applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents: 20093
diff changeset
1 /* purple
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
3 * Purple is the legal property of its developers, whose names are too numerous
8046
c581b20a47d6 [gaim-migrate @ 8730]
Sean Egan <seanegan@pidgin.im>
parents: 7956
diff changeset
4 * to list here. Please refer to the COPYRIGHT file distributed with this
c581b20a47d6 [gaim-migrate @ 8730]
Sean Egan <seanegan@pidgin.im>
parents: 7956
diff changeset
5 * source distribution.
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6368
diff changeset
6 *
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 * (at your option) any later version.
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 *
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 * GNU General Public License for more details.
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 *
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
19859
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19767
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 */
40441
f23c7e772667 Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
21
f23c7e772667 Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
22 #include <glib/gi18n-lib.h>
f23c7e772667 Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
23
5872
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5870
diff changeset
24 #include "internal.h"
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
25
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
26 #include "accounts.h"
11053
6d2abb51e586 [gaim-migrate @ 12991]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11042
diff changeset
27 #include "core.h"
5717
2f3a377de638 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents: 5711
diff changeset
28 #include "debug.h"
14758
13b9adc9efd2 [gaim-migrate @ 17448]
Sean Egan <seanegan@pidgin.im>
parents: 14724
diff changeset
29 #include "network.h"
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
30 #include "notify.h"
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31 #include "prefs.h"
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
32 #include "purpleaccountmanager.h"
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40521
diff changeset
33 #include "purpleaccountpresence.h"
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
34 #include "purpleconversationmanager.h"
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
35 #include "purplecredentialmanager.h"
40439
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40332
diff changeset
36 #include "purpleprivate.h"
40634
4d3018b00ad4 Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
37 #include "purpleprotocolclient.h"
40803
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
38 #include "purpleprotocolmanager.h"
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
39 #include "purpleprotocolserver.h"
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
40 #include "request.h"
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9720
diff changeset
41 #include "server.h"
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6368
diff changeset
42 #include "signals.h"
5717
2f3a377de638 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents: 5711
diff changeset
43 #include "util.h"
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44
39663
d3c442966920 Remove PurpleAccount->ui_data and accessors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39514
diff changeset
45 /**
d3c442966920 Remove PurpleAccount->ui_data and accessors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39514
diff changeset
46 * PurpleAccount:
d3c442966920 Remove PurpleAccount->ui_data and accessors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39514
diff changeset
47 *
d3c442966920 Remove PurpleAccount->ui_data and accessors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39514
diff changeset
48 * Structure representing an account.
d3c442966920 Remove PurpleAccount->ui_data and accessors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39514
diff changeset
49 */
d3c442966920 Remove PurpleAccount->ui_data and accessors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39514
diff changeset
50 struct _PurpleAccount
d3c442966920 Remove PurpleAccount->ui_data and accessors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39514
diff changeset
51 {
d3c442966920 Remove PurpleAccount->ui_data and accessors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39514
diff changeset
52 GObject gparent;
d3c442966920 Remove PurpleAccount->ui_data and accessors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39514
diff changeset
53 };
d3c442966920 Remove PurpleAccount->ui_data and accessors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39514
diff changeset
54
21287
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
55 typedef struct
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
56 {
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
57 gchar *id;
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
58
35470
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
59 char *username; /* The username. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
60 char *alias; /* How you appear to yourself. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
61 char *user_info; /* User information. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
62
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
63 char *buddy_icon_path; /* The buddy icon's non-cached path. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
64
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
65 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
66
34593
318dcc5ef8e8 Added reminder to replace protocol_id member of account by a GObject
Ankit Vani <a@nevitus.org>
parents: 34591
diff changeset
67 /*
318dcc5ef8e8 Added reminder to replace protocol_id member of account by a GObject
Ankit Vani <a@nevitus.org>
parents: 34591
diff changeset
68 * 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
69 * 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
70 */
35470
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
71 char *protocol_id; /* The ID of the protocol. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
72
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
73 PurpleConnection *gc; /* The connection handle. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
74 gboolean disconnecting; /* The account is currently disconnecting */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
75
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
76 GHashTable *settings; /* Protocol-specific settings. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
77 GHashTable *ui_settings; /* UI-specific settings. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
78
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
79 PurpleProxyInfo *proxy_info; /* Proxy information. This will be set */
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
80 /* to NULL when the account inherits */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
81 /* proxy settings from global prefs. */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
82
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
83 /*
35152
bedba98d98f2 Change this comment to say that we should use a single, good-enough data
Mark Doliner <mark@kingant.net>
parents: 35150
diff changeset
84 * TODO: Instead of linked lists for permit and deny, use a data
bedba98d98f2 Change this comment to say that we should use a single, good-enough data
Mark Doliner <mark@kingant.net>
parents: 35150
diff changeset
85 * structure that allows fast lookups AND decent performance when
bedba98d98f2 Change this comment to say that we should use a single, good-enough data
Mark Doliner <mark@kingant.net>
parents: 35150
diff changeset
86 * iterating through all items. Fast lookups should help performance
bedba98d98f2 Change this comment to say that we should use a single, good-enough data
Mark Doliner <mark@kingant.net>
parents: 35150
diff changeset
87 * for protocols like MSN, where all your buddies exist in your permit
bedba98d98f2 Change this comment to say that we should use a single, good-enough data
Mark Doliner <mark@kingant.net>
parents: 35150
diff changeset
88 * list therefore the permit list is large. Possibly GTree or
bedba98d98f2 Change this comment to say that we should use a single, good-enough data
Mark Doliner <mark@kingant.net>
parents: 35150
diff changeset
89 * GHashTable.
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
90 */
35470
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
91 GSList *permit; /* Permit list. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
92 GSList *deny; /* Deny list. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
93 PurpleAccountPrivacyType privacy_type; /* The permit/deny setting. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
94
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
95 GList *status_types; /* Status types. */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
96
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
97 PurplePresence *presence; /* Presence. */
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
98
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
99 PurpleAccountRegistrationCb registration_cb;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
100 void *registration_cb_user_data;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
101
35470
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
102 PurpleConnectionErrorInfo *current_error; /* Errors */
21287
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
103 } PurpleAccountPrivate;
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
104
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
105 typedef struct
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
106 {
5777
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
107 char *ui;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
108 GValue value;
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
109
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
110 } PurpleAccountSetting;
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
111
15537
5d7473f14c67 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evands@pidgin.im>
parents: 15482
diff changeset
112 typedef struct
5d7473f14c67 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evands@pidgin.im>
parents: 15482
diff changeset
113 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
114 PurpleAccountRequestType type;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
115 PurpleAccount *account;
15537
5d7473f14c67 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evands@pidgin.im>
parents: 15482
diff changeset
116 void *ui_handle;
20421
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
117 char *user;
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
118 gpointer userdata;
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
119 PurpleAccountRequestAuthorizationCb auth_cb;
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
120 PurpleAccountRequestAuthorizationCb deny_cb;
25113
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
121 guint ref;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
122 } PurpleAccountRequestInfo;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
123
33996
ca5e901a5311 Implemented a password caching system to limit problems linked to the
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33995
diff changeset
124 typedef struct
11249
efc82f3e1bd3 [gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11247
diff changeset
125 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
126 PurpleAccount *account;
41312
c39de96b3daf Replace PurpleCallback by GCallback
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41220
diff changeset
127 GCallback cb;
33996
ca5e901a5311 Implemented a password caching system to limit problems linked to the
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33995
diff changeset
128 gpointer data;
34115
a0f9b38226eb Better name for CbInfo, revert cosmetic changes not related to master password branch
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34111
diff changeset
129 } PurpleCallbackBundle;
33996
ca5e901a5311 Implemented a password caching system to limit problems linked to the
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33995
diff changeset
130
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
131 /* GObject Property enums */
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
132 enum
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
133 {
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
134 PROP_0,
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
135 PROP_ID,
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
136 PROP_USERNAME,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
137 PROP_PRIVATE_ALIAS,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
138 PROP_ENABLED,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
139 PROP_CONNECTION,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
140 PROP_PROTOCOL_ID,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
141 PROP_USER_INFO,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
142 PROP_BUDDY_ICON_PATH,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
143 PROP_REMEMBER_PASSWORD,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
144 PROP_LAST
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
145 };
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
146
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
147 static GParamSpec *properties[PROP_LAST];
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
148 static GList *handles = NULL;
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
149
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
150 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
151
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
152 /******************************************************************************
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
153 * 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
154 *****************************************************************************/
30740
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30708
diff changeset
155 static void
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
156 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
157 gpointer data)
10427
2ea1412bc75f [gaim-migrate @ 11679]
Mark Doliner <markdoliner@pidgin.im>
parents: 10426
diff changeset
158 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
159 PurpleCredentialManager *manager = PURPLE_CREDENTIAL_MANAGER(obj);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
160 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
161 GError *error = NULL;
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
162 gchar *password = NULL;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
163
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
164 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
165 &error);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
166
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
167 if(error != NULL) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
168 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
169 error->message);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
170 g_error_free(error);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
171 }
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
172
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
173 _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
174
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
175 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
176 }
c47c22006b0d Implemented a callback for a successful registration, supplying the username and password to the application when available, in the way explained by Sean.
Andreas Monitzer <am@adiumx.com>
parents: 17800
diff changeset
177
c47c22006b0d Implemented a callback for a successful registration, supplying the username and password to the application when available, in the way explained by Sean.
Andreas Monitzer <am@adiumx.com>
parents: 17800
diff changeset
178 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
179 purple_account_register(PurpleAccount *account)
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
180 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
181 PurpleCredentialManager *manager = NULL;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
182
34983
81638be26f41 Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents: 34955
diff changeset
183 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
184
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
185 purple_debug_info("account", "Registering account %s\n",
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
186 purple_account_get_username(account));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
187
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
188 manager = purple_credential_manager_get_default();
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
189 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
190 purple_account_register_got_password_cb,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
191 account);
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
192 }
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
193
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
194 static void
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
195 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
196 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
197 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
198 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
199 PurpleCallbackBundle *cbb = data;
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
200 PurpleAccountUnregistrationCb cb;
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
201 GError *error = NULL;
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
202 gchar *password = NULL;
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
203
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
204 cb = (PurpleAccountUnregistrationCb)cbb->cb;
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
205
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
206 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
207 &error);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
208
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
209 if(error != NULL) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
210 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
211 error->message);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
212
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
213 g_error_free(error);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
214 }
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
215
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
216 _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
217
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
218 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
219 g_free(cbb);
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
220 }
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
221
34992
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
222 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
223 {
34992
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
224 PurpleAccount *account;
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
225 gboolean succeeded;
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
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
228 static gboolean
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
229 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
230 {
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
231 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
232 PurpleAccountPrivate *priv;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
233
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
234 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
235
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
236 if (priv->registration_cb)
34992
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
237 (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
238 priv->registration_cb_user_data);
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
239
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
240 g_object_unref(closure->account);
aba8b8e624c2 Replaced array with closure struct for registration callback
Ankit Vani <a@nevitus.org>
parents: 34991
diff changeset
241 g_free(closure);
34991
63c14353a0f4 Manage refcounts in some libpurple callbacks
Ankit Vani <a@nevitus.org>
parents: 34990
diff changeset
242
34990
6e2b46ef6743 Add a timeout for calling registration callback.
Ankit Vani <a@nevitus.org>
parents: 34987
diff changeset
243 return FALSE;
6e2b46ef6743 Add a timeout for calling registration callback.
Ankit Vani <a@nevitus.org>
parents: 34987
diff changeset
244 }
6e2b46ef6743 Add a timeout for calling registration callback.
Ankit Vani <a@nevitus.org>
parents: 34987
diff changeset
245
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
246 static void
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
247 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
248 PurpleCredentialManager *manager = PURPLE_CREDENTIAL_MANAGER(obj);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
249 PurpleAccount *account = PURPLE_ACCOUNT(data);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
250 GError *error = NULL;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
251 gchar *password = NULL;
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 /* 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
254 * 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
255 * 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
256 */
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
257 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
258 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
259
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
260 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
261 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
262
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
263 /* 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
264 * 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
265 */
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
266 purple_debug_info("account",
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
267 "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
268 name,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
269 error != NULL ? error->message : "unknown error");
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
270 }
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
271
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
272 _purple_connection_new(account, FALSE, password);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
273
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
274 g_free(password);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
275 }
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
276
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
277 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
278 request_password_ok_cb(PurpleAccount *account, PurpleRequestFields *fields)
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
279 {
11042
d1ccf8d8a187 [gaim-migrate @ 12954]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11033
diff changeset
280 const char *entry;
d1ccf8d8a187 [gaim-migrate @ 12954]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11033
diff changeset
281 gboolean remember;
11985
d4a210fb43e9 [gaim-migrate @ 14278]
Mark Doliner <markdoliner@pidgin.im>
parents: 11982
diff changeset
282
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
283 entry = purple_request_fields_get_string(fields, "password");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
284 remember = purple_request_fields_get_bool(fields, "remember");
11985
d4a210fb43e9 [gaim-migrate @ 14278]
Mark Doliner <markdoliner@pidgin.im>
parents: 11982
diff changeset
285
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
286 if (!entry || !*entry)
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
287 {
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
288 purple_notify_error(account, NULL,
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
289 _("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
290 purple_request_cpar_from_account(account));
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
291 return;
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
292 }
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
293
33996
ca5e901a5311 Implemented a password caching system to limit problems linked to the
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33995
diff changeset
294 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
295
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
296 if(remember) {
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
297 PurpleCredentialManager *manager = NULL;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
298
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
299 manager = purple_credential_manager_get_default();
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
300
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
301 /* 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
302 * 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
303 * duplicate it for that callback.
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
304 */
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
305 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
306 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
307 NULL,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
308 request_password_write_cb,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
309 account);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
310 } else {
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
311 _purple_connection_new(account, FALSE, entry);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
312 }
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
313 }
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
314
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
315 static void
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
316 request_password_cancel_cb(PurpleAccount *account, PurpleRequestFields *fields)
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
317 {
30708
535bec1e66fb Standardize on "cancelled".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30456
diff changeset
318 /* Disable the account as the user has cancelled connecting */
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
319 purple_account_set_enabled(account, purple_core_get_ui(), FALSE);
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
320 }
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
321
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
322
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
323 static void
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
324 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
325 gpointer data)
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
326 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
327 PurpleCredentialManager *manager = PURPLE_CREDENTIAL_MANAGER(obj);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
328 PurpleAccount *account = PURPLE_ACCOUNT(data);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
329 PurpleProtocol *protocol = NULL;
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
330 GError *error = NULL;
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
331 gchar *password = NULL;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
332
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
333 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
334 &error);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
335
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
336 if(error != NULL) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
337 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
338 error->message);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
339
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
340 g_error_free(error);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
341 }
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
342
40804
5496016b3c00 Port libpurple from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents: 40803
diff changeset
343 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
344
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
345 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
346 !(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
347 !(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
348 {
34145
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
349 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
350 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
351 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
352 } else {
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
353 _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
354 }
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
355
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
356 g_free(password);
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
357 }
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
358
25113
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
359 static PurpleAccountRequestInfo *
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
360 purple_account_request_info_unref(PurpleAccountRequestInfo *info)
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
361 {
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
362 if (--info->ref)
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
363 return info;
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
364
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
365 /* TODO: This will leak info->user_data, but there is no callback to just clean that up */
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
366 g_free(info->user);
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
367 g_free(info);
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
368 return NULL;
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
369 }
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
370
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
371 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
372 purple_account_request_close_info(PurpleAccountRequestInfo *info)
15537
5d7473f14c67 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evands@pidgin.im>
parents: 15482
diff changeset
373 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
374 PurpleAccountUiOps *ops;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
375
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
376 ops = purple_accounts_get_ui_ops();
15537
5d7473f14c67 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evands@pidgin.im>
parents: 15482
diff changeset
377
5d7473f14c67 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evands@pidgin.im>
parents: 15482
diff changeset
378 if (ops != NULL && ops->close_account_request != NULL)
5d7473f14c67 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evands@pidgin.im>
parents: 15482
diff changeset
379 ops->close_account_request(info->ui_handle);
5d7473f14c67 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evands@pidgin.im>
parents: 15482
diff changeset
380
25113
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
381 purple_account_request_info_unref(info);
15537
5d7473f14c67 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evands@pidgin.im>
parents: 15482
diff changeset
382 }
5d7473f14c67 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evands@pidgin.im>
parents: 15482
diff changeset
383
20421
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
384 static void
33687
0819d40769c8 Add a message to the authorization callbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33686
diff changeset
385 request_auth_cb(const char *message, void *data)
20421
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
386 {
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
387 PurpleAccountRequestInfo *info = data;
22177
d3858cc821a8 This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <datallah@pidgin.im>
parents: 22104
diff changeset
388
d3858cc821a8 This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <datallah@pidgin.im>
parents: 22104
diff changeset
389 handles = g_list_remove(handles, info);
d3858cc821a8 This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <datallah@pidgin.im>
parents: 22104
diff changeset
390
29046
1cae96b8e674 *** Plucked rev 0707f870a510922ae86ef379b5f01efa76d01402 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <datallah@pidgin.im>
parents: 28764
diff changeset
391 if (info->auth_cb != NULL)
33687
0819d40769c8 Add a message to the authorization callbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33686
diff changeset
392 info->auth_cb(message, info->userdata);
22177
d3858cc821a8 This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <datallah@pidgin.im>
parents: 22104
diff changeset
393
20421
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
394 purple_signal_emit(purple_accounts_get_handle(),
33688
9454bda83147 Add response message to authorization signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33687
diff changeset
395 "account-authorization-granted", info->account, info->user, message);
22177
d3858cc821a8 This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <datallah@pidgin.im>
parents: 22104
diff changeset
396
25113
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
397 purple_account_request_info_unref(info);
20421
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
398 }
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
399
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
400 static void
33687
0819d40769c8 Add a message to the authorization callbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33686
diff changeset
401 request_deny_cb(const char *message, void *data)
20421
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
402 {
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
403 PurpleAccountRequestInfo *info = data;
22177
d3858cc821a8 This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <datallah@pidgin.im>
parents: 22104
diff changeset
404
d3858cc821a8 This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <datallah@pidgin.im>
parents: 22104
diff changeset
405 handles = g_list_remove(handles, info);
d3858cc821a8 This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <datallah@pidgin.im>
parents: 22104
diff changeset
406
29046
1cae96b8e674 *** Plucked rev 0707f870a510922ae86ef379b5f01efa76d01402 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <datallah@pidgin.im>
parents: 28764
diff changeset
407 if (info->deny_cb != NULL)
33687
0819d40769c8 Add a message to the authorization callbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33686
diff changeset
408 info->deny_cb(message, info->userdata);
22177
d3858cc821a8 This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <datallah@pidgin.im>
parents: 22104
diff changeset
409
20421
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
410 purple_signal_emit(purple_accounts_get_handle(),
33688
9454bda83147 Add response message to authorization signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33687
diff changeset
411 "account-authorization-denied", info->account, info->user, message);
22177
d3858cc821a8 This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <datallah@pidgin.im>
parents: 22104
diff changeset
412
25113
eacb566127a7 Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25079
diff changeset
413 purple_account_request_info_unref(info);
20421
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
414 }
e6c82f6c2485 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20379
diff changeset
415
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
416 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
417 change_password_cb(PurpleAccount *account, PurpleRequestFields *fields)
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
418 {
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
419 const char *orig_pass, *new_pass_1, *new_pass_2;
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
420
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
421 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
422 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
423 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
424
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
425 if (g_utf8_collate(new_pass_1, new_pass_2))
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
426 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
427 purple_notify_error(account, NULL,
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
428 _("New passwords do not match."), NULL,
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
429 purple_request_cpar_from_account(account));
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
430
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
431 return;
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
432 }
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
433
22854
0002c0556d57 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22484
diff changeset
434 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
435 (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
436 (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
437 (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
438 (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
439 (new_pass_2 == NULL || *new_pass_2 == '\0')))
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
440 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
441 purple_notify_error(account, NULL,
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
442 _("Fill out all fields completely."), NULL,
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
443 purple_request_cpar_from_account(account));
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
444 return;
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
445 }
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
446
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
447 purple_account_change_password(account, orig_pass, new_pass_1);
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
448 }
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
449
7067
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
450 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
451 set_user_info_cb(PurpleAccount *account, const char *user_info)
7067
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
452 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
453 PurpleConnection *gc;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
454
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
455 purple_account_set_user_info(account, user_info);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
456 gc = purple_account_get_connection(account);
35499
c4c5e0a670b1 Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
457 purple_serv_set_info(gc, user_info);
7067
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
458 }
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
459
34582
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
460 static void
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
461 delete_setting(void *data)
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
462 {
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
463 PurpleAccountSetting *setting = (PurpleAccountSetting *)data;
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
464
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
465 g_free(setting->ui);
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
466 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
467
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
468 g_free(setting);
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
469 }
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
470
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
471 static GHashTable *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
472 get_ui_settings_table(PurpleAccount *account, const char *ui)
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
473 {
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
474 GHashTable *table;
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
475 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
476
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
477 table = g_hash_table_lookup(priv->ui_settings, ui);
5979
d51d697d27fb [gaim-migrate @ 6426]
Christian Hammond <chipx86@chipx86.com>
parents: 5977
diff changeset
478
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
479 if (table == NULL) {
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
480 table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
5794
ebdbb7dc6658 [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5792
diff changeset
481 delete_setting);
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
482 g_hash_table_insert(priv->ui_settings, g_strdup(ui), table);
5779
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
483 }
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
484
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
485 return table;
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
486 }
8c8b8c8139c2 [gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents: 5777
diff changeset
487
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
488 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
489 purple_account_get_state(PurpleAccount *account)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
490 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
491 PurpleConnection *gc;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
492
34983
81638be26f41 Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents: 34955
diff changeset
493 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
494
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
495 gc = purple_account_get_connection(account);
11251
e38d86958a63 [gaim-migrate @ 13420]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11249
diff changeset
496 if (!gc)
34746
dc9c911dbd35 Started GObjectification of PurpleConnection.
Ankit Vani <a@nevitus.org>
parents: 34745
diff changeset
497 return PURPLE_CONNECTION_DISCONNECTED;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
498
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
499 return purple_connection_get_state(gc);
11251
e38d86958a63 [gaim-migrate @ 13420]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11249
diff changeset
500 }
e38d86958a63 [gaim-migrate @ 13420]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11249
diff changeset
501
35458
385156e1b493 Fix some gtk-doc warnings from account to connection
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
502 /*
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
503 * 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
504 * 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
505 */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
506 static void
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
507 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
508 {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
509 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
510 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
511
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
512 /* 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
513 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
514 char *person = list->data;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
515 list = list->next;
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
516 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
517 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
518 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
519
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
520 /* 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
521 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
522 while (list != NULL)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
523 {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
524 PurpleBuddy *buddy = list->data;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
525 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
526
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
527 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
528 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
529 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
530 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
531 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
532
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
533 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
534 _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
535 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
536 {
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
537 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
538 PurpleAccountPrivate *priv;
b8c7242bd6a2 I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22357
diff changeset
539
34983
81638be26f41 Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents: 34955
diff changeset
540 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
541 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
542
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
543 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
544
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
545 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
546 return;
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
547
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
548 priv->current_error = new_err;
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
549
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
550 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
551 "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
552 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
553 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
554
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
555 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
556 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
557
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
558 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
559 }
5ce063b1c3a7 Extract setting an account's current error to a static function. In the
Will Thompson <resiak@pidgin.im>
parents: 21311
diff changeset
560
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
561 /******************************************************************************
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
562 * 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
563 *****************************************************************************/
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
564 static PurpleXmlNode *
38745
f4376b1f4682 A ton more of introspection cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 38620
diff changeset
565 proxy_settings_to_xmlnode(const PurpleProxyInfo *proxy_info)
5710
3c2bf5725bb0 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5707
diff changeset
566 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
567 PurpleXmlNode *node, *child;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
568 PurpleProxyType proxy_type;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
569 const char *value;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
570 int int_value;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
571 char buf[21];
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
572
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
573 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
574
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
575 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
576
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
577 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
578 purple_xmlnode_insert_data(child,
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
579 (proxy_type == PURPLE_PROXY_USE_GLOBAL ? "global" :
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
580 proxy_type == PURPLE_PROXY_NONE ? "none" :
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
581 proxy_type == PURPLE_PROXY_HTTP ? "http" :
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
582 proxy_type == PURPLE_PROXY_SOCKS4 ? "socks4" :
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
583 proxy_type == PURPLE_PROXY_SOCKS5 ? "socks5" :
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
584 proxy_type == PURPLE_PROXY_TOR ? "tor" :
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
585 proxy_type == PURPLE_PROXY_USE_ENVVAR ? "envvar" : "unknown"), -1);
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
586
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
587 if ((value = purple_proxy_info_get_host(proxy_info)) != NULL)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
588 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
589 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
590 purple_xmlnode_insert_data(child, value, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
591 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
592
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
593 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
594 {
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
595 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
596 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
597 purple_xmlnode_insert_data(child, buf, -1);
34581
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 if ((value = purple_proxy_info_get_username(proxy_info)) != NULL)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
601 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
602 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
603 purple_xmlnode_insert_data(child, value, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
604 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
605
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
606 if ((value = purple_proxy_info_get_password(proxy_info)) != NULL)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
607 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
608 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
609 purple_xmlnode_insert_data(child, value, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
610 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
611
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
612 return node;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
613 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
614
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
615 static PurpleXmlNode *
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
616 current_error_to_xmlnode(PurpleConnectionErrorInfo *err)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
617 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
618 PurpleXmlNode *node, *child;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
619 char type_str[3];
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
620
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
621 node = purple_xmlnode_new("current_error");
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
622
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
623 if(err == NULL)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
624 return node;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
625
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
626 /* 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
627 * restart.
21300
1c23e08cb824 Document exactly how long the PurpleConnectionErrorInfo pointers given out by
Will Thompson <resiak@pidgin.im>
parents: 21298
diff changeset
628 */
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
629 if(!purple_connection_error_is_fatal (err->type))
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
630 return node;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
631
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
632 child = purple_xmlnode_new_child(node, "type");
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
633 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
634 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
635
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
636 child = purple_xmlnode_new_child(node, "description");
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
637 if(err->description) {
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
638 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
639 if(utf8ized == NULL) {
974dbfd7e52f Remove and replace a number of the purple utility functions
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
640 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
641 }
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
642 purple_xmlnode_insert_data(child, utf8ized, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
643 g_free(utf8ized);
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
644 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
645
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
646 return node;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
647 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
648
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
649 static void
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
650 setting_to_xmlnode(gpointer key, gpointer value, gpointer user_data)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
651 {
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
652 const char *name;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
653 PurpleAccountSetting *setting;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
654 PurpleXmlNode *node, *child;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
655 char buf[21];
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
656
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
657 name = (const char *)key;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
658 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
659 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
660
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
661 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
662 purple_xmlnode_set_attrib(child, "name", name);
34581
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 (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
665 purple_xmlnode_set_attrib(child, "type", "int");
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
666 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
667 purple_xmlnode_insert_data(child, buf, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
668 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
669 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
670 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
671 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
672 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
673 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
674 purple_xmlnode_set_attrib(child, "type", "bool");
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
675 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
676 purple_xmlnode_insert_data(child, buf, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
677 }
6368
ab9f99269dfe [gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents: 6367
diff changeset
678 }
ab9f99269dfe [gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents: 6367
diff changeset
679
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
680 static void
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
681 ui_setting_to_xmlnode(gpointer key, gpointer value, gpointer user_data)
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
682 {
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
683 const char *ui;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
684 GHashTable *table;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
685 PurpleXmlNode *node, *child;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
686
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
687 ui = (const char *)key;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
688 table = (GHashTable *)value;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
689 node = (PurpleXmlNode *)user_data;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
690
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
691 if (g_hash_table_size(table) > 0)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
692 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
693 child = purple_xmlnode_new_child(node, "settings");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
694 purple_xmlnode_set_attrib(child, "ui", ui);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
695 g_hash_table_foreach(table, setting_to_xmlnode, child);
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
696 }
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
697 }
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
698
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
699 PurpleXmlNode *
35178
7c775624f964 Move (_)purple_account_to_xmlnode to internal.h
Ankit Vani <a@nevitus.org>
parents: 35152
diff changeset
700 _purple_account_to_xmlnode(PurpleAccount *account)
6368
ab9f99269dfe [gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents: 6367
diff changeset
701 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
702 PurpleXmlNode *node, *child;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
703 const char *tmp;
38745
f4376b1f4682 A ton more of introspection cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 38620
diff changeset
704 const 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
705 PurpleAccountPrivate *priv = purple_account_get_instance_private(account);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
706
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
707 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
708
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
709 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
710 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
711 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
712 }
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
713
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
714 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
715 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
716
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
717 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
718 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
719
34589
428e92c79631 Renamed purple_account_[get,set]_alias to purple_account[get,set]_private_alias.
Ankit Vani <a@nevitus.org>
parents: 34582
diff changeset
720 if ((tmp = purple_account_get_private_alias(account)) != NULL)
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
721 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
722 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
723 purple_xmlnode_insert_data(child, tmp, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
724 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
725
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
726 if ((tmp = purple_account_get_user_info(account)) != NULL)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
727 {
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
728 /* 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
729 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
730 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
731 }
34c1a17a91d7 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18190
diff changeset
732
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
733 if (g_hash_table_size(priv->settings) > 0)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
734 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
735 child = purple_xmlnode_new_child(node, "settings");
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
736 g_hash_table_foreach(priv->settings, setting_to_xmlnode, child);
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
737 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
738
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
739 if (g_hash_table_size(priv->ui_settings) > 0)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
740 {
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
741 g_hash_table_foreach(priv->ui_settings, ui_setting_to_xmlnode, node);
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
742 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
743
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
744 if ((proxy_info = purple_account_get_proxy_info(account)) != NULL)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
745 {
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
746 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
747 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
748 }
34c1a17a91d7 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18190
diff changeset
749
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
750 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
751 purple_xmlnode_insert_child(node, child);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
752
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
753 return node;
5710
3c2bf5725bb0 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5707
diff changeset
754 }
3c2bf5725bb0 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5707
diff changeset
755
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
756 /******************************************************************************
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
757 * Helpers
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
758 *****************************************************************************/
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
759 static void
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
760 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
761 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
762
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
763 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
764 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
765
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
766 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
767 }
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
768
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
769 /******************************************************************************
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
770 * 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
771 *****************************************************************************/
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
772 static void
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
773 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
774 GParamSpec *pspec)
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
775 {
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
776 PurpleAccount *account = PURPLE_ACCOUNT(obj);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
777
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
778 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
779 case PROP_ID:
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
780 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
781 break;
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
782 case PROP_USERNAME:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
783 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
784 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
785 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
786 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
787 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
788 case PROP_ENABLED:
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
789 purple_account_set_enabled(account, purple_core_get_ui(),
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
790 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
791 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
792 case PROP_CONNECTION:
34753
b2c73469c1be GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents: 34751
diff changeset
793 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
794 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
795 case PROP_PROTOCOL_ID:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
796 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
797 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
798 case PROP_USER_INFO:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
799 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
800 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
801 case PROP_BUDDY_ICON_PATH:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
802 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
803 g_value_get_string(value));
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
804 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
805 case PROP_REMEMBER_PASSWORD:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
806 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
807 g_value_get_boolean(value));
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
808 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
809 default:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
810 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
811 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
812 }
5710
3c2bf5725bb0 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5707
diff changeset
813 }
3c2bf5725bb0 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5707
diff changeset
814
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
815 static void
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
816 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
817 GParamSpec *pspec)
5580
a5a3e6dfb409 [gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents: 5574
diff changeset
818 {
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
819 PurpleAccount *account = PURPLE_ACCOUNT(obj);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
820
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
821 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
822 case PROP_ID:
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
823 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
824 break;
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
825 case PROP_USERNAME:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
826 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
827 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
828 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
829 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
830 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
831 case PROP_ENABLED:
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
832 g_value_set_boolean(value, purple_account_get_enabled(account,
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
833 purple_core_get_ui()));
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
834 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
835 case PROP_CONNECTION:
34753
b2c73469c1be GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents: 34751
diff changeset
836 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
837 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
838 case PROP_PROTOCOL_ID:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
839 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
840 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
841 case PROP_USER_INFO:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
842 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
843 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
844 case PROP_BUDDY_ICON_PATH:
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
845 g_value_set_string(value,
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
846 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
847 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
848 case PROP_REMEMBER_PASSWORD:
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
849 g_value_set_boolean(value,
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
850 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
851 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
852 default:
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
853 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
854 break;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
855 }
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
856 }
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
857
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
858 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
859 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
860 {
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
861 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
862
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
863 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
864 g_free, delete_setting);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
865 priv->ui_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
866 g_free, (GDestroyNotify)g_hash_table_destroy);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
867
34590
9da48e98a77a Renamed PurpleAccount's private member perm_deny to privacy_type
Ankit Vani <a@nevitus.org>
parents: 34589
diff changeset
868 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
869 }
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
870
34686
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
871 static void
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
872 purple_account_constructed(GObject *object)
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
873 {
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
874 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
875 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
876 gchar *username, *protocol_id;
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36364
diff changeset
877 PurpleProtocol *protocol = NULL;
40804
5496016b3c00 Port libpurple from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents: 40803
diff changeset
878 PurpleProtocolManager *manager = NULL;
34686
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
879 PurpleStatusType *status_type;
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
880
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
881 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
882
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
883 /* 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
884 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
885 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
886
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
887 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
888
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
889 g_free(uuid);
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
890 }
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
891
34686
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
892 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
893 "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
894 "protocol-id", &protocol_id,
34686
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
895 NULL);
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
896
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
897 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
898 account);
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
899
40804
5496016b3c00 Port libpurple from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents: 40803
diff changeset
900 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
901 protocol = purple_protocol_manager_find(manager, protocol_id);
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36364
diff changeset
902 if (protocol == NULL) {
34769
427725f8ed54 Free strings received from g_object_get
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
903 g_free(username);
427725f8ed54 Free strings received from g_object_get
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
904 g_free(protocol_id);
5580
a5a3e6dfb409 [gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents: 5574
diff changeset
905 return;
a5a3e6dfb409 [gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents: 5574
diff changeset
906 }
a5a3e6dfb409 [gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents: 5574
diff changeset
907
36720
465f02116328 Refactored account, blistnodetypes, buddylist, connection to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
908 purple_account_set_status_types(account,
40813
71305a7d7423 Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents: 40804
diff changeset
909 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
910
34844
e341dbc04539 Refactored plugins, account, blistnodetypes to use the GObject presence API
Ankit Vani <a@nevitus.org>
parents: 34838
diff changeset
911 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
912
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
913 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
914 PURPLE_STATUS_AVAILABLE);
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
915 if (status_type != NULL)
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
916 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
917 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
918 TRUE);
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
919 else
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
920 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
921 "offline",
61cb35479ea9 Moved purple_account_constructed() above dispose and finalize
Ankit Vani <a@nevitus.org>
parents: 34685
diff changeset
922 TRUE);
34769
427725f8ed54 Free strings received from g_object_get
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
923
427725f8ed54 Free strings received from g_object_get
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
924 g_free(username);
427725f8ed54 Free strings received from g_object_get
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
925 g_free(protocol_id);
5580
a5a3e6dfb409 [gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents: 5574
diff changeset
926 }
5573
633880e3f137 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5565
diff changeset
927
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
928 static void
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
929 purple_account_dispose(GObject *object)
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
930 {
35512
8d6f1349b57a Fix crash on wrong password (backout 0f0d6ae2fb77)
Ankit Vani <a@nevitus.org>
parents: 35499
diff changeset
931 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
932 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
933
8d6f1349b57a Fix crash on wrong password (backout 0f0d6ae2fb77)
Ankit Vani <a@nevitus.org>
parents: 35499
diff changeset
934 if (!purple_account_is_disconnected(account))
8d6f1349b57a Fix crash on wrong password (backout 0f0d6ae2fb77)
Ankit Vani <a@nevitus.org>
parents: 35499
diff changeset
935 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
936
894c29e33300 Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
937 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
938 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
939 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
940 }
894c29e33300 Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
941
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
942 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
943 }
894c29e33300 Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
944
894c29e33300 Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
945 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
946 purple_account_finalize(GObject *object)
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
947 {
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
948 GList *l;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
949 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
950 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
951 PurpleConversationManager *manager = NULL;
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
952
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
953 purple_debug_info("account", "Destroying account %p\n", account);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
954 purple_signal_emit(purple_accounts_get_handle(), "account-destroying",
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
955 account);
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
956
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
957 manager = purple_conversation_manager_get_default();
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
958 l = purple_conversation_manager_get_all(manager);
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
959 while(l != NULL) {
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
960 PurpleConversation *conv = PURPLE_CONVERSATION(l->data);
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
961
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
962 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
963 purple_conversation_set_account(conv, NULL);
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
964 }
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
965
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
966 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
967 }
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
968
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
969 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
970
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
971 if (priv->proxy_info)
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
972 purple_proxy_info_destroy(priv->proxy_info);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
973
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
974 if (priv->current_error) {
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
975 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
976 g_free(priv->current_error);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
977 }
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
978
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
979 g_free(priv->username);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
980 g_free(priv->alias);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
981 g_free(priv->user_info);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
982 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
983 g_free(priv->protocol_id);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
984
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
985 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
986 g_hash_table_destroy(priv->ui_settings);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
987
40052
cc03b5af25ea Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39897
diff changeset
988 g_slist_free_full(priv->deny, g_free);
cc03b5af25ea Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39897
diff changeset
989 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
990
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
991 G_OBJECT_CLASS(purple_account_parent_class)->finalize(object);
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
992 }
5874
5e19273d3c6f [gaim-migrate @ 6306]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
993
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
994 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
995 purple_account_class_init(PurpleAccountClass *klass)
11053
6d2abb51e586 [gaim-migrate @ 12991]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11042
diff changeset
996 {
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
997 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
998
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
999 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
1000 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
1001 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
1002
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1003 /* Setup properties */
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1004 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
1005 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
1006
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1007 /**
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1008 * PurpleAccount::id
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1009 *
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1010 * 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
1011 *
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1012 * 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
1013 */
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1014 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
1015 "id", "id",
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1016 "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
1017 NULL,
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1018 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
1019
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1020 properties[PROP_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
1021 "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
1022 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
1023
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1024 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
1025 "Private Alias",
35058
506740af931c Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents: 35010
diff changeset
1026 "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
1027 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
1028
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1029 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
1030 "User information",
35058
506740af931c Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents: 35010
diff changeset
1031 "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
1032 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
1033
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1034 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
1035 "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
1036 "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
1037 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
1038
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1039 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
1040 "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
1041 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
1042
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1043 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
1044 "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
1045 "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
1046 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
1047
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1048 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
1049 "Connection",
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1050 "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
1051 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
1052
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
1053 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
1054 "Protocol ID",
35058
506740af931c Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents: 35010
diff changeset
1055 "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
1056 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
1057 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
1058
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
1059 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
1060 }
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1061
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
1062 /******************************************************************************
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 * 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
1064 *****************************************************************************/
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1065 PurpleAccount *
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1066 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
1067 PurpleAccount *account;
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1068 PurpleAccountManager *manager = NULL;
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1069
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1070 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
1071 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
1072
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1073 manager = purple_account_manager_get_default();
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1074 account = purple_account_manager_find(manager, username, protocol_id);
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1075 if(account != NULL) {
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1076 return account;
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1077 }
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1078
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1079 account = g_object_new(
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1080 PURPLE_TYPE_ACCOUNT,
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1081 "username", username,
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1082 "protocol-id", protocol_id,
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1083 NULL);
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1084
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1085 return account;
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6368
diff changeset
1086 }
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
1087
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1088 const gchar *
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1089 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
1090 PurpleAccountPrivate *priv = NULL;
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1091
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1092 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
1093
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1094 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
1095
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1096 return priv->id;
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1097 }
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
1098
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
1099 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
1100 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
1101 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1102 PurpleCredentialManager *manager = NULL;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1103 PurpleProtocol *protocol = NULL;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1104 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
1105
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
1109
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1110 if (!purple_account_get_enabled(account, purple_core_get_ui())) {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1111 purple_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
1112 "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
1113 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
1114 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
1115 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
40804
5496016b3c00 Port libpurple from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents: 40803
diff changeset
1117 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
1118 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
1119 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
1120
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1121 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
1122 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
1123 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
1124 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
1125 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
1126 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1127
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1128 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
1129
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1130 manager = purple_credential_manager_get_default();
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1131 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
1132 purple_account_connect_got_password_cb,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1133 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
1134 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1135
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1136 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
1137 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
1138 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
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 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
1144
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1146 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
1147 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1150 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
1151 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
1155
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1157 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
1158 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
1159
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1160 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
1161 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1162
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1163 void
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1164 purple_account_unregister(PurpleAccount *account,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1165 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
1166 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1167 PurpleCallbackBundle *cbb;
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1168 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
1169
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1170 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
1171
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1172 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
1173 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
1174
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 cbb = g_new0(PurpleCallbackBundle, 1);
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1176 cbb->account = account;
41314
0dc72eacd8bf Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41312
diff changeset
1177 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
1178 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
1179
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1180 manager = purple_credential_manager_get_default();
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1181 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
1182 purple_account_unregister_got_password_cb,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1183 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
1184 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1185
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1186 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
1187 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
1188 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1190 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
1191 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
1192
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1193 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
1194 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
1195 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
1196
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1197 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
1198
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1199 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
1200 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
1201 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
1202
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
1206 g_object_unref(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
1207 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
1208
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1209 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1213 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
1214 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1215 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
1216
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1217 g_return_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
1218
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1220 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1224 purple_account_notify_added(PurpleAccount *account, const char *remote_user,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1225 const char *id, const char *alias,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1226 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
1227 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 PurpleAccountUiOps *ui_ops;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
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 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
1231 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
1232
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 if (ui_ops != NULL && ui_ops->notify_added != NULL)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1236 ui_ops->notify_added(account, remote_user, id, alias, message);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1237 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1240 purple_account_request_add(PurpleAccount *account, const char *remote_user,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1241 const char *id, const char *alias,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1242 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
1243 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 PurpleAccountUiOps *ui_ops;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
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(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
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 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
1250
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 if (ui_ops != NULL && ui_ops->request_add != NULL)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1252 ui_ops->request_add(account, remote_user, id, alias, message);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1253 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1256 purple_account_request_authorization(PurpleAccount *account, const char *remote_user,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1257 const char *id, const char *alias, const char *message, gboolean on_list,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1258 PurpleAccountRequestAuthorizationCb auth_cb, PurpleAccountRequestAuthorizationCb deny_cb, void *user_data)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1259 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 PurpleAccountUiOps *ui_ops;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1261 PurpleAccountRequestInfo *info;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1262 int plugin_return;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1263 char *response = NULL;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1264
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1265 g_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
1266 g_return_val_if_fail(remote_user != NULL, NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1267
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1269
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 plugin_return = GPOINTER_TO_INT(
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1271 purple_signal_emit_return_1(
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1272 purple_accounts_get_handle(),
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1273 "account-authorization-requested",
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1274 account, remote_user, message, &response
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1275 ));
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 switch (plugin_return)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1278 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1279 case PURPLE_ACCOUNT_RESPONSE_IGNORE:
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1280 g_free(response);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1281 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
1282 case PURPLE_ACCOUNT_RESPONSE_ACCEPT:
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1283 if (auth_cb != NULL)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1284 auth_cb(response, user_data);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1285 g_free(response);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1286 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
1287 case PURPLE_ACCOUNT_RESPONSE_DENY:
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1288 if (deny_cb != NULL)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1289 deny_cb(response, user_data);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1290 g_free(response);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1291 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 g_free(response);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
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 if (ui_ops != NULL && ui_ops->request_authorize != NULL) {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1297 info = g_new0(PurpleAccountRequestInfo, 1);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1298 info->type = PURPLE_ACCOUNT_REQUEST_AUTHORIZATION;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1299 info->account = account;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1300 info->auth_cb = auth_cb;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1301 info->deny_cb = deny_cb;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1302 info->userdata = user_data;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1303 info->user = g_strdup(remote_user);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1304 info->ref = 2; /* We hold an extra ref to make sure info remains valid
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1305 if any of the callbacks are called synchronously. We
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1306 unref it after the function call */
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
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 info->ui_handle = ui_ops->request_authorize(account, remote_user, id, alias, message,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1309 on_list, request_auth_cb, request_deny_cb, info);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1310
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1311 info = purple_account_request_info_unref(info);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1312 if (info) {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1313 handles = g_list_append(handles, info);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1314 return info->ui_handle;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1315 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1316 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1319 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1322 purple_account_request_close_with_account(PurpleAccount *account)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1323 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 GList *l, *l_next;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1325
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1327
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1328 for (l = handles; l != NULL; l = l_next) {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1329 PurpleAccountRequestInfo *info = l->data;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1330
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 l_next = l->next;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1332
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 if (info->account == account) {
40079
a37a1e349491 Replace g_[s]list_remove with g_[s]list_delete_link.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40052
diff changeset
1334 handles = g_list_delete_link(handles, l);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1335 purple_account_request_close_info(info);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1336 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1341 purple_account_request_close(void *ui_handle)
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1342 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1343 GList *l, *l_next;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1344
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 g_return_if_fail(ui_handle != NULL);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1346
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1347 for (l = handles; l != NULL; l = l_next) {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1348 PurpleAccountRequestInfo *info = l->data;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1349
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 l_next = l->next;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
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 (info->ui_handle == ui_handle) {
40079
a37a1e349491 Replace g_[s]list_remove with g_[s]list_delete_link.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40052
diff changeset
1353 handles = g_list_delete_link(handles, l);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1354 purple_account_request_close_info(info);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1355 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1356 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1360 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
1361 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
1362 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1364 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
1365 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
1366 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
1367 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
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 /* 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
1370 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
1371
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1373 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
1374 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
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 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
1377 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
1378 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
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 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
1381 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
1382 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
1383 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
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 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
1386 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
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 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
1389 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
1390 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
1391 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
1392 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1395 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
1396 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1398 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
1399 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
1400 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
1401 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
1402 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
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 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
1405 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
1406
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1408 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
1409 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
1410
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
1414 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
1415
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1417 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
1418 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
1419 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
1420 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
1421 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
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 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
1424 _("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
1425 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
1426 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
1427 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
1428 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
1429 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
1430
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1431 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
1432 _("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
1433 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
1434 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
1435 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
1436 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
1437 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
1438
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1440 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
1441
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 /* 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
1443
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1445 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
1446 "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
1447 _("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
1448 account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1449 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1450
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1452 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
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 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
1455 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
1456
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1458 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
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 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
1461
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1462 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
1463 _("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
1464 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
1465
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1466 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
1467 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
1468 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
1469 (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
1470 _("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
1471 _("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
1472 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
1473 account);
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1477 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
1478 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1480
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1481 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
1482
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1483 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
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 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
1486 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
1487
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1489
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1491
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 /* 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
1493 * 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
1494 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
1495 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1496
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1497 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
1498 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
1499 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1500 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
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 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
1503
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 /*
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 * 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
1508 * 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
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 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
1511 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
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 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
1514 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
1515 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1516 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
1517
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1519 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
1520 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
1521 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
1522 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
1523 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
1524
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1525 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
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 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1530 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
1531 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1533
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1534 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
1535
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
1539 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
1540
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1541 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
1542
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1546 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
1547 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1549
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1551
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1552 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
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 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
1555 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
1556
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1557 g_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
1558 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
1559
9c7715998bbc Cleanup account.[ch] and status.[ch] 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_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
1561 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1564 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
1565 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1566 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
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 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
1569 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
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 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
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 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
1574 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
1575
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1577
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1582 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
1583 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1585
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
1589 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
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 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1595 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
1596 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1598
9c7715998bbc Cleanup account.[ch] and status.[ch] 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_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
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 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
1602 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
1603
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1604 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
1605 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
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 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
1608 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1611 purple_account_set_enabled(PurpleAccount *account, const char *ui,
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
1615 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
1616 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
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 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
1619 g_return_if_fail(ui != 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
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 was_enabled = purple_account_get_enabled(account, ui);
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 purple_account_set_ui_bool(account, ui, "auto-login", 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
1624 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
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 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
1627 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
1628 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
1629 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
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_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
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 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
1634 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
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 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
1637
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1639 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
1640 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
1641 purple_account_disconnect(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1645 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
1646 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1648
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1650
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 if (priv->proxy_info != 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
1654 purple_proxy_info_destroy(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
1655
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1656 priv->proxy_info = info;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
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 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
1659 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1660
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1662 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
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 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
1665
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1667
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1669 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1673 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
1674 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1676
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
1680
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 /* 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
1682 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
1683 (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
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 /* 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
1686 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1690 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
1691 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
1692 {
40328
45e719e8d3bc Replace lists of PurpleAttr with GHashTable
qarkai <qarkai@gmail.com>
parents: 40327
diff changeset
1693 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
1694 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
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 va_start(args, active);
40328
45e719e8d3bc Replace lists of PurpleAttr with GHashTable
qarkai <qarkai@gmail.com>
parents: 40327
diff changeset
1697 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
1698 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
1699 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
1700 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
1701 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1702
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1703 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
1704 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
1705 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
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 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
1708
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1709 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
1710 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
1711
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1712 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
1713 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
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 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
1716 "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
1717 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
1718 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
1719 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
1720 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1723 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
1724
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 * 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
1727 * 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
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 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
1730 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1731
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1733 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
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 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1739 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
1740 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1741 g_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
1742
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1743 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
1744 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1747 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
1748 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
1752
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1753 priv = purple_account_get_instance_private(account);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1754 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
1755
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1756 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
1757 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
1758 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1759
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1760 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
1761 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
1762 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1763 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
1764
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1765 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
1766 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
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 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
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_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
1771 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1772
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1774 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
1775 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1777 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
1778
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1779 g_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
1780 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
1781
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1782 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
1783
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1784 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
1785
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1786 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
1787 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
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 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
1790
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1792 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1793
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1795 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
1796 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
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 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
1799 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
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 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
1802 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
1803
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1805
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
1809 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
1810
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1811 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
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 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1817 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
1818 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1819 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
1820 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
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 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
1823 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
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 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
1826
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1828
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1829 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
1830 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
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 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
1833
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1835 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1836
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1837 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
1838 purple_account_set_ui_int(PurpleAccount *account, const char *ui,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1839 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
1840 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1841 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
1842 GHashTable *table;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1843
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1844 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
1845 g_return_if_fail(ui != 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
1846 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
1847
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1848 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
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 setting->ui = g_strdup(ui);
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1852 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
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 table = get_ui_settings_table(account, ui);
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 g_hash_table_insert(table, 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
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 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
1859 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1862 purple_account_set_ui_string(PurpleAccount *account, const char *ui,
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 const char *name, 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
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 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
1866 GHashTable *table;
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1869 g_return_if_fail(ui != 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
1870 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
1871
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1873
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 setting->ui = g_strdup(ui);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1875 g_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
1876 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
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 table = get_ui_settings_table(account, ui);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1879
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1880 g_hash_table_insert(table, 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
1881
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1883 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1884
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1886 purple_account_set_ui_bool(PurpleAccount *account, const char *ui,
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
1890 GHashTable *table;
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1893 g_return_if_fail(ui != 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
1894 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
1895
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1897
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1898 setting->ui = g_strdup(ui);
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1899 g_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
1900 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
1901
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 table = get_ui_settings_table(account, ui);
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 g_hash_table_insert(table, 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
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 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
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_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
1911 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1912 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
1913 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1914
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1916 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
1917 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1918 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1922 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
1923 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1925 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1926
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1927 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
1928 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
1929 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1930 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
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 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
1933
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1934 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
1935 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
1936 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1937
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1938 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
1939 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
1940 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1941 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
1942
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1943 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
1944
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1946 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1950 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
1951 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1953
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1954 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
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 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
1957 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
1958 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1959
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1961 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
1962 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1966
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1968 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
1969 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1972 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
1973 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1975
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1976 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
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 = 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
1979 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
1980 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1981
40803
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1982 PurpleProtocol *
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1983 purple_account_get_protocol(PurpleAccount *account) {
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1984 PurpleAccountPrivate *priv = NULL;
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1985 PurpleProtocolManager *manager = NULL;
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1986
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1987 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
1988
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1989 priv = purple_account_get_instance_private(account);
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1990 manager = purple_protocol_manager_get_default();
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1991
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1992 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
1993 }
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1994
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
1995 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
1996 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
1997 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1998 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
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 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
2001
40804
5496016b3c00 Port libpurple from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents: 40803
diff changeset
2002 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
2003
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2005 _(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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2009 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
2010 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2012
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2013 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
2014
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2016 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
2017 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2018
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2019 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
2020 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
2021 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2023 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
2024 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
2025
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2026 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
2027
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2028 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
2029 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
2030 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2033 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
2034
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2035 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
2036 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
2037
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2038 /* 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
2039 * 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
2040 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
2041 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2046 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
2047
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2049 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2053 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2056 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
2057 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2059
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
2063 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
2064 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2067 purple_account_get_enabled(PurpleAccount *account, const char *ui)
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2070 g_return_val_if_fail(ui != 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
2071
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 return purple_account_get_ui_bool(account, ui, "auto-login", 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
2073 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2076 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
2077 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
2081
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2082 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
2083 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
2084 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2085
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2086 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
2087 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
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 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
2090
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
2094 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
2095 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2098 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
2099 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
2100 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2102 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
2103 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
2104 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
2105
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2106 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
2107 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
2108
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2109 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
2110 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
2111
40052
cc03b5af25ea Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39897
diff changeset
2112 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
2113 /* 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
2114 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
2115 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
2116 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2117
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2119
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2121 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
2122
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2124 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
2125
39676
1e8394d47205 Add list parameter to all buddy list UI ops.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
2126 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
2127
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 /* 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
2129 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
2130 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
2131 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
2132 "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
2133 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2138 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
2139 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
2140 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2141 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
2142 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
2143 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
2144 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
2145 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
2146 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
2147
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2148 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
2149 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
2150
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2151 priv = 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
2152 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
2153
40052
cc03b5af25ea Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39897
diff changeset
2154 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
2155 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
2156 /* 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
2157 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
2158 }
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
2159
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 /* 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
2161 * 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
2162 * 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
2163 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
2164 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
2165
40521
c4269b37a13a Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents: 40519
diff changeset
2166 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
2167 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
2168 }
c4269b37a13a Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents: 40519
diff changeset
2169
c4269b37a13a Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents: 40519
diff changeset
2170 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
2171 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
2172 }
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
39676
1e8394d47205 Add list parameter to all buddy list UI ops.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
2174 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
2175
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2176 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
2177 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
2178 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
2179 "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
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 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
2182 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
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 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
2186 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
2187 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
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 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
2190 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
2191 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
2192 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
2193
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2195 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
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 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
2198 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
2199
40052
cc03b5af25ea Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39897
diff changeset
2200 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
2201 /* 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
2202 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
2203 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2207
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2209 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
2210
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2212 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
2213
39676
1e8394d47205 Add list parameter to all buddy list UI ops.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
2214 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
2215
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2217 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
2218 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
2219 "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
2220 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2222 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2225 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
2226 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
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 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
2229 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
2230 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
2231 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
2232 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
2233 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
2234
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2236 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
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 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
2239 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
2240
40052
cc03b5af25ea Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39897
diff changeset
2241 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
2242 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
2243 /* 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
2244 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
2245 }
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
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 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
2248
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2250 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
2251
40521
c4269b37a13a Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents: 40519
diff changeset
2252 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
2253 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
2254 }
c4269b37a13a Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents: 40519
diff changeset
2255
c4269b37a13a Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents: 40519
diff changeset
2256 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
2257 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
2258 }
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
2259
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2260 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
2261 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
2262 "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
2263 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2264
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2265 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
2266
39676
1e8394d47205 Add list parameter to all buddy list UI ops.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
2267 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
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 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
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 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
2273 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
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 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
2276 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
2277 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
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 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
2280 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
2281 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
2282 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
2283 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
2284 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
2285 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
2286 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
2287 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
2288 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
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 /* 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
2291 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
2292 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
2293 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
2294 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
2295 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
2296 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
2297 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2299 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
2300 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2302 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
2303 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
2304 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
2305 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
2306 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
2307 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2309 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
2310 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 /* 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
2314 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
2315 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2319 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
2320 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2322 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
2323 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
2324
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2325 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
2326 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
2327 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 /* 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
2329 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
2330 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
2331 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
2332 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
2333 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
2334 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
2335 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2336 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
2337 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
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 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
2340 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
2341 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
2342 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
2343 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
2344 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
2345 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
2346 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
2347 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
2348 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
2349 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
2350 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
2351 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
2352 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
2353 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2354 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
2355 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
2356 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 /* 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
2360 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
2361 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
2362 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2363
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2364 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
2365 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
2366 {
39782
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39759
diff changeset
2367 PurpleAccountPrivate *priv = NULL;
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39759
diff changeset
2368
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39759
diff changeset
2369 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
2370
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39759
diff changeset
2371 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
2372 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
2373 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2374
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2375 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
2376 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
2377 {
39782
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39759
diff changeset
2378 PurpleAccountPrivate *priv = NULL;
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39759
diff changeset
2379
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39759
diff changeset
2380 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
2381
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39759
diff changeset
2382 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
2383 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
2384 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2385
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2386 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
2387 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
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 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
2390
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2391 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
2392 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
2393 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
2394
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2396 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
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 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
2399 who = purple_normalize(account, who);
40052
cc03b5af25ea Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39897
diff changeset
2400 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
2401
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2403 who = purple_normalize(account, who);
40052
cc03b5af25ea Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39897
diff changeset
2404 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
2405
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2406 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
2407 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
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 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
2410 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
2411 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2412 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2415 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
2416 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2417 PurpleAccountPrivate *priv;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2418
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2419 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), 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
2420
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2421 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
2422 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
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 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
2426 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
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 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
2429
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2431 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
2432
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2433 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
2434
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2435 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
2436 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2437
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2438 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
2439 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
2440 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2441 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
2442
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2444 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
2445
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2446 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
2447 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2448 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
2449
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2450 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
2451 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
2452 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2453
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2455 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2456
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2458 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
2459 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2460 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
2461
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
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 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
2467
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2468 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
2469 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
2470 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2473 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2474
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2475 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
2476 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
2477 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2478 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
2479
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2480 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
2481
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2482 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
2483 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2487 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
2488 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
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 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
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 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
2493 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
2494
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2496
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
2498 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2499
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2500 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
2501 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
2502 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2503 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
2504
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2505 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
2506
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2507 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
2508 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
2509 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2510
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2511 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
2512 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
2513 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
2514 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2515 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
2516 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
2517
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2518 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
2519 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
2520
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2521 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
2522
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2523 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
2524
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2525 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
2526 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
2527
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2528 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
2529
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2530 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
2531 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2532
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2533 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
2534 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
2535 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
2536 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2537 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
2538 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
2539
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2540 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
2541 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
2542
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2543 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
2544
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2545 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
2546
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2547 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
2548 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
2549
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2550 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
2551
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2552 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
2553 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2554
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2555 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
2556 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
2557 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
2558 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2559 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
2560 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
2561
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2562 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
2563 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
2564
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2565 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
2566
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2567 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
2568
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2569 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
2570 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
2571
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2572 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
2573
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2574 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
2575 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2576
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2577 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
2578 purple_account_get_ui_int(PurpleAccount *account, const char *ui,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2579 const char *name, 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
2580 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2581 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
2582 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
2583 GHashTable *table;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2584
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2585 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
2586 g_return_val_if_fail(ui != 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
2587 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
2588
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2589 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
2590
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2591 if ((table = g_hash_table_lookup(priv->ui_settings, ui)) == 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
2592 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
2593
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2594 if ((setting = g_hash_table_lookup(table, 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
2595 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
2596
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2597 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
2598
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2599 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
2600 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2601
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2602 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
2603 purple_account_get_ui_string(PurpleAccount *account, const char *ui,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2604 const char *name, 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
2605 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2606 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
2607 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
2608 GHashTable *table;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2609
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2610 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
2611 g_return_val_if_fail(ui != 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
2612 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
2613
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2614 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
2615
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2616 if ((table = g_hash_table_lookup(priv->ui_settings, ui)) == 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
2617 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
2618
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2619 if ((setting = g_hash_table_lookup(table, 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
2620 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
2621
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2622 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
2623
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2624 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
2625 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2626
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2627 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
2628 purple_account_get_ui_bool(PurpleAccount *account, const char *ui,
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2629 const char *name, 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
2630 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2631 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
2632 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
2633 GHashTable *table;
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2634
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2635 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
2636 g_return_val_if_fail(ui != 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
2637 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
2638
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2639 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
2640
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2641 if ((table = g_hash_table_lookup(priv->ui_settings, ui)) == 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
2642 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
2643
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2644 if ((setting = g_hash_table_lookup(table, 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
2645 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
2646
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2647 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
2648
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2649 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
2650 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2651
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2652 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
2653 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
2654 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2655 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
2656 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
2657
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2658 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
2659 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
2660
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2661 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
2662 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
2663 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
2664
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2665 if(PURPLE_IS_PROTOCOL_SERVER(protocol)) {
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2666 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
2667
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2668 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
2669 buddy, group, message);
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2670 }
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
2671 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2672
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2673 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
2674 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
2675 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2676 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
2677 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
2678
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2679 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
2680 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
2681
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2682 if (protocol) {
40783
4f197d3e42d6 Use g_list_copy_deep instead of manual copy/transform
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40708
diff changeset
2683 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
2684
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2685 /* 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
2686 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
2687
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2688 if(PURPLE_IS_PROTOCOL_SERVER(protocol)) {
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2689 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
2690 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
2691 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2692
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2693 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
2694 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2695 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2696
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2697 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
2698 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
2699 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
2700 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2701 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
2702 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
2703
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2704 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
2705 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
2706
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2707 if(PURPLE_IS_PROTOCOL_SERVER(protocol)) {
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2708 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
2709 gc, buddy, group);
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2710 }
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
2711 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2712
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2713 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
2714 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
2715 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2716 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
2717 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
2718
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2719 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
2720 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
2721
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2722 if(PURPLE_IS_PROTOCOL_SERVER(protocol)) {
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2723 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
2724 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
2725 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2726 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2727
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2728 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
2729 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
2730 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2731 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
2732 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
2733
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2734 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
2735 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
2736
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2737 if(PURPLE_IS_PROTOCOL_SERVER(protocol)) {
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2738 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
2739 gc, group);
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2740 }
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
2741 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2742
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2743 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
2744 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
2745 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
2746 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
2747 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
2748 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
2749 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
2750
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
2751 /* 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
2752 * implement the change password stuff.
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
2753 */
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
2754 manager = purple_credential_manager_get_default();
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
2755 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
2756 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
2757
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2758 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
2759 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
2760
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2761 if(PURPLE_IS_PROTOCOL_SERVER(protocol)) {
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2762 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
2763 gc, orig_pw, new_pw);
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
2764 }
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
2765 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2766
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2767 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
2768 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2769 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
2770 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
2771
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2772 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
2773 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
2774
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2775 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
2776 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
2777 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
2778 }
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
2779
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2780 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
2781 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
2782 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
2783 }
4d3018b00ad4 Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
2784
4d3018b00ad4 Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
2785 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
2786 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2787
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2788 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
2789 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
2790 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2791 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
2792
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2793 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
2794 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2795
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2796 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
2797 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
2798 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
2799 _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
2800 }

mercurial