libpurple/purpleaccount.c

Sun, 10 Nov 2024 03:54:56 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Sun, 10 Nov 2024 03:54:56 -0600
changeset 43061
36afd2f0a5ef
parent 43055
917386321169
child 43063
45e4e7e39d7f
permissions
-rw-r--r--

Update libpurple for the deprecation of Purple.Account.get_protocol_name

Testing Done:
Called in the turtles.

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

42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1 /*
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
2 * Purple - Internet Messaging Library
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
5 * Purple is the legal property of its developers, whose names are too numerous
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
8046
c581b20a47d6 [gaim-migrate @ 8730]
Sean Egan <seanegan@pidgin.im>
parents: 7956
diff changeset
7 * source distribution.
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6368
diff changeset
8 *
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
9 * This library is free software; you can redistribute it and/or modify it
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
10 * under the terms of the GNU General Public License as published by the Free
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
11 * Software Foundation; either version 2 of the License, or (at your option)
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
12 * any later version.
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 *
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
14 * This library is distributed in the hope that it will be useful, but WITHOUT
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
17 * more details.
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 *
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
19 * You should have received a copy of the GNU General Public License along with
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
20 * this library; if not, see <https://www.gnu.org/licenses/>.
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 */
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
22
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 #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
24
42344
c51d37734155 Rename account.[ch] to purpleaccount.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 42334
diff changeset
25 #include "purpleaccount.h"
42997
368deff13c21 Split purpleprivate.h up into individual files
Gary Kramlich <grim@reaperworld.com>
parents: 42992
diff changeset
26 #include "purpleaccountprivate.h"
42344
c51d37734155 Rename account.[ch] to purpleaccount.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 42334
diff changeset
27
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
28 #include "accounts.h"
11053
6d2abb51e586 [gaim-migrate @ 12991]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11042
diff changeset
29 #include "core.h"
5717
2f3a377de638 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents: 5711
diff changeset
30 #include "debug.h"
14758
13b9adc9efd2 [gaim-migrate @ 17448]
Sean Egan <seanegan@pidgin.im>
parents: 14724
diff changeset
31 #include "network.h"
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
32 #include "prefs.h"
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
33 #include "purpleaddcontactrequest.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"
43037
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
36 #include "purpleenums.h"
41438
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41432
diff changeset
37 #include "purplenotification.h"
42987
6c21275b4b82 Remove the deprecated Purple.Notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42931
diff changeset
38 #include "purplenotificationconnectionerror.h"
41438
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41432
diff changeset
39 #include "purplenotificationmanager.h"
40803
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
40 #include "purpleprotocolmanager.h"
7063
4bfe512a4b8c [gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
41 #include "request.h"
42136
cfa707dcda7d Make PurpleRequestFieldBool into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42135
diff changeset
42 #include "request/purplerequestfieldbool.h"
42135
1a89a067a0d5 Add a PurpleRequestFieldString subclass
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42128
diff changeset
43 #include "request/purplerequestfieldstring.h"
5717
2f3a377de638 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents: 5711
diff changeset
44 #include "util.h"
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
46 typedef struct {
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
47 GSList *names;
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
48 guint ref_count;
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
49 } PurpleAccountSettingFreezeQueue;
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
50
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
51 G_LOCK_DEFINE_STATIC(setting_notify_lock);
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
52
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
53 struct _PurpleAccount {
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
54 GObject parent;
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
55
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
56 char *id;
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
57 char *username;
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
58 PurpleContactInfo *contact_info;
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
59
41773
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
60 gboolean require_password;
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
61 char *user_info;
35470
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
62
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
63 char *buddy_icon_path;
35470
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
64
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
65 gboolean enabled;
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
66 gboolean remember_pass;
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
67
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
68 char *protocol_id;
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
69 PurpleProtocol *protocol;
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
70
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
71 PurpleConnection *gc;
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
72 gboolean disconnecting;
35470
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
73
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
74 GHashTable *settings;
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
75 PurpleAccountSettingFreezeQueue *freeze_queue;
35470
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
76
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
77 PurpleProxyInfo *proxy_info;
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
78
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
79 PurplePresence *presence;
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
80
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
81 GError *error;
41438
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41432
diff changeset
82 PurpleNotification *error_notification;
21287
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
83 } PurpleAccountPrivate;
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
84
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
85 typedef struct {
5777
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
86 char *ui;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
87 GValue value;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
88 } PurpleAccountSetting;
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
89
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
90 enum {
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
91 PROP_0,
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
92 PROP_ID,
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
93 PROP_USERNAME,
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
94 PROP_CONTACT_INFO,
41773
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
95 PROP_REQUIRE_PASSWORD,
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
96 PROP_ENABLED,
43037
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
97 PROP_CONNECTION_STATE,
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
98 PROP_CONNECTION,
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
99 PROP_PROTOCOL,
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
100 PROP_PROTOCOL_ID,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
101 PROP_USER_INFO,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
102 PROP_BUDDY_ICON_PATH,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
103 PROP_REMEMBER_PASSWORD,
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
104 PROP_PROXY_INFO,
41894
92fb22f0f0ab Add PurpleAccount::error property and remove "account-error-changed" and "account-status-changing" signals.
Gary Kramlich <grim@reaperworld.com>
parents: 41893
diff changeset
105 PROP_ERROR,
42268
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
106 PROP_CONNECTED,
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
107 N_PROPERTIES,
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
108 };
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
109 static GParamSpec *properties[N_PROPERTIES] = {NULL, };
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
110
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
111 enum {
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
112 SIG_SETTING_CHANGED,
42212
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
113 SIG_CONNECTED,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
114 SIG_DISCONNECTED,
42584
687260353985 Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42576
diff changeset
115 N_SIGNALS,
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
116 };
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
117 static guint signals[N_SIGNALS] = {0, };
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
118
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
119 /******************************************************************************
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
120 * 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
121 *****************************************************************************/
30740
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30708
diff changeset
122 static void
43037
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
123 purple_account_set_connection_state(PurpleAccount *account,
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
124 PurpleConnectionState connection_state)
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
125 {
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
126 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
127
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
128 if(PURPLE_IS_CONNECTION(account->gc)) {
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
129 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
130 purple_connection_set_state(account->gc, connection_state);
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
131 G_GNUC_END_IGNORE_DEPRECATIONS
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
132
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
133 g_object_notify_by_pspec(G_OBJECT(account),
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
134 properties[PROP_CONNECTION_STATE]);
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
135 }
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
136 }
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
137
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
138 static void
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
139 purple_account_set_id(PurpleAccount *account, const char *id) {
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
140 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
141
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
142 if(g_set_str(&account->id, id)) {
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
143 g_object_notify_by_pspec(G_OBJECT(account), properties[PROP_ID]);
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
144 }
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
145 }
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
146
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
147 static void
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
148 purple_account_set_protocol(PurpleAccount *account, PurpleProtocol *protocol) {
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
149 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
150
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
151 if(g_set_object(&account->protocol, protocol)) {
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
152 GObject *obj = G_OBJECT(account);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
153 const char *protocol_id = NULL;
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
154
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
155 if(PURPLE_IS_PROTOCOL(protocol)) {
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
156 protocol_id = purple_protocol_get_id(protocol);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
157 }
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
158
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
159 g_set_str(&account->protocol_id, protocol_id);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
160
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
161 g_object_freeze_notify(obj);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
162 g_object_notify_by_pspec(obj, properties[PROP_PROTOCOL]);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
163 g_object_notify_by_pspec(obj, properties[PROP_PROTOCOL_ID]);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
164 g_object_thaw_notify(obj);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
165 }
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
166 }
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
167
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
168 static void
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
169 purple_account_free_notify_settings(PurpleAccount *account) {
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
170 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
171
41961
0da91f053305 Make PurpleAccount subclass PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41960
diff changeset
172 if(account->freeze_queue != NULL) {
0da91f053305 Make PurpleAccount subclass PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41960
diff changeset
173 g_slist_free_full(account->freeze_queue->names, g_free);
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
174
41961
0da91f053305 Make PurpleAccount subclass PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41960
diff changeset
175 g_slice_free(PurpleAccountSettingFreezeQueue, account->freeze_queue);
0da91f053305 Make PurpleAccount subclass PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41960
diff changeset
176 account->freeze_queue = NULL;
0da91f053305 Make PurpleAccount subclass PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41960
diff changeset
177 }
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
178 }
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
179
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
180 static void
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
181 purple_account_setting_changed_emit(PurpleAccount *account, const char *name) {
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
182 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
183 g_return_if_fail(name != NULL);
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
184
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
185 G_LOCK(setting_notify_lock);
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
186
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
187 if(account->freeze_queue != NULL) {
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
188 GSList *names = account->freeze_queue->names;
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
189
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
190 if(g_slist_find_custom(names, name, (GCompareFunc)g_strcmp0) == NULL) {
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
191 names = g_slist_prepend(names, g_strdup(name));
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
192 account->freeze_queue->names = names;
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
193 }
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
194 } else {
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
195 g_signal_emit(account, signals[SIG_SETTING_CHANGED],
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
196 g_quark_from_string(name), name);
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
197 }
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
198
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
199 G_UNLOCK(setting_notify_lock);
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
200 }
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
201
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
202 static void
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
203 purple_account_real_connect(PurpleAccount *account, const char *password) {
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
204 PurpleConnection *connection = NULL;
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
205 PurpleProtocol *protocol = NULL;
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
206 GError *error = NULL;
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
207
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
208 protocol = purple_account_get_protocol(account);
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
209
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
210 connection = purple_protocol_create_connection(protocol, account, password,
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
211 &error);
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
212 if(error != NULL) {
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
213 purple_account_set_error(account, error);
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
214
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
215 return;
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
216 }
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
217
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
218 g_return_if_fail(PURPLE_IS_CONNECTION(connection));
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
219
43037
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
220 purple_account_set_connection_state(account,
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
221 PURPLE_CONNECTION_STATE_CONNECTING);
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
222
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
223 purple_account_set_connection(account, connection);
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
224 if(!purple_connection_connect(connection, &error)) {
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
225 purple_account_set_error(account, error);
43037
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
226 purple_account_set_connection_state(account,
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
227 PURPLE_CONNECTION_STATE_DISCONNECTED);
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
228 }
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
229
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
230 /* Finally remove our reference to the connection. */
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
231 g_object_unref(connection);
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
232 }
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
233
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
234 static void
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
235 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
236 PurpleCredentialManager *manager = PURPLE_CREDENTIAL_MANAGER(obj);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
237 PurpleAccount *account = PURPLE_ACCOUNT(data);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
238 GError *error = NULL;
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
239 char *password = NULL;
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
240
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
241 /* 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
242 * 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
243 * 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
244 */
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
245 password = (char *)g_object_get_data(G_OBJECT(account), "_tmp_password");
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
246 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
247
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
248 if(!purple_credential_manager_write_password_finish(manager, res, &error))
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
249 {
41976
49969fa9a664 Update libpurple for the deprecations in the account api
Gary Kramlich <grim@reaperworld.com>
parents: 41961
diff changeset
250 PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
251 const char *name = purple_contact_info_get_name_for_display(info);
40680
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 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
254 * 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
255 */
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
256 purple_debug_info("account",
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
257 "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
258 name,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
259 error != NULL ? error->message : "unknown error");
42182
3fc2d2b7b7a8 Fix leaked errors
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42136
diff changeset
260 g_clear_error(&error);
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
261 }
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
262
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
263 purple_account_real_connect(account, password);
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
264
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
265 g_free(password);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
266 }
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
267
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
268 static void
42128
118067ca0367 Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42127
diff changeset
269 request_password_ok_cb(PurpleAccount *account, PurpleRequestPage *page) {
11042
d1ccf8d8a187 [gaim-migrate @ 12954]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11033
diff changeset
270 const char *entry;
d1ccf8d8a187 [gaim-migrate @ 12954]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11033
diff changeset
271 gboolean remember;
11985
d4a210fb43e9 [gaim-migrate @ 14278]
Mark Doliner <markdoliner@pidgin.im>
parents: 11982
diff changeset
272
42128
118067ca0367 Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42127
diff changeset
273 entry = purple_request_page_get_string(page, "password");
118067ca0367 Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42127
diff changeset
274 remember = purple_request_page_get_bool(page, "remember");
11985
d4a210fb43e9 [gaim-migrate @ 14278]
Mark Doliner <markdoliner@pidgin.im>
parents: 11982
diff changeset
275
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
276 if(purple_strempty(entry)) {
42831
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
277 g_warning(_("Password is required to sign on for '%s'."),
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
278 account->username);
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
279 return;
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
280 }
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
281
33996
ca5e901a5311 Implemented a password caching system to limit problems linked to the
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33995
diff changeset
282 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
283
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
284 if(remember) {
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
285 PurpleCredentialManager *manager = NULL;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
286
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
287 manager = purple_credential_manager_get_default();
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
288
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
289 /* 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
290 * 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
291 * duplicate it for that callback.
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
292 */
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
293 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
294 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
295 NULL,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
296 request_password_write_cb,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
297 account);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
298 } else {
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
299 purple_account_real_connect(account, entry);
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
300 }
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
301 }
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
302
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
303 static void
41960
c8a4853205e3 Bump C standard to C99 for libpurple files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41958
diff changeset
304 request_password_cancel_cb(PurpleAccount *account,
42128
118067ca0367 Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42127
diff changeset
305 G_GNUC_UNUSED PurpleRequestPage *page)
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
306 {
30708
535bec1e66fb Standardize on "cancelled".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30456
diff changeset
307 /* Disable the account as the user has cancelled connecting */
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
308 purple_account_set_enabled(account, FALSE);
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
309 }
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
310
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
311
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
312 static void
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
313 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
314 gpointer data)
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
315 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
316 PurpleCredentialManager *manager = PURPLE_CREDENTIAL_MANAGER(obj);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
317 PurpleAccount *account = PURPLE_ACCOUNT(data);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
318 PurpleProtocol *protocol = NULL;
41777
86a6b955379c Prompt for a optional password when the user has said it's required
Gary Kramlich <grim@reaperworld.com>
parents: 41773
diff changeset
319 PurpleProtocolOptions options;
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
320 GError *error = NULL;
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
321 char *password = NULL;
41777
86a6b955379c Prompt for a optional password when the user has said it's required
Gary Kramlich <grim@reaperworld.com>
parents: 41773
diff changeset
322 gboolean require_password = TRUE;
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
323
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
324 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
325 &error);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
326
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
327 if(error != NULL) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
328 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
329 error->message);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
330
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
331 g_error_free(error);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
332 }
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
333
40804
5496016b3c00 Port libpurple from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents: 40803
diff changeset
334 protocol = purple_account_get_protocol(account);
41777
86a6b955379c Prompt for a optional password when the user has said it's required
Gary Kramlich <grim@reaperworld.com>
parents: 41773
diff changeset
335 options = purple_protocol_get_options(protocol);
86a6b955379c Prompt for a optional password when the user has said it's required
Gary Kramlich <grim@reaperworld.com>
parents: 41773
diff changeset
336 if(options & OPT_PROTO_PASSWORD_OPTIONAL) {
86a6b955379c Prompt for a optional password when the user has said it's required
Gary Kramlich <grim@reaperworld.com>
parents: 41773
diff changeset
337 require_password = purple_account_get_require_password(account);
86a6b955379c Prompt for a optional password when the user has said it's required
Gary Kramlich <grim@reaperworld.com>
parents: 41773
diff changeset
338 } else if(options & OPT_PROTO_NO_PASSWORD) {
86a6b955379c Prompt for a optional password when the user has said it's required
Gary Kramlich <grim@reaperworld.com>
parents: 41773
diff changeset
339 require_password = FALSE;
86a6b955379c Prompt for a optional password when the user has said it's required
Gary Kramlich <grim@reaperworld.com>
parents: 41773
diff changeset
340 }
86a6b955379c Prompt for a optional password when the user has said it's required
Gary Kramlich <grim@reaperworld.com>
parents: 41773
diff changeset
341
86a6b955379c Prompt for a optional password when the user has said it's required
Gary Kramlich <grim@reaperworld.com>
parents: 41773
diff changeset
342 if((password == NULL || *password == '\0') && require_password) {
34145
fa72f1e5cd77 Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
343 purple_account_request_password(account,
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
344 G_CALLBACK(request_password_ok_cb),
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
345 G_CALLBACK(request_password_cancel_cb),
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
346 account);
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
347 } else {
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
348 purple_account_real_connect(account, password);
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
349 }
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
350
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
351 g_free(password);
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
352 }
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
353
41786
0d71a8bef4c3 Work around a timing issues with accounts that have no passwords.
Gary Kramlich <grim@reaperworld.com>
parents: 41782
diff changeset
354 static gboolean
0d71a8bef4c3 Work around a timing issues with accounts that have no passwords.
Gary Kramlich <grim@reaperworld.com>
parents: 41782
diff changeset
355 no_password_cb(gpointer data) {
0d71a8bef4c3 Work around a timing issues with accounts that have no passwords.
Gary Kramlich <grim@reaperworld.com>
parents: 41782
diff changeset
356 PurpleAccount *account = data;
0d71a8bef4c3 Work around a timing issues with accounts that have no passwords.
Gary Kramlich <grim@reaperworld.com>
parents: 41782
diff changeset
357
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
358 purple_account_real_connect(account, NULL);
41786
0d71a8bef4c3 Work around a timing issues with accounts that have no passwords.
Gary Kramlich <grim@reaperworld.com>
parents: 41782
diff changeset
359
0d71a8bef4c3 Work around a timing issues with accounts that have no passwords.
Gary Kramlich <grim@reaperworld.com>
parents: 41782
diff changeset
360 return G_SOURCE_REMOVE;
0d71a8bef4c3 Work around a timing issues with accounts that have no passwords.
Gary Kramlich <grim@reaperworld.com>
parents: 41782
diff changeset
361 }
0d71a8bef4c3 Work around a timing issues with accounts that have no passwords.
Gary Kramlich <grim@reaperworld.com>
parents: 41782
diff changeset
362
7067
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
363 static void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
364 delete_setting(void *data) {
34582
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
365 PurpleAccountSetting *setting = (PurpleAccountSetting *)data;
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
366
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
367 g_free(setting->ui);
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
368 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
369
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
370 g_free(setting);
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
371 }
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
372
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
373 static PurpleConnectionState
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
374 purple_account_get_state(PurpleAccount *account) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
375 PurpleConnection *gc;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
376
41812
c3cd920261b6 Fix the namespace of the PurpleConnectionState enum constants
Gary Kramlich <grim@reaperworld.com>
parents: 41798
diff changeset
377 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account),
c3cd920261b6 Fix the namespace of the PurpleConnectionState enum constants
Gary Kramlich <grim@reaperworld.com>
parents: 41798
diff changeset
378 PURPLE_CONNECTION_STATE_DISCONNECTED);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
379
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
380 gc = purple_account_get_connection(account);
41812
c3cd920261b6 Fix the namespace of the PurpleConnectionState enum constants
Gary Kramlich <grim@reaperworld.com>
parents: 41798
diff changeset
381 if(!gc) {
c3cd920261b6 Fix the namespace of the PurpleConnectionState enum constants
Gary Kramlich <grim@reaperworld.com>
parents: 41798
diff changeset
382 return PURPLE_CONNECTION_STATE_DISCONNECTED;
c3cd920261b6 Fix the namespace of the PurpleConnectionState enum constants
Gary Kramlich <grim@reaperworld.com>
parents: 41798
diff changeset
383 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
384
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
385 return purple_connection_get_state(gc);
11251
e38d86958a63 [gaim-migrate @ 13420]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11249
diff changeset
386 }
e38d86958a63 [gaim-migrate @ 13420]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11249
diff changeset
387
41984
2ed9994ba315 Remove the deprecated account api
Gary Kramlich <grim@reaperworld.com>
parents: 41976
diff changeset
388 static void
42212
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
389 purple_account_connection_state_cb(GObject *obj,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
390 G_GNUC_UNUSED GParamSpec *pspec,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
391 gpointer data)
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
392 {
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
393 PurpleAccount *account = data;
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
394 PurpleConnection *connection = PURPLE_CONNECTION(obj);
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
395 PurpleConnectionState state = PURPLE_CONNECTION_STATE_DISCONNECTED;
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
396
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
397 state = purple_connection_get_state(connection);
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
398 if(state == PURPLE_CONNECTION_STATE_CONNECTED) {
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
399 g_signal_emit(account, signals[SIG_CONNECTED], 0);
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
400 } else if(state == PURPLE_CONNECTION_STATE_DISCONNECTED) {
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
401 g_signal_emit(account, signals[SIG_DISCONNECTED], 0);
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
402 }
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
403 }
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
404
42646
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
405 static void
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
406 purple_account_can_connect_cb(GObject *source, GAsyncResult *result,
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
407 gpointer data)
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
408 {
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
409 PurpleAccount *account = data;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
410 PurpleProtocol *protocol = PURPLE_PROTOCOL(source);
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
411 PurpleProtocolOptions options;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
412 GError *error = NULL;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
413 gboolean can_connect = FALSE;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
414 gboolean require_password = TRUE;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
415
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
416 can_connect = purple_protocol_can_connect_finish(protocol, result, &error);
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
417 if(error != NULL) {
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
418 purple_account_set_error(account, error);
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
419
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
420 return;
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
421 }
42646
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
422
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
423 if(!can_connect) {
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
424 error = g_error_new_literal(PURPLE_CONNECTION_ERROR, 0,
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
425 _("Unable to connect for unknown reasons"));
42646
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
426
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
427 purple_account_set_error(account, error);
42646
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
428
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
429 return;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
430 }
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
431
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
432 options = purple_protocol_get_options(protocol);
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
433 if(options & OPT_PROTO_PASSWORD_OPTIONAL) {
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
434 require_password = purple_account_get_require_password(account);
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
435 } else if(options & OPT_PROTO_NO_PASSWORD) {
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
436 require_password = FALSE;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
437 }
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
438
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
439 if(require_password) {
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
440 PurpleCredentialManager *manager = NULL;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
441
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
442 manager = purple_credential_manager_get_default();
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
443 purple_credential_manager_read_password_async(manager, account, NULL,
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
444 purple_account_connect_got_password_cb,
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
445 account);
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
446 } else {
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
447 g_timeout_add_seconds(0, no_password_cb, account);
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
448 }
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
449 }
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
450
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
451 /******************************************************************************
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
452 * 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
453 *****************************************************************************/
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
454 static PurpleXmlNode *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
455 proxy_settings_to_xmlnode(PurpleProxyInfo *proxy_info) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
456 PurpleXmlNode *node, *child;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
457 PurpleProxyType proxy_type;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
458 const char *value;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
459 int int_value;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
460 char buf[21];
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
461
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
462 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
463
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
464 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
465
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
466 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
467 purple_xmlnode_insert_data(child,
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
468 (proxy_type == PURPLE_PROXY_TYPE_USE_GLOBAL ? "global" :
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
469 proxy_type == PURPLE_PROXY_TYPE_NONE ? "none" :
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
470 proxy_type == PURPLE_PROXY_TYPE_HTTP ? "http" :
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
471 proxy_type == PURPLE_PROXY_TYPE_SOCKS4 ? "socks4" :
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
472 proxy_type == PURPLE_PROXY_TYPE_SOCKS5 ? "socks5" :
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
473 proxy_type == PURPLE_PROXY_TYPE_TOR ? "tor" :
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
474 proxy_type == PURPLE_PROXY_TYPE_USE_ENVVAR ? "envvar" : "unknown"), -1);
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
475
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
476 if((value = purple_proxy_info_get_hostname(proxy_info)) != NULL) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
477 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
478 purple_xmlnode_insert_data(child, value, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
479 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
480
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
481 if((int_value = purple_proxy_info_get_port(proxy_info)) != 0) {
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
482 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
483 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
484 purple_xmlnode_insert_data(child, buf, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
485 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
486
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
487 if((value = purple_proxy_info_get_username(proxy_info)) != NULL) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
488 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
489 purple_xmlnode_insert_data(child, value, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
490 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
491
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
492 if((value = purple_proxy_info_get_password(proxy_info)) != NULL) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
493 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
494 purple_xmlnode_insert_data(child, value, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
495 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
496
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
497 return node;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
498 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
499
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
500 static PurpleXmlNode *
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
501 current_error_to_xmlnode(GError *error) {
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
502 PurpleXmlNode *node = NULL;
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
503 PurpleXmlNode *child = NULL;
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
504 char *value = NULL;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
505
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
506 node = purple_xmlnode_new("current_error");
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
507
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
508 if(error == NULL) {
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
509 return node;
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
510 }
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
511
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
512 child = purple_xmlnode_new_child(node, "domain");
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
513 purple_xmlnode_insert_data(child, g_quark_to_string(error->domain), -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
514
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
515 child = purple_xmlnode_new_child(node, "code");
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
516 value = g_strdup_printf("%d", error->code);
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
517 purple_xmlnode_insert_data(child, value, -1);
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
518 g_free(value);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
519
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
520 child = purple_xmlnode_new_child(node, "message");
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
521 purple_xmlnode_insert_data(child, error->message, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
522
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
523 return node;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
524 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
525
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
526 static void
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
527 setting_to_xmlnode(gpointer key, gpointer value, gpointer user_data)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
528 {
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
529 const char *name;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
530 PurpleAccountSetting *setting;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
531 PurpleXmlNode *node, *child;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
532 char buf[21];
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
533
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
534 name = (const char *)key;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
535 setting = (PurpleAccountSetting *)value;
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
536 node = (PurpleXmlNode *)user_data;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
537
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
538 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
539 purple_xmlnode_set_attrib(child, "name", name);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
540
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
541 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
542 purple_xmlnode_set_attrib(child, "type", "int");
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
543 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
544 purple_xmlnode_insert_data(child, buf, -1);
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
545 } else if(G_VALUE_HOLDS_STRING(&setting->value) &&
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
546 g_value_get_string(&setting->value) != NULL)
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
547 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
548 purple_xmlnode_set_attrib(child, "type", "string");
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
549 purple_xmlnode_insert_data(child, g_value_get_string(&setting->value),
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
550 -1);
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
551 } 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
552 purple_xmlnode_set_attrib(child, "type", "bool");
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
553 g_snprintf(buf, sizeof(buf), "%d",
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
554 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
555 purple_xmlnode_insert_data(child, buf, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
556 }
6368
ab9f99269dfe [gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents: 6367
diff changeset
557 }
ab9f99269dfe [gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents: 6367
diff changeset
558
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
559 PurpleXmlNode *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
560 _purple_account_to_xmlnode(PurpleAccount *account) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
561 PurpleXmlNode *node, *child;
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
562 char *data = NULL;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
563 const char *tmp;
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
564 PurpleProxyInfo *proxy_info;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
565
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
566 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
567
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
568 if(account->id != NULL) {
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
569 child = purple_xmlnode_new_child(node, "id");
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
570 purple_xmlnode_insert_data(child, account->id, -1);
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
571 }
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
572
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
573 child = purple_xmlnode_new_child(node, "protocol");
41976
49969fa9a664 Update libpurple for the deprecations in the account api
Gary Kramlich <grim@reaperworld.com>
parents: 41961
diff changeset
574 purple_xmlnode_insert_data(child, purple_account_get_protocol_id(account),
49969fa9a664 Update libpurple for the deprecations in the account api
Gary Kramlich <grim@reaperworld.com>
parents: 41961
diff changeset
575 -1);
34935
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, "name");
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
578 purple_xmlnode_insert_data(child, account->username, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
579
41773
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
580 child = purple_xmlnode_new_child(node, "require_password");
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
581 data = g_strdup_printf("%d", account->require_password);
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
582 purple_xmlnode_insert_data(child, data, -1);
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
583 g_clear_pointer(&data, g_free);
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
584
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
585 child = purple_xmlnode_new_child(node, "enabled");
41712
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
586 data = g_strdup_printf("%d", account->enabled);
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
587 purple_xmlnode_insert_data(child, data, -1);
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
588 g_clear_pointer(&data, g_free);
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
589
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
590 tmp = purple_contact_info_get_alias(account->contact_info);
41961
0da91f053305 Make PurpleAccount subclass PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41960
diff changeset
591 if(tmp != NULL) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
592 child = purple_xmlnode_new_child(node, "alias");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
593 purple_xmlnode_insert_data(child, tmp, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
594 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
595
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
596 if((tmp = purple_account_get_user_info(account)) != NULL) {
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
597 /* 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
598 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
599 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
600 }
34c1a17a91d7 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18190
diff changeset
601
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
602 if(g_hash_table_size(account->settings) > 0) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
603 child = purple_xmlnode_new_child(node, "settings");
41712
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
604 g_hash_table_foreach(account->settings, setting_to_xmlnode, child);
34581
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
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
607 if((proxy_info = purple_account_get_proxy_info(account)) != NULL) {
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
608 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
609 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
610 }
34c1a17a91d7 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18190
diff changeset
611
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
612 child = current_error_to_xmlnode(account->error);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
613 purple_xmlnode_insert_child(node, child);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
614
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
615 return node;
5710
3c2bf5725bb0 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5707
diff changeset
616 }
3c2bf5725bb0 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5707
diff changeset
617
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
618 /******************************************************************************
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
619 * 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
620 *****************************************************************************/
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
621 G_DEFINE_FINAL_TYPE(PurpleAccount, purple_account, G_TYPE_OBJECT);
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
622
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
623 static void
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
624 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
625 GParamSpec *pspec)
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
626 {
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
627 PurpleAccount *account = PURPLE_ACCOUNT(obj);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
628
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
629 switch(param_id) {
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
630 case PROP_ID:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
631 purple_account_set_id(account, g_value_get_string(value));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
632 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
633 case PROP_USERNAME:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
634 purple_account_set_username(account, g_value_get_string(value));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
635 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
636 case PROP_REQUIRE_PASSWORD:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
637 purple_account_set_require_password(account,
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
638 g_value_get_boolean(value));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
639 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
640 case PROP_ENABLED:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
641 purple_account_set_enabled(account, g_value_get_boolean(value));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
642 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
643 case PROP_CONNECTION:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
644 purple_account_set_connection(account, g_value_get_object(value));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
645 break;
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
646 case PROP_PROTOCOL:
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
647 purple_account_set_protocol(account, g_value_get_object(value));
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
648 break;
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
649 case PROP_PROTOCOL_ID:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
650 purple_account_set_protocol_id(account, g_value_get_string(value));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
651 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
652 case PROP_USER_INFO:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
653 purple_account_set_user_info(account, g_value_get_string(value));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
654 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
655 case PROP_BUDDY_ICON_PATH:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
656 purple_account_set_buddy_icon_path(account, g_value_get_string(value));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
657 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
658 case PROP_REMEMBER_PASSWORD:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
659 purple_account_set_remember_password(account,
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
660 g_value_get_boolean(value));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
661 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
662 case PROP_PROXY_INFO:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
663 purple_account_set_proxy_info(account, g_value_get_object(value));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
664 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
665 case PROP_ERROR:
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
666 purple_account_set_error(account, g_value_get_boxed(value));
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
667 break;
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
668 default:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
669 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
670 break;
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
671 }
5710
3c2bf5725bb0 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5707
diff changeset
672 }
3c2bf5725bb0 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5707
diff changeset
673
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
674 static void
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
675 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
676 GParamSpec *pspec)
5580
a5a3e6dfb409 [gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents: 5574
diff changeset
677 {
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
678 PurpleAccount *account = PURPLE_ACCOUNT(obj);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
679
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
680 switch(param_id) {
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
681 case PROP_ID:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
682 g_value_set_string(value, purple_account_get_id(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
683 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
684 case PROP_USERNAME:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
685 g_value_set_string(value, purple_account_get_username(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
686 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
687 case PROP_CONTACT_INFO:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
688 g_value_set_object(value, purple_account_get_contact_info(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
689 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
690 case PROP_REQUIRE_PASSWORD:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
691 g_value_set_boolean(value,
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
692 purple_account_get_require_password(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
693 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
694 case PROP_ENABLED:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
695 g_value_set_boolean(value, purple_account_get_enabled(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
696 break;
43037
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
697 case PROP_CONNECTION_STATE:
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
698 g_value_set_enum(value, purple_account_get_connection_state(account));
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
699 break;
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
700 case PROP_CONNECTION:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
701 g_value_set_object(value, purple_account_get_connection(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
702 break;
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
703 case PROP_PROTOCOL:
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
704 g_value_set_object(value, purple_account_get_protocol(account));
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
705 break;
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
706 case PROP_PROTOCOL_ID:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
707 g_value_set_string(value, purple_account_get_protocol_id(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
708 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
709 case PROP_USER_INFO:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
710 g_value_set_string(value, purple_account_get_user_info(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
711 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
712 case PROP_BUDDY_ICON_PATH:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
713 g_value_set_string(value, purple_account_get_buddy_icon_path(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
714 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
715 case PROP_REMEMBER_PASSWORD:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
716 g_value_set_boolean(value,
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
717 purple_account_get_remember_password(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
718 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
719 case PROP_PROXY_INFO:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
720 g_value_set_object(value, purple_account_get_proxy_info(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
721 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
722 case PROP_ERROR:
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
723 g_value_set_boxed(value, purple_account_get_error(account));
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
724 break;
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
725 case PROP_CONNECTED:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
726 g_value_set_boolean(value, purple_account_is_connected(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
727 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
728 default:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
729 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
730 break;
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
731 }
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
732 }
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
733
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
734 static void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
735 purple_account_init(PurpleAccount *account) {
41712
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
736 account->settings = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
737 delete_setting);
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
738 account->contact_info = purple_contact_info_new(NULL);
42696
ef2f771d8242 Remove PurpleAccountPresense (finally)
Gary Kramlich <grim@reaperworld.com>
parents: 42646
diff changeset
739 account->presence = purple_presence_new();
5580
a5a3e6dfb409 [gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents: 5574
diff changeset
740 }
5573
633880e3f137 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5565
diff changeset
741
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
742 static void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
743 purple_account_dispose(GObject *object) {
35512
8d6f1349b57a Fix crash on wrong password (backout 0f0d6ae2fb77)
Ankit Vani <a@nevitus.org>
parents: 35499
diff changeset
744 PurpleAccount *account = PURPLE_ACCOUNT(object);
8d6f1349b57a Fix crash on wrong password (backout 0f0d6ae2fb77)
Ankit Vani <a@nevitus.org>
parents: 35499
diff changeset
745
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
746 if(!purple_account_is_disconnected(account)) {
35512
8d6f1349b57a Fix crash on wrong password (backout 0f0d6ae2fb77)
Ankit Vani <a@nevitus.org>
parents: 35499
diff changeset
747 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
748 }
894c29e33300 Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
749
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
750 g_clear_object(&account->error_notification);
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
751 g_clear_object(&account->gc);
41717
ce790d508898 Minor cleanup to account cleanup and connection error handling
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41712
diff changeset
752 g_clear_object(&account->presence);
ce790d508898 Minor cleanup to account cleanup and connection error handling
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41712
diff changeset
753
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
754 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
755 }
894c29e33300 Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
756
894c29e33300 Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
757 static void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
758 purple_account_finalize(GObject *object) {
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
759 PurpleAccount *account = PURPLE_ACCOUNT(object);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
760
41717
ce790d508898 Minor cleanup to account cleanup and connection error handling
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41712
diff changeset
761 purple_debug_info("account", "Destroying account %p", account);
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
762
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
763 purple_account_free_notify_settings(account);
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
764
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
765 g_clear_pointer(&account->id, g_free);
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
766 g_clear_pointer(&account->username, g_free);
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
767 g_clear_object(&account->contact_info);
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
768
41712
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
769 g_clear_object(&account->proxy_info);
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
770
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
771 g_clear_error(&account->error);
41712
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
772
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
773 g_free(account->user_info);
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
774 g_free(account->buddy_icon_path);
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
775
41712
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
776 g_free(account->protocol_id);
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
777 g_clear_object(&account->protocol);
41712
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
778
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
779 g_hash_table_destroy(account->settings);
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
780
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
781 G_OBJECT_CLASS(purple_account_parent_class)->finalize(object);
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
782 }
5874
5e19273d3c6f [gaim-migrate @ 6306]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
783
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
784 static void
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
785 purple_account_class_init(PurpleAccountClass *klass) {
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
786 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
787
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
788 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
789 obj_class->finalize = purple_account_finalize;
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
790 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
791 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
792
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
793 /**
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
794 * PurpleAccount:id:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
795 *
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
796 * The unique identifier for the account.
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
797 *
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
798 * Since: 3.0
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
799 */
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
800 properties[PROP_ID] = g_param_spec_string(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
801 "id", NULL, NULL,
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
802 NULL,
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
803 G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
804
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
805 /**
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
806 * PurpleAccount:username:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
807 *
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
808 * The username for the account.
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
809 *
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
810 * Since: 3.0
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
811 */
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
812 properties[PROP_USERNAME] = g_param_spec_string(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
813 "username", NULL, NULL,
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
814 NULL,
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
815 G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
816
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
817 /**
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
818 * PurpleAccount:contact-info:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
819 *
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
820 * The [class@ContactInfo] for the account.
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
821 *
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
822 * This should be completely managed by the protocol that this account was
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
823 * created for. Writing any properties to this from anything but the
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
824 * protocol will lead to de-synchronization.
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
825 *
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
826 * Since: 3.0
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
827 */
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
828 properties[PROP_CONTACT_INFO] = g_param_spec_object(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
829 "contact-info", NULL, NULL,
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
830 PURPLE_TYPE_CONTACT_INFO,
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
831 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
832
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
833 /**
41773
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
834 * PurpleAccount:require-password:
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
835 *
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
836 * Whether or not this account should require a password. This is only used
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
837 * if the [class@Purple.Protocol] that this account is for allows optional
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
838 * passwords.
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
839 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
840 * Since: 3.0
41773
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
841 */
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
842 properties[PROP_REQUIRE_PASSWORD] = g_param_spec_boolean(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
843 "require-password", NULL, NULL,
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
844 FALSE,
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
845 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
846
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
847 /**
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
848 * PurpleAccount:user-info:
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
849 *
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
850 * The user information or profile for the account.
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
851 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
852 * Since: 3.0
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
853 */
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
854 properties[PROP_USER_INFO] = g_param_spec_string(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
855 "user-info", NULL, NULL,
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
856 NULL,
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
857 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
858
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
859 /**
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
860 * PurpleAccount:buddy-icon-path:
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
861 *
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
862 * The path to the file to use as the avatar for this account.
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
863 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
864 * Since: 3.0
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
865 */
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
866 properties[PROP_BUDDY_ICON_PATH] = g_param_spec_string(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
867 "buddy-icon-path", NULL, NULL,
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
868 NULL,
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
869 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
870
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
871 /**
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
872 * PurpleAccount:enabled:
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
873 *
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
874 * Whether or not this account should track the user's global status.
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
875 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
876 * Since: 3.0
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
877 */
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
878 properties[PROP_ENABLED] = g_param_spec_boolean(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
879 "enabled", NULL, NULL,
41773
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
880 FALSE,
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
881 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
882
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
883 /**
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
884 * PurpleAccount:remember-password:
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
885 *
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
886 * Whether or not the password for this account should be stored in the
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
887 * configured [class@CredentialProvider].
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
888 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
889 * Since: 3.0
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
890 */
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
891 properties[PROP_REMEMBER_PASSWORD] = g_param_spec_boolean(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
892 "remember-password", NULL, NULL,
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
893 FALSE,
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
894 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
895
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
896 /**
43037
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
897 * PurpleAccount:connection-state:
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
898 *
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
899 * The connection state of the account.
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
900 *
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
901 * Since: 3.0
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
902 */
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
903 properties[PROP_CONNECTION_STATE] = g_param_spec_enum(
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
904 "connection-state", NULL, NULL,
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
905 PURPLE_TYPE_CONNECTION_STATE,
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
906 PURPLE_CONNECTION_STATE_DISCONNECTED,
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
907 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
908
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
909 /**
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
910 * PurpleAccount:connection:
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
911 *
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
912 * The [class@Connection] object for this account. This will be %NULL when
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
913 * the account is offline.
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
914 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
915 * Since: 3.0
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
916 */
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
917 properties[PROP_CONNECTION] = g_param_spec_object(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
918 "connection", NULL, NULL,
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
919 PURPLE_TYPE_CONNECTION,
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
920 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
921
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
922 /**
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
923 * PurpleAccount:protocol:
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
924 *
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
925 * The protocol that this account is using.
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
926 *
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
927 * This will set [property@Account:protocol-id] to the
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
928 * [property@Protocol:id] of the new protocol.
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
929 *
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
930 * If [property@Account:protocol-id] is set first, this will be lazy
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
931 * initialized by the first call to [method@Account.get_protocol].
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
932 *
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
933 * Since: 3.0
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
934 */
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
935 properties[PROP_PROTOCOL] = g_param_spec_object(
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
936 "protocol", NULL, NULL,
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
937 PURPLE_TYPE_PROTOCOL,
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
938 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
939
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
940 /**
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
941 * PurpleAccount:protocol-id:
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
942 *
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
943 * The identifier of the protocol that this account is using.
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
944 *
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
945 * If [property@Account:protocol] was set before this changes, it will be
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
946 * cleared.
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
947 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
948 * Since: 3.0
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
949 */
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
950 properties[PROP_PROTOCOL_ID] = g_param_spec_string(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
951 "protocol-id", NULL, NULL,
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
952 NULL,
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
953 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
954
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
955 /**
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
956 * PurpleAccount:proxy-info:
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
957 *
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
958 * The [class@ProxyInfo] for this account.
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
959 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
960 * Since: 3.0
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
961 */
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
962 properties[PROP_PROXY_INFO] = g_param_spec_object(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
963 "proxy-info", NULL, NULL,
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
964 PURPLE_TYPE_PROXY_INFO,
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
965 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
966
41894
92fb22f0f0ab Add PurpleAccount::error property and remove "account-error-changed" and "account-status-changing" signals.
Gary Kramlich <grim@reaperworld.com>
parents: 41893
diff changeset
967 /**
92fb22f0f0ab Add PurpleAccount::error property and remove "account-error-changed" and "account-status-changing" signals.
Gary Kramlich <grim@reaperworld.com>
parents: 41893
diff changeset
968 * PurpleAccount:error:
92fb22f0f0ab Add PurpleAccount::error property and remove "account-error-changed" and "account-status-changing" signals.
Gary Kramlich <grim@reaperworld.com>
parents: 41893
diff changeset
969 *
92fb22f0f0ab Add PurpleAccount::error property and remove "account-error-changed" and "account-status-changing" signals.
Gary Kramlich <grim@reaperworld.com>
parents: 41893
diff changeset
970 * The [type@GLib.Error] of the account. This is set when an account enters
42049
16d2e16bd24f Export Account::error
Gary Kramlich <grim@reaperworld.com>
parents: 42047
diff changeset
971 * an error state and is automatically cleared when a connection attempt is
16d2e16bd24f Export Account::error
Gary Kramlich <grim@reaperworld.com>
parents: 42047
diff changeset
972 * made.
16d2e16bd24f Export Account::error
Gary Kramlich <grim@reaperworld.com>
parents: 42047
diff changeset
973 *
16d2e16bd24f Export Account::error
Gary Kramlich <grim@reaperworld.com>
parents: 42047
diff changeset
974 * Setting this will not disconnect an account, but this will be set when
16d2e16bd24f Export Account::error
Gary Kramlich <grim@reaperworld.com>
parents: 42047
diff changeset
975 * there is a connection failure.
41894
92fb22f0f0ab Add PurpleAccount::error property and remove "account-error-changed" and "account-status-changing" signals.
Gary Kramlich <grim@reaperworld.com>
parents: 41893
diff changeset
976 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
977 * Since: 3.0
41894
92fb22f0f0ab Add PurpleAccount::error property and remove "account-error-changed" and "account-status-changing" signals.
Gary Kramlich <grim@reaperworld.com>
parents: 41893
diff changeset
978 */
92fb22f0f0ab Add PurpleAccount::error property and remove "account-error-changed" and "account-status-changing" signals.
Gary Kramlich <grim@reaperworld.com>
parents: 41893
diff changeset
979 properties[PROP_ERROR] = g_param_spec_boxed(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
980 "error", NULL, NULL,
43008
d46e90e0757a Remove Purple.ConnectionErrorInfo
Gary Kramlich <grim@reaperworld.com>
parents: 43004
diff changeset
981 G_TYPE_ERROR,
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
982 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
43001
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
983
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
984 /**
42268
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
985 * PurpleAccount:connected:
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
986 *
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
987 * Whether or not the account is connected.
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
988 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
989 * Since: 3.0
42268
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
990 */
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
991 properties[PROP_CONNECTED] = g_param_spec_boolean(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
992 "connected", NULL, NULL,
42268
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
993 FALSE,
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
994 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
995
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
996 g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
997
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
998 /**
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
999 * PurpleAccount::setting-changed:
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1000 * @account: The account whose setting changed.
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1001 * @name: The name of the setting that changed.
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1002 *
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1003 * The ::setting-changed signal is emitted whenever an account setting is
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1004 * changed.
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1005 *
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1006 * This signal supports details, so you can be notified when a single
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1007 * setting changes. For example, say there's a setting named `foo`,
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1008 * connecting to `setting-changed::foo` will only be called when the `foo`
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1009 * setting is changed.
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1010 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1011 * Since: 3.0
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1012 */
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1013 signals[SIG_SETTING_CHANGED] = g_signal_new_class_handler(
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1014 "setting-changed",
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1015 G_OBJECT_CLASS_TYPE(klass),
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1016 G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1017 NULL,
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1018 NULL,
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1019 NULL,
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1020 NULL,
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1021 G_TYPE_NONE,
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1022 1,
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1023 G_TYPE_STRING);
42212
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1024
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1025 /**
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1026 * PurpleAccount::connected:
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1027 * @account: The account instance.
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1028 *
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1029 * This is emitted when the [property@Account:connection]'s
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1030 * [property@Connection:state] has changed to
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1031 * %PURPLE_CONNECTION_STATE_CONNECTED.
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1032 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1033 * Since: 3.0
42212
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1034 */
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1035 signals[SIG_CONNECTED] = g_signal_new_class_handler(
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1036 "connected",
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1037 G_OBJECT_CLASS_TYPE(klass),
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1038 G_SIGNAL_RUN_LAST,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1039 NULL,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1040 NULL,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1041 NULL,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1042 NULL,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1043 G_TYPE_NONE,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1044 0);
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1045
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1046 /**
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1047 * PurpleAccount::disconnected:
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1048 * @account: The account instance.
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1049 *
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1050 * This is emitted when the [property@Account:connection]'s
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1051 * [property@Connection:state] has changed to
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1052 * %PURPLE_CONNECTION_STATE_DISCONNECTED.
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1053 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1054 * Since: 3.0
42212
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1055 */
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1056 signals[SIG_DISCONNECTED] = g_signal_new_class_handler(
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1057 "disconnected",
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1058 G_OBJECT_CLASS_TYPE(klass),
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1059 G_SIGNAL_RUN_LAST,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1060 NULL,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1061 NULL,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1062 NULL,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1063 NULL,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1064 G_TYPE_NONE,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1065 0);
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1066 }
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1067
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
1068 /******************************************************************************
41830
5bc664b848a5 Work around an issue where accounts were attempting to connect when they were deserialized
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
1069 * Private API
5bc664b848a5 Work around an issue where accounts were attempting to connect when they were deserialized
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
1070 *****************************************************************************/
5bc664b848a5 Work around an issue where accounts were attempting to connect when they were deserialized
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
1071
5bc664b848a5 Work around an issue where accounts were attempting to connect when they were deserialized
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
1072 /* This is a temporary method that the deserializer can call to set the
5bc664b848a5 Work around an issue where accounts were attempting to connect when they were deserialized
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
1073 * enabled property without bringing the account online.
5bc664b848a5 Work around an issue where accounts were attempting to connect when they were deserialized
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
1074 */
5bc664b848a5 Work around an issue where accounts were attempting to connect when they were deserialized
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
1075 void
5bc664b848a5 Work around an issue where accounts were attempting to connect when they were deserialized
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
1076 purple_account_set_enabled_plain(PurpleAccount *account, gboolean enabled) {
5bc664b848a5 Work around an issue where accounts were attempting to connect when they were deserialized
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
1077 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
5bc664b848a5 Work around an issue where accounts were attempting to connect when they were deserialized
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
1078
5bc664b848a5 Work around an issue where accounts were attempting to connect when they were deserialized
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
1079 account->enabled = enabled;
5bc664b848a5 Work around an issue where accounts were attempting to connect when they were deserialized
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
1080 }
5bc664b848a5 Work around an issue where accounts were attempting to connect when they were deserialized
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
1081
5bc664b848a5 Work around an issue where accounts were attempting to connect when they were deserialized
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
1082 /******************************************************************************
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
1083 * 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
1084 *****************************************************************************/
43037
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1085 void
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1086 purple_account_connected(PurpleAccount *account) {
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1087 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1088
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1089 purple_account_set_connection_state(account,
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1090 PURPLE_CONNECTION_STATE_CONNECTED);
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1091 }
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1092
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1093 PurpleAccount *
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
1094 purple_account_new(const char *username, const char *protocol_id) {
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1095 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
1096 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
1097
42047
72db1ae4ea4e Remove the account lookup on account new
Gary Kramlich <grim@reaperworld.com>
parents: 41984
diff changeset
1098 return g_object_new(
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1099 PURPLE_TYPE_ACCOUNT,
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1100 "username", username,
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1101 "protocol-id", protocol_id,
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1102 "enabled", FALSE,
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1103 NULL);
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6368
diff changeset
1104 }
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
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1106 const char *
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1107 purple_account_get_id(PurpleAccount *account) {
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1108 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1109
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1110 /* If we weren't given an ID during construction, generate one on the fly.
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1111 */
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1112 if(purple_strempty(account->id)) {
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1113 GChecksum *checksum = NULL;
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1114
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1115 checksum = g_checksum_new(G_CHECKSUM_SHA256);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1116
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1117 g_checksum_update(checksum, (const guchar *)account->protocol_id, -1);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1118 g_checksum_update(checksum, (const guchar *)account->username, -1);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1119
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1120 purple_account_set_id(account, g_checksum_get_string(checksum));
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1121
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1122 g_checksum_free(checksum);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1123 }
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1124
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1125 return account->id;
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1126 }
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1127
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1128 const char *
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1129 purple_account_get_username(PurpleAccount *account) {
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1130 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1131
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1132 return account->username;
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1133 }
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1134
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1135 void
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1136 purple_account_set_username(PurpleAccount *account, const char *username) {
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1137 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1138
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1139 if(g_set_str(&account->username, username)) {
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1140 g_object_notify_by_pspec(G_OBJECT(account), properties[PROP_USERNAME]);
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1141 }
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1142 }
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1143
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1144 PurpleContactInfo *
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1145 purple_account_get_contact_info(PurpleAccount *account) {
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1146 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1147
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1148 return account->contact_info;
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1149 }
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1150
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
1151 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
1152 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
1153 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1154 PurpleProtocol *protocol = 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
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 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
1157
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1158 purple_account_set_error(account, NULL);
41445
61d9b9e2b974 Remove the account error scrollbook from the blist as notifications have replaced it.
Gary Kramlich <grim@reaperworld.com>
parents: 41444
diff changeset
1159
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1160 if(!purple_account_get_enabled(account)) {
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1161 purple_debug_info("account",
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1162 "Account %s not enabled, not connecting.\n",
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1163 account->username);
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
1164 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
1165 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1166
40804
5496016b3c00 Port libpurple from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents: 40803
diff changeset
1167 protocol = purple_account_get_protocol(account);
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1168 if(protocol == NULL) {
42831
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1169 PurpleNotification *notification = NULL;
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1170 PurpleNotificationManager *manager = NULL;
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1171 char *value = NULL;
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1172
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1173 value = g_strdup_printf(_("Failed to load account '%s'"),
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1174 account->username);
42988
c2357ee36551 Replace Purple.Notification.new_generic with Purple.Notification.new
Gary Kramlich <grim@reaperworld.com>
parents: 42987
diff changeset
1175 notification = purple_notification_new(NULL, value);
42831
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1176 g_free(value);
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1177
42931
9e8b9ee3cfbb Update libpurple for the Purple.Notification deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42855
diff changeset
1178 purple_notification_set_account(notification, account);
9e8b9ee3cfbb Update libpurple for the Purple.Notification deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42855
diff changeset
1179
42831
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1180 value = g_strdup_printf(_("Failed to find a protocol with id '%s'"),
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1181 account->protocol_id);
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1182 purple_notification_set_subtitle(notification, value);
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1183 g_free(value);
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1184
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1185 manager = purple_notification_manager_get_default();
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1186 purple_notification_manager_add(manager, notification);
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1187 g_clear_object(&notification);
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1188
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1189 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
1190 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1191
42646
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
1192 purple_protocol_can_connect_async(protocol, account, NULL,
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
1193 purple_account_can_connect_cb, 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
1194 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1195
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 void
43037
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1197 purple_account_disconnect(PurpleAccount *account) {
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1198 GError *error = 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
1199
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1200 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
1201 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
1202 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
1203
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1204 purple_debug_info("account", "Disconnecting account %s (%p)\n",
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1205 account->username, 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
1206
43037
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1207 purple_account_set_connection_state(account,
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1208 PURPLE_CONNECTION_STATE_DISCONNECTING);
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
1209
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1210 if(!purple_connection_disconnect(account->gc, &error)) {
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1211 g_warning("error while disconnecting account %s (%s): %s",
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1212 account->username,
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1213 purple_account_get_protocol_id(account),
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1214 (error != NULL) ? error->message : "unknown error");
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1215 g_clear_error(&error);
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1216 }
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1217
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
1218 purple_account_set_connection(account, NULL);
43037
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1219 purple_account_set_connection_state(account,
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1220 PURPLE_CONNECTION_STATE_DISCONNECTED);
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
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
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1223 void
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1224 purple_account_disconnect_with_error(PurpleAccount *account, GError *error) {
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1225 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1226 g_return_if_fail(error != NULL);
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1227
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1228 purple_account_disconnect(account);
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1229 purple_account_set_error(account, error);
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1230 }
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1231
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
1232 gboolean
43037
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1233 purple_account_is_disconnecting(PurpleAccount *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
1234 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
1235
43037
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1236 return (purple_account_get_state(account) == PURPLE_CONNECTION_STATE_DISCONNECTING);
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
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
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41500
diff changeset
1240 purple_account_request_close_with_account(PurpleAccount *account) {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41500
diff changeset
1241 PurpleNotificationManager *manager = NULL;
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1242
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1244
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41500
diff changeset
1245 manager = purple_notification_manager_get_default();
41817
91f9ce89468b Fix connection errors getting deleted when an account is disconnected
Gary Kramlich <grim@reaperworld.com>
parents: 41812
diff changeset
1246 purple_notification_manager_remove_with_account(manager, account, FALSE);
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
1247 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1248
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1250 purple_account_request_password(PurpleAccount *account, GCallback ok_cb,
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1251 GCallback cancel_cb, void *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
1252 {
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
1253 char *primary;
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
1254 const char *username;
42127
18acb99a0fa6 Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42049
diff changeset
1255 PurpleRequestGroup *group;
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
1256 PurpleRequestField *field;
42128
118067ca0367 Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42127
diff changeset
1257 PurpleRequestPage *page;
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
1258
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 /* 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
1260 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
1261
41976
49969fa9a664 Update libpurple for the deprecations in the account api
Gary Kramlich <grim@reaperworld.com>
parents: 41961
diff changeset
1262 username = purple_contact_info_get_username(PURPLE_CONTACT_INFO(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
1263 primary = g_strdup_printf(_("Enter password for %s (%s)"), username,
43061
36afd2f0a5ef Update libpurple for the deprecation of Purple.Account.get_protocol_name
Gary Kramlich <grim@reaperworld.com>
parents: 43055
diff changeset
1264 purple_protocol_get_name(account->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
1265
42128
118067ca0367 Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42127
diff changeset
1266 page = purple_request_page_new();
42127
18acb99a0fa6 Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42049
diff changeset
1267 group = purple_request_group_new(NULL);
42128
118067ca0367 Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42127
diff changeset
1268 purple_request_page_add_group(page, group);
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
1269
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1270 field = purple_request_field_string_new("password", _("Enter Password"),
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1271 NULL, FALSE);
42135
1a89a067a0d5 Add a PurpleRequestFieldString subclass
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42128
diff changeset
1272 purple_request_field_string_set_masked(PURPLE_REQUEST_FIELD_STRING(field),
1a89a067a0d5 Add a PurpleRequestFieldString subclass
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42128
diff changeset
1273 TRUE);
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
1274 purple_request_field_set_required(field, TRUE);
42127
18acb99a0fa6 Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42049
diff changeset
1275 purple_request_group_add_field(group, field);
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
1276
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1277 field = purple_request_field_bool_new("remember", _("Save password"),
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1278 FALSE);
42127
18acb99a0fa6 Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42049
diff changeset
1279 purple_request_group_add_field(group, field);
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
1280
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1281 purple_request_fields(account, NULL, primary, NULL, page, _("OK"), ok_cb,
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1282 _("Cancel"), cancel_cb,
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1283 purple_request_cpar_from_account(account),
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1284 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
1285 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
1286 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1287
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1288 void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1289 purple_account_set_user_info(PurpleAccount *account, const char *user_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
1290 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
1291
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1292 if(g_set_str(&account->user_info, user_info)) {
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1293 g_object_notify_by_pspec(G_OBJECT(account),
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1294 properties[PROP_USER_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
1295
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1296 purple_accounts_schedule_save();
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1297 }
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
1298 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1299
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1300 void
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1301 purple_account_set_buddy_icon_path(PurpleAccount *account, const char *path) {
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
1302 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
1303
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1304 if(g_set_str(&account->buddy_icon_path, path)) {
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1305 g_object_notify_by_pspec(G_OBJECT(account),
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1306 properties[PROP_BUDDY_ICON_PATH]);
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
1307
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1308 purple_accounts_schedule_save();
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1309 }
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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1313 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
1314 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1316 g_return_if_fail(protocol_id != NULL);
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1317 g_return_if_fail(purple_account_is_disconnected(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
1318
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1319 if(g_set_str(&account->protocol_id, protocol_id)) {
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1320 GObject *obj = G_OBJECT(account);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1321
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1322 /* Setting this directly clears any cached protocol. */
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1323 g_clear_object(&account->protocol);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1324
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1325 g_object_freeze_notify(obj);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1326 g_object_notify_by_pspec(obj, properties[PROP_PROTOCOL_ID]);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1327 g_object_notify_by_pspec(obj, properties[PROP_PROTOCOL]);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1328 g_object_thaw_notify(obj);
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
1329
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1330 purple_accounts_schedule_save();
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1331 }
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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1334 void
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1335 purple_account_set_connection(PurpleAccount *account, PurpleConnection *gc) {
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1336 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
1337
42212
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1338 /* If we got the same pointer, bail. */
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1339 if(account->gc == gc) {
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1340 return;
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1341 }
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1342
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1343 /* Remove our old signal handler. */
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1344 if(PURPLE_IS_CONNECTION(account->gc)) {
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1345 g_signal_handlers_disconnect_by_func(account->gc,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1346 purple_account_connection_state_cb,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1347 account);
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1348 }
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1349
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1350 if(g_set_object(&account->gc, gc)) {
42268
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
1351 GObject *obj = G_OBJECT(account);
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
1352
42212
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1353 if(PURPLE_IS_CONNECTION(account->gc)) {
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1354 g_signal_connect(account->gc, "notify::state",
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1355 G_CALLBACK(purple_account_connection_state_cb),
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1356 account);
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1357 }
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1358
42268
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
1359 g_object_freeze_notify(obj);
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
1360 g_object_notify_by_pspec(obj, properties[PROP_CONNECTION]);
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
1361 g_object_notify_by_pspec(obj, properties[PROP_CONNECTED]);
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
1362 g_object_thaw_notify(obj);
42212
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1363 } else {
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1364 /* If the set didn't work, restore our old signal. */
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1365 if(PURPLE_IS_CONNECTION(account->gc)) {
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1366 g_signal_connect(account->gc, "notify::state",
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1367 G_CALLBACK(purple_account_connection_state_cb),
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1368 account);
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1369 }
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1370 }
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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1374 purple_account_set_remember_password(PurpleAccount *account, gboolean value) {
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1375 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1376
41712
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
1377 account->remember_pass = value;
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1378
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 g_object_notify_by_pspec(G_OBJECT(account),
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1380 properties[PROP_REMEMBER_PASSWORD]);
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
1381
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1382 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
1383 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1384
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 void
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1386 purple_account_set_enabled(PurpleAccount *account, gboolean value) {
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1387 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
1388
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1390
41712
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
1391 was_enabled = account->enabled;
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
1392 account->enabled = value;
41891
a45d6db4f857 Propagate the PurpleAccount::notify signal via PurpleAccountManager::account-changed
Gary Kramlich <grim@reaperworld.com>
parents: 41869
diff changeset
1393 if(was_enabled != value) {
a45d6db4f857 Propagate the PurpleAccount::notify signal via PurpleAccountManager::account-changed
Gary Kramlich <grim@reaperworld.com>
parents: 41869
diff changeset
1394 g_object_notify_by_pspec(G_OBJECT(account), properties[PROP_ENABLED]);
a45d6db4f857 Propagate the PurpleAccount::notify signal via PurpleAccountManager::account-changed
Gary Kramlich <grim@reaperworld.com>
parents: 41869
diff changeset
1395 }
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1396
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1397 if(value && purple_presence_is_online(account->presence)) {
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
1398 purple_account_connect(account);
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1399 } else if (!value && !purple_account_is_disconnected(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
1400 purple_account_disconnect(account);
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1401 }
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1402
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1403 purple_accounts_schedule_save();
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1404 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1405
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1407 purple_account_set_proxy_info(PurpleAccount *account, PurpleProxyInfo *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
1408 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
1409
41712
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
1410 if(g_set_object(&account->proxy_info, info)) {
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1411 g_object_notify_by_pspec(G_OBJECT(account),
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1412 properties[PROP_PROXY_INFO]);
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1413
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1414 purple_accounts_schedule_save();
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1415 }
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
1416 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1417
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1418 void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1419 purple_account_set_int(PurpleAccount *account, const char *name, int value) {
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1420 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
1421
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1422 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1423 g_return_if_fail(name != 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
1424
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1425 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
1426
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1428 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
1429
41712
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
1430 g_hash_table_insert(account->settings, g_strdup(name), setting);
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
1431
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1432 purple_account_setting_changed_emit(account, name);
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1433
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
1434 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
1435 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1436
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1437 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
1438 purple_account_set_string(PurpleAccount *account, const char *name,
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1439 const char *value)
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1440 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1441 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
1442
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1443 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1444 g_return_if_fail(name != 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
1445
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1446 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
1447
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1448 g_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
1449 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
1450
41712
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
1451 g_hash_table_insert(account->settings, g_strdup(name), setting);
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
1452
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1453 purple_account_setting_changed_emit(account, name);
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1454
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
1455 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1459 purple_account_set_bool(PurpleAccount *account, const char *name,
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1460 gboolean value)
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
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 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
1463
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1465 g_return_if_fail(name != 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
1466
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1467 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
1468
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1470 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
1471
41712
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
1472 g_hash_table_insert(account->settings, g_strdup(name), setting);
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
1473
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1474 purple_account_setting_changed_emit(account, name);
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1475
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
1476 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
1477 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1478
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 gboolean
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1480 purple_account_is_connected(PurpleAccount *account) {
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1481 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), FALSE);
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1482
41812
c3cd920261b6 Fix the namespace of the PurpleConnectionState enum constants
Gary Kramlich <grim@reaperworld.com>
parents: 41798
diff changeset
1483 return (purple_account_get_state(account) == PURPLE_CONNECTION_STATE_CONNECTED);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1484 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1485
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1486 gboolean
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1487 purple_account_is_connecting(PurpleAccount *account) {
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1488 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), FALSE);
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1489
41812
c3cd920261b6 Fix the namespace of the PurpleConnectionState enum constants
Gary Kramlich <grim@reaperworld.com>
parents: 41798
diff changeset
1490 return (purple_account_get_state(account) == PURPLE_CONNECTION_STATE_CONNECTING);
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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 gboolean
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1494 purple_account_is_disconnected(PurpleAccount *account) {
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1495 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), FALSE);
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1496
41812
c3cd920261b6 Fix the namespace of the PurpleConnectionState enum constants
Gary Kramlich <grim@reaperworld.com>
parents: 41798
diff changeset
1497 return (purple_account_get_state(account) == PURPLE_CONNECTION_STATE_DISCONNECTED);
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
1498 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1499
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1500 const char *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1501 purple_account_get_user_info(PurpleAccount *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
1502 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
1503
41712
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
1504 return account->user_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
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 const char *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1508 purple_account_get_buddy_icon_path(PurpleAccount *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
1509 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
1510
41712
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
1511 return account->buddy_icon_path;
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
1512 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1513
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1514 const char *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1515 purple_account_get_protocol_id(PurpleAccount *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
1516 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
1517
41712
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
1518 return account->protocol_id;
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
1519 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
40803
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1521 PurpleProtocol *
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1522 purple_account_get_protocol(PurpleAccount *account) {
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1523 PurpleProtocolManager *manager = NULL;
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1524
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1525 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
1526
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1527 if(!PURPLE_IS_PROTOCOL(account->protocol)) {
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1528 manager = purple_protocol_manager_get_default();
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1529 if(manager != NULL) {
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1530 PurpleProtocol *protocol = NULL;
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1531
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1532 protocol = purple_protocol_manager_find(manager,
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1533 account->protocol_id);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1534
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1535 purple_account_set_protocol(account, protocol);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1536 }
42853
051b8f911409 Remove the test ui from the account manager tests
Gary Kramlich <grim@reaperworld.com>
parents: 42841
diff changeset
1537 }
40803
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1538
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1539 return account->protocol;
40803
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1540 }
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1541
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1542 const char *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1543 purple_account_get_protocol_name(PurpleAccount *account) {
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1544 const char *name = 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
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 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
1547
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1548 if(PURPLE_IS_PROTOCOL(account->protocol)) {
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1549 name = purple_protocol_get_name(account->protocol);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1550 }
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
1551
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1552 if(purple_strempty(name)) {
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1553 name = _("Unknown");
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1554 }
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1555
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1556 return name;
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
1557 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
43037
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1559 PurpleConnectionState
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1560 purple_account_get_connection_state(PurpleAccount *account) {
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1561 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account),
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1562 PURPLE_CONNECTION_STATE_DISCONNECTED);
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1563
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1564 if(PURPLE_IS_CONNECTION(account->gc)) {
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1565 return purple_connection_get_state(account->gc);
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1566 }
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1567
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1568 return PURPLE_CONNECTION_STATE_DISCONNECTED;
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1569 }
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1570
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
1571 PurpleConnection *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1572 purple_account_get_connection(PurpleAccount *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
1573 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
1574
41712
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
1575 return account->gc;
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1576 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1577
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 gboolean
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1579 purple_account_get_remember_password(PurpleAccount *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
1580 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
1581
41712
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
1582 return account->remember_pass;
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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 gboolean
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1586 purple_account_get_enabled(PurpleAccount *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
1587 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), FALSE);
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1588
41712
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
1589 return account->enabled;
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 PurpleProxyInfo *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1593 purple_account_get_proxy_info(PurpleAccount *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
1594 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
1595
41712
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
1596 return account->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
1597 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1598
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 PurplePresence *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1600 purple_account_get_presence(PurpleAccount *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
1601 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
1602
41712
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
1603 return account->presence;
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
1604 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1605
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1607 purple_account_get_int(PurpleAccount *account, const char *name,
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1608 int default_value)
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
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 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
1611
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1612 g_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
1613 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
1614
41712
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
1615 setting = g_hash_table_lookup(account->settings, name);
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
1616
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1617 if(setting == 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
1618 return default_value;
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1619 }
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1620
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1621 g_return_val_if_fail(G_VALUE_HOLDS_INT(&setting->value), default_value);
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1622
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1623 return g_value_get_int(&setting->value);
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1624 }
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1625
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1626 const char *
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1627 purple_account_get_string(PurpleAccount *account, const char *name,
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1628 const char *default_value)
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1629 {
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1630 PurpleAccountSetting *setting;
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1631
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1632 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), default_value);
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1633 g_return_val_if_fail(name != NULL, default_value);
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1634
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1635 setting = g_hash_table_lookup(account->settings, name);
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1636
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1637 if(setting == NULL) {
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1638 return default_value;
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1639 }
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
1640
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
1644 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1645
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1646 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
1647 purple_account_get_bool(PurpleAccount *account, const char *name,
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1648 gboolean default_value)
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1649 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1650 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
1651
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1652 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), default_value);
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1653 g_return_val_if_fail(name != NULL, default_value);
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1654
41712
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
1655 setting = g_hash_table_lookup(account->settings, name);
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
1656
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1657 if(setting == 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
1658 return default_value;
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1659 }
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
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 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
1662
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1664 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 void
42992
402dbf6669b3 Remove Purple.ProtocolServer
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
1667 purple_account_change_password(PurpleAccount *account,
402dbf6669b3 Remove Purple.ProtocolServer
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
1668 G_GNUC_UNUSED const char *orig_pw,
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1669 const char *new_pw)
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
1670 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1671 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
1672
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1673 /* 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
1674 * implement the change password stuff.
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1675 */
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1676 manager = purple_credential_manager_get_default();
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1677 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
1678 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
1679 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1680
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1681 GError *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1682 purple_account_get_error(PurpleAccount *account) {
41712
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
1683 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
1684
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1685 return account->error;
43001
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
1686 }
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
1687
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
1688 void
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1689 purple_account_set_error(PurpleAccount *account, GError *error) {
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1690 PurpleNotificationManager *manager = NULL;
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1691
43001
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
1692 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
1693
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1694 if(account->error == error) {
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1695 return;
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1696 }
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1697
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1698 /* Set the new error. */
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1699 g_clear_error(&account->error);
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1700 account->error = error;
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1701
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1702 manager = purple_notification_manager_get_default();
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1703
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1704 /* Clear the old account connection error notification if we have one. */
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1705 if(PURPLE_IS_NOTIFICATION(account->error_notification)) {
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1706 if(PURPLE_IS_NOTIFICATION_MANAGER(manager)) {
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1707 purple_notification_manager_remove(manager,
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1708 account->error_notification);
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1709 }
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1710
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1711 g_clear_object(&account->error_notification);
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1712 }
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1713
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1714 /* If we have a new error, create a new error notification. */
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1715 if(error != NULL) {
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1716 PurpleNotification *notification = NULL;
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1717
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1718 notification = purple_notification_connection_error_new(NULL, account);
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1719
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1720 if(PURPLE_IS_NOTIFICATION_MANAGER(manager)) {
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1721 purple_notification_manager_add(manager, notification);
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1722 }
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1723
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1724 account->error_notification = notification;
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1725 }
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1726
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1727 g_object_notify_by_pspec(G_OBJECT(account), properties[PROP_ERROR]);
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1728
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1729 purple_accounts_schedule_save();
43001
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
1730 }
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
1731
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
1732 void
41773
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1733 purple_account_set_require_password(PurpleAccount *account,
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1734 gboolean require_password)
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1735 {
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1736 gboolean old = FALSE;
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1737
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1738 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1739
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1740 old = account->require_password;
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1741 account->require_password = require_password;
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1742
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1743 if(old != require_password) {
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1744 g_object_notify_by_pspec(G_OBJECT(account),
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1745 properties[PROP_REQUIRE_PASSWORD]);
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1746 }
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1747 }
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1748
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1749 gboolean
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1750 purple_account_get_require_password(PurpleAccount *account) {
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1751 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), FALSE);
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1752
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1753 return account->require_password;
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1754 }
41920
29ebd938c592 Add a contact property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41914
diff changeset
1755
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1756 void
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1757 purple_account_freeze_notify_settings(PurpleAccount *account) {
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1758 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1759
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1760 G_LOCK(setting_notify_lock);
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1761 if(account->freeze_queue == NULL) {
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1762 account->freeze_queue = g_slice_new0(PurpleAccountSettingFreezeQueue);
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1763 }
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1764
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1765 account->freeze_queue->ref_count++;
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1766
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1767 G_UNLOCK(setting_notify_lock);
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1768 }
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1769
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1770 void
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1771 purple_account_thaw_notify_settings(PurpleAccount *account) {
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1772 GSList *names = NULL;
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1773
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1774 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1775
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1776 G_LOCK(setting_notify_lock);
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1777 if(G_UNLIKELY(account->freeze_queue->ref_count == 0)) {
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1778 G_UNLOCK(setting_notify_lock);
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1779
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1780 g_critical("purple_account_settings_thaw_notify called for account %s "
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1781 "(%s) when not frozen",
41976
49969fa9a664 Update libpurple for the deprecations in the account api
Gary Kramlich <grim@reaperworld.com>
parents: 41961
diff changeset
1782 purple_contact_info_get_username(PURPLE_CONTACT_INFO(account)),
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1783 purple_account_get_protocol_id(account));
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1784
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1785 return;
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1786 }
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1787
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1788 account->freeze_queue->ref_count--;
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1789 if(account->freeze_queue->ref_count > 0) {
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1790 G_UNLOCK(setting_notify_lock);
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1791
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1792 return;
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1793 }
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1794
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1795 /* This was the last ref, so fire off the signals. */
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1796 names = account->freeze_queue->names;
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1797 while(names != NULL) {
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1798 char *name = names->data;
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1799
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1800 g_signal_emit(account, signals[SIG_SETTING_CHANGED],
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1801 g_quark_from_string(name), name);
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1802
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1803 names = g_slist_delete_link(names, names);
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1804 g_free(name);
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1805 }
41949
8733057a54f0 Fix an invalid free in the account setting thaw function
Gary Kramlich <grim@reaperworld.com>
parents: 41946
diff changeset
1806 account->freeze_queue->names = names;
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1807
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1808 purple_account_free_notify_settings(account);
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1809
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1810 G_UNLOCK(setting_notify_lock);
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1811 }
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1812

mercurial