libpurple/purpleaccount.c

Thu, 09 Jan 2025 20:59:45 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Thu, 09 Jan 2025 20:59:45 -0600
changeset 43130
ad73c9be8cb1
parent 43127
eae3279e871c
child 43160
a9cc7d8325ba
permissions
-rw-r--r--

Clean up some old random stuff

Testing Done:
Called in the turtles.

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

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 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
250 /* we can't error an account without a connection, so we just drop a
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
251 * debug message for now and continue to connect the account.
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
252 */
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
253 purple_debug_info("account",
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
254 "failed to save password for account \"%s\": %s",
43074
0ff905ef6259 Fix uses of PurpleAccount as a PurpleContactInfo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43063
diff changeset
255 purple_account_get_username(account),
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
256 error != NULL ? error->message : "unknown error");
42182
3fc2d2b7b7a8 Fix leaked errors
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42136
diff changeset
257 g_clear_error(&error);
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
258 }
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
259
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
260 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
261
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
262 g_free(password);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
263 }
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
264
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
265 static void
42128
118067ca0367 Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42127
diff changeset
266 request_password_ok_cb(PurpleAccount *account, PurpleRequestPage *page) {
11042
d1ccf8d8a187 [gaim-migrate @ 12954]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11033
diff changeset
267 const char *entry;
d1ccf8d8a187 [gaim-migrate @ 12954]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11033
diff changeset
268 gboolean remember;
11985
d4a210fb43e9 [gaim-migrate @ 14278]
Mark Doliner <markdoliner@pidgin.im>
parents: 11982
diff changeset
269
42128
118067ca0367 Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42127
diff changeset
270 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
271 remember = purple_request_page_get_bool(page, "remember");
11985
d4a210fb43e9 [gaim-migrate @ 14278]
Mark Doliner <markdoliner@pidgin.im>
parents: 11982
diff changeset
272
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
273 if(purple_strempty(entry)) {
42831
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
274 g_warning(_("Password is required to sign on for '%s'."),
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
275 account->username);
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
276 return;
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
277 }
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
278
33996
ca5e901a5311 Implemented a password caching system to limit problems linked to the
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33995
diff changeset
279 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
280
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
281 if(remember) {
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
282 PurpleCredentialManager *manager = NULL;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
283
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
284 manager = purple_credential_manager_get_default();
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
285
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
286 /* 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
287 * 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
288 * duplicate it for that callback.
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
289 */
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
290 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
291 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
292 NULL,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
293 request_password_write_cb,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
294 account);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
295 } else {
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
296 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
297 }
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
298 }
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
299
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
300 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
301 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
302 G_GNUC_UNUSED PurpleRequestPage *page)
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
303 {
30708
535bec1e66fb Standardize on "cancelled".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30456
diff changeset
304 /* 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
305 purple_account_set_enabled(account, FALSE);
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
306 }
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
307
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
308
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
309 static void
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
310 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
311 gpointer data)
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
312 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
313 PurpleCredentialManager *manager = PURPLE_CREDENTIAL_MANAGER(obj);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
314 PurpleAccount *account = PURPLE_ACCOUNT(data);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
315 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
316 PurpleProtocolOptions options;
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
317 GError *error = NULL;
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
318 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
319 gboolean require_password = TRUE;
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
320
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
321 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
322 &error);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
323
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
324 if(error != NULL) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
325 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
326 error->message);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
327
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
328 g_error_free(error);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
329 }
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
330
40804
5496016b3c00 Port libpurple from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents: 40803
diff changeset
331 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
332 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
333 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
334 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
335 } 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
336 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
337 }
86a6b955379c Prompt for a optional password when the user has said it's required
Gary Kramlich <grim@reaperworld.com>
parents: 41773
diff changeset
338
86a6b955379c Prompt for a optional password when the user has said it's required
Gary Kramlich <grim@reaperworld.com>
parents: 41773
diff changeset
339 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
340 purple_account_request_password(account,
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
341 G_CALLBACK(request_password_ok_cb),
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
342 G_CALLBACK(request_password_cancel_cb),
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
343 account);
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
344 } else {
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
345 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
346 }
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
347
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
348 g_free(password);
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
349 }
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
350
43127
eae3279e871c Use g_timeout_add_once where possible
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43091
diff changeset
351 static void
41786
0d71a8bef4c3 Work around a timing issues with accounts that have no passwords.
Gary Kramlich <grim@reaperworld.com>
parents: 41782
diff changeset
352 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
353 PurpleAccount *account = data;
0d71a8bef4c3 Work around a timing issues with accounts that have no passwords.
Gary Kramlich <grim@reaperworld.com>
parents: 41782
diff changeset
354
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
355 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
356 }
0d71a8bef4c3 Work around a timing issues with accounts that have no passwords.
Gary Kramlich <grim@reaperworld.com>
parents: 41782
diff changeset
357
7067
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
358 static void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
359 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
360 PurpleAccountSetting *setting = (PurpleAccountSetting *)data;
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
361
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
362 g_free(setting->ui);
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
363 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
364
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
365 g_free(setting);
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
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
368 static PurpleConnectionState
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
369 purple_account_get_state(PurpleAccount *account) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
370 PurpleConnection *gc;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
371
41812
c3cd920261b6 Fix the namespace of the PurpleConnectionState enum constants
Gary Kramlich <grim@reaperworld.com>
parents: 41798
diff changeset
372 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
373 PURPLE_CONNECTION_STATE_DISCONNECTED);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
374
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
375 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
376 if(!gc) {
c3cd920261b6 Fix the namespace of the PurpleConnectionState enum constants
Gary Kramlich <grim@reaperworld.com>
parents: 41798
diff changeset
377 return PURPLE_CONNECTION_STATE_DISCONNECTED;
c3cd920261b6 Fix the namespace of the PurpleConnectionState enum constants
Gary Kramlich <grim@reaperworld.com>
parents: 41798
diff changeset
378 }
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 return purple_connection_get_state(gc);
11251
e38d86958a63 [gaim-migrate @ 13420]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11249
diff changeset
381 }
e38d86958a63 [gaim-migrate @ 13420]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11249
diff changeset
382
41984
2ed9994ba315 Remove the deprecated account api
Gary Kramlich <grim@reaperworld.com>
parents: 41976
diff changeset
383 static void
42212
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
384 purple_account_connection_state_cb(GObject *obj,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
385 G_GNUC_UNUSED GParamSpec *pspec,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
386 gpointer data)
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
387 {
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
388 PurpleAccount *account = data;
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
389 PurpleConnection *connection = PURPLE_CONNECTION(obj);
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
390 PurpleConnectionState state = PURPLE_CONNECTION_STATE_DISCONNECTED;
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
391
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
392 state = purple_connection_get_state(connection);
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
393 if(state == PURPLE_CONNECTION_STATE_CONNECTED) {
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
394 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
395 } else if(state == PURPLE_CONNECTION_STATE_DISCONNECTED) {
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
396 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
397 }
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
398 }
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
399
42646
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
400 static void
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
401 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
402 gpointer data)
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
403 {
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
404 PurpleAccount *account = data;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
405 PurpleProtocol *protocol = PURPLE_PROTOCOL(source);
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
406 PurpleProtocolOptions options;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
407 GError *error = NULL;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
408 gboolean can_connect = FALSE;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
409 gboolean require_password = TRUE;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
410
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
411 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
412 if(error != NULL) {
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
413 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
414
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
415 return;
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
416 }
42646
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
417
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
418 if(!can_connect) {
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
419 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
420 _("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
421
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
422 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
423
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
424 return;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
425 }
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
426
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
427 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
428 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
429 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
430 } 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
431 require_password = FALSE;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
432 }
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
433
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
434 if(require_password) {
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
435 PurpleCredentialManager *manager = NULL;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
436
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
437 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
438 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
439 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
440 account);
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
441 } else {
43127
eae3279e871c Use g_timeout_add_once where possible
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43091
diff changeset
442 g_timeout_add_once(0, no_password_cb, account);
42646
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
443 }
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
444 }
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
445
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
446 /******************************************************************************
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
447 * 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
448 *****************************************************************************/
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
449 static PurpleXmlNode *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
450 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
451 PurpleXmlNode *node, *child;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
452 PurpleProxyType proxy_type;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
453 const char *value;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
454 int int_value;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
455 char buf[21];
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
456
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
457 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
458
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
459 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
460
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
461 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
462 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
463 (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
464 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
465 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
466 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
467 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
468 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
469 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
470
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
471 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
472 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
473 purple_xmlnode_insert_data(child, value, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
474 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
475
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
476 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
477 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
478 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
479 purple_xmlnode_insert_data(child, buf, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
480 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
481
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
482 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
483 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
484 purple_xmlnode_insert_data(child, value, -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_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
488 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
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
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
492 return node;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
493 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
494
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
495 static PurpleXmlNode *
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
496 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
497 PurpleXmlNode *node = NULL;
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
498 PurpleXmlNode *child = NULL;
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
499 char *value = NULL;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
500
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
501 node = purple_xmlnode_new("current_error");
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
502
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
503 if(error == NULL) {
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
504 return node;
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
505 }
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
506
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
507 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
508 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
509
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
510 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
511 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
512 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
513 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
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, "message");
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
516 purple_xmlnode_insert_data(child, error->message, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
517
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
518 return node;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
519 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
520
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
521 static void
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
522 setting_to_xmlnode(gpointer key, gpointer value, gpointer user_data)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
523 {
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
524 const char *name;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
525 PurpleAccountSetting *setting;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
526 PurpleXmlNode *node, *child;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
527 char buf[21];
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
528
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
529 name = (const char *)key;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
530 setting = (PurpleAccountSetting *)value;
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
531 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
532
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
533 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
534 purple_xmlnode_set_attrib(child, "name", name);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
535
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
536 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
537 purple_xmlnode_set_attrib(child, "type", "int");
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
538 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
539 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
540 } 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
541 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
542 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
543 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
544 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
545 -1);
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
546 } 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
547 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
548 g_snprintf(buf, sizeof(buf), "%d",
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
549 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
550 purple_xmlnode_insert_data(child, buf, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
551 }
6368
ab9f99269dfe [gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents: 6367
diff changeset
552 }
ab9f99269dfe [gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents: 6367
diff changeset
553
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
554 PurpleXmlNode *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
555 _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
556 PurpleXmlNode *node, *child;
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
557 char *data = NULL;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
558 const char *tmp;
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
559 PurpleProxyInfo *proxy_info;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
560
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
561 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
562
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
563 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
564 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
565 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
566 }
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
567
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
568 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
569 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
570 -1);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
571
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
572 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
573 purple_xmlnode_insert_data(child, account->username, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
574
41773
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
575 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
576 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
577 purple_xmlnode_insert_data(child, data, -1);
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
578 g_clear_pointer(&data, g_free);
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
579
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
580 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
581 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
582 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
583 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
584
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
585 tmp = purple_contact_info_get_alias(account->contact_info);
41961
0da91f053305 Make PurpleAccount subclass PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41960
diff changeset
586 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
587 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
588 purple_xmlnode_insert_data(child, tmp, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
589 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
590
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
591 if((tmp = purple_account_get_user_info(account)) != NULL) {
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
592 /* 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
593 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
594 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
595 }
34c1a17a91d7 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18190
diff changeset
596
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
597 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
598 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
599 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
600 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
601
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
602 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
603 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
604 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
605 }
34c1a17a91d7 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18190
diff changeset
606
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
607 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
608 purple_xmlnode_insert_child(node, child);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
609
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
610 return node;
5710
3c2bf5725bb0 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5707
diff changeset
611 }
3c2bf5725bb0 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5707
diff changeset
612
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
613 /******************************************************************************
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
614 * 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
615 *****************************************************************************/
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
616 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
617
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
618 static void
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
619 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
620 GParamSpec *pspec)
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
621 {
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
622 PurpleAccount *account = PURPLE_ACCOUNT(obj);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
623
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
624 switch(param_id) {
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
625 case PROP_ID:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
626 purple_account_set_id(account, g_value_get_string(value));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
627 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
628 case PROP_USERNAME:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
629 purple_account_set_username(account, g_value_get_string(value));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
630 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
631 case PROP_REQUIRE_PASSWORD:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
632 purple_account_set_require_password(account,
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
633 g_value_get_boolean(value));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
634 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
635 case PROP_ENABLED:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
636 purple_account_set_enabled(account, g_value_get_boolean(value));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
637 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
638 case PROP_CONNECTION:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
639 purple_account_set_connection(account, g_value_get_object(value));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
640 break;
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
641 case PROP_PROTOCOL:
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
642 purple_account_set_protocol(account, g_value_get_object(value));
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
643 break;
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
644 case PROP_PROTOCOL_ID:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
645 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
646 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
647 case PROP_USER_INFO:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
648 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
649 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
650 case PROP_BUDDY_ICON_PATH:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
651 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
652 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
653 case PROP_REMEMBER_PASSWORD:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
654 purple_account_set_remember_password(account,
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
655 g_value_get_boolean(value));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
656 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
657 case PROP_PROXY_INFO:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
658 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
659 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
660 case PROP_ERROR:
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
661 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
662 break;
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
663 default:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
664 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
665 break;
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
666 }
5710
3c2bf5725bb0 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5707
diff changeset
667 }
3c2bf5725bb0 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5707
diff changeset
668
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
669 static void
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
670 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
671 GParamSpec *pspec)
5580
a5a3e6dfb409 [gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents: 5574
diff changeset
672 {
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
673 PurpleAccount *account = PURPLE_ACCOUNT(obj);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
674
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
675 switch(param_id) {
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
676 case PROP_ID:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
677 g_value_set_string(value, purple_account_get_id(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
678 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
679 case PROP_USERNAME:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
680 g_value_set_string(value, purple_account_get_username(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
681 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
682 case PROP_CONTACT_INFO:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
683 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
684 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
685 case PROP_REQUIRE_PASSWORD:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
686 g_value_set_boolean(value,
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
687 purple_account_get_require_password(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
688 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
689 case PROP_ENABLED:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
690 g_value_set_boolean(value, purple_account_get_enabled(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
691 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
692 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
693 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
694 break;
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
695 case PROP_CONNECTION:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
696 g_value_set_object(value, purple_account_get_connection(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
697 break;
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
698 case PROP_PROTOCOL:
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
699 g_value_set_object(value, purple_account_get_protocol(account));
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
700 break;
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
701 case PROP_PROTOCOL_ID:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
702 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
703 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
704 case PROP_USER_INFO:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
705 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
706 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
707 case PROP_BUDDY_ICON_PATH:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
708 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
709 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
710 case PROP_REMEMBER_PASSWORD:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
711 g_value_set_boolean(value,
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
712 purple_account_get_remember_password(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
713 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
714 case PROP_PROXY_INFO:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
715 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
716 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
717 case PROP_ERROR:
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
718 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
719 break;
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
720 case PROP_CONNECTED:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
721 g_value_set_boolean(value, purple_account_is_connected(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
722 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
723 default:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
724 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
725 break;
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
726 }
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
727 }
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
728
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
729 static void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
730 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
731 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
732 delete_setting);
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
733 account->contact_info = purple_contact_info_new(NULL);
42696
ef2f771d8242 Remove PurpleAccountPresense (finally)
Gary Kramlich <grim@reaperworld.com>
parents: 42646
diff changeset
734 account->presence = purple_presence_new();
5580
a5a3e6dfb409 [gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents: 5574
diff changeset
735 }
5573
633880e3f137 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5565
diff changeset
736
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
737 static void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
738 purple_account_dispose(GObject *object) {
35512
8d6f1349b57a Fix crash on wrong password (backout 0f0d6ae2fb77)
Ankit Vani <a@nevitus.org>
parents: 35499
diff changeset
739 PurpleAccount *account = PURPLE_ACCOUNT(object);
8d6f1349b57a Fix crash on wrong password (backout 0f0d6ae2fb77)
Ankit Vani <a@nevitus.org>
parents: 35499
diff changeset
740
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
741 if(!purple_account_is_disconnected(account)) {
35512
8d6f1349b57a Fix crash on wrong password (backout 0f0d6ae2fb77)
Ankit Vani <a@nevitus.org>
parents: 35499
diff changeset
742 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
743 }
894c29e33300 Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
744
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
745 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
746 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
747 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
748
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
749 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
750 }
894c29e33300 Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
751
894c29e33300 Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
752 static void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
753 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
754 PurpleAccount *account = PURPLE_ACCOUNT(object);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
755
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
756 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
757
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
758 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
759 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
760 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
761
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
762 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
763
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
764 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
765
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
766 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
767 g_free(account->buddy_icon_path);
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
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_free(account->protocol_id);
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
770 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
771
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 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
773
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
774 G_OBJECT_CLASS(purple_account_parent_class)->finalize(object);
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
775 }
5874
5e19273d3c6f [gaim-migrate @ 6306]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
776
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
777 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
778 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
779 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
780
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
781 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
782 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
783 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
784 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
785
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
786 /**
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
787 * PurpleAccount:id:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
788 *
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
789 * The unique identifier for the account.
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
790 *
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
791 * Since: 3.0
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
792 */
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
793 properties[PROP_ID] = g_param_spec_string(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
794 "id", NULL, NULL,
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
795 NULL,
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
796 G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
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 /**
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
799 * PurpleAccount:username:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
800 *
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
801 * The username for the account.
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
802 *
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
803 * Since: 3.0
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 properties[PROP_USERNAME] = g_param_spec_string(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
806 "username", NULL, NULL,
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
807 NULL,
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
808 G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
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 /**
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
811 * PurpleAccount:contact-info:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
812 *
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
813 * The [class@ContactInfo] for the account.
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
814 *
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
815 * 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
816 * 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
817 * 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
818 *
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
819 * Since: 3.0
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
820 */
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
821 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
822 "contact-info", NULL, NULL,
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
823 PURPLE_TYPE_CONTACT_INFO,
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
824 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
825
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
826 /**
41773
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
827 * PurpleAccount:require-password:
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
828 *
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
829 * 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
830 * 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
831 * passwords.
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
832 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
833 * Since: 3.0
41773
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
834 */
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
835 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
836 "require-password", NULL, NULL,
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
837 FALSE,
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
838 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
839
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
840 /**
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
841 * PurpleAccount:user-info:
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
842 *
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
843 * The user information or profile for the account.
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
844 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
845 * Since: 3.0
42274
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 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
848 "user-info", NULL, NULL,
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
849 NULL,
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
850 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
851
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
852 /**
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
853 * PurpleAccount:buddy-icon-path:
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
854 *
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
855 * 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
856 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
857 * Since: 3.0
42274
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 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
860 "buddy-icon-path", NULL, NULL,
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
861 NULL,
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
862 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
863
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
864 /**
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
865 * PurpleAccount:enabled:
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
866 *
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
867 * 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
868 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
869 * Since: 3.0
42274
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 properties[PROP_ENABLED] = g_param_spec_boolean(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
872 "enabled", NULL, NULL,
41773
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
873 FALSE,
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
874 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
875
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
876 /**
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
877 * PurpleAccount:remember-password:
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
878 *
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
879 * 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
880 * configured [class@CredentialProvider].
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
881 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
882 * Since: 3.0
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
883 */
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
884 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
885 "remember-password", NULL, NULL,
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
886 FALSE,
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
887 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
888
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
889 /**
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
890 * 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
891 *
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
892 * 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
893 *
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
894 * 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
895 */
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
896 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
897 "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
898 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
899 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
900 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
901
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 /**
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
903 * PurpleAccount:connection:
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
904 *
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
905 * 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
906 * the account is offline.
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
907 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
908 * Since: 3.0
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
909 */
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
910 properties[PROP_CONNECTION] = g_param_spec_object(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
911 "connection", NULL, NULL,
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
912 PURPLE_TYPE_CONNECTION,
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
913 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
914
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
915 /**
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
916 * PurpleAccount:protocol:
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
917 *
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
918 * The protocol that this account is using.
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
919 *
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
920 * This will set [property@Account:protocol-id] to the
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
921 * [property@Protocol:id] of the new protocol.
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
922 *
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
923 * 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
924 * initialized by the first call to [method@Account.get_protocol].
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
925 *
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
926 * Since: 3.0
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
927 */
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
928 properties[PROP_PROTOCOL] = g_param_spec_object(
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
929 "protocol", NULL, NULL,
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
930 PURPLE_TYPE_PROTOCOL,
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
931 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
932
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
933 /**
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
934 * PurpleAccount:protocol-id:
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
935 *
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
936 * 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
937 *
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
938 * 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
939 * cleared.
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
940 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
941 * Since: 3.0
42274
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 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
944 "protocol-id", NULL, NULL,
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
945 NULL,
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
946 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
947
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
948 /**
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
949 * PurpleAccount:proxy-info:
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
950 *
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
951 * The [class@ProxyInfo] for this account.
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
952 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
953 * Since: 3.0
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
954 */
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
955 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
956 "proxy-info", NULL, NULL,
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
957 PURPLE_TYPE_PROXY_INFO,
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
958 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
959
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
960 /**
92fb22f0f0ab Add PurpleAccount::error property and remove "account-error-changed" and "account-status-changing" signals.
Gary Kramlich <grim@reaperworld.com>
parents: 41893
diff changeset
961 * 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
962 *
92fb22f0f0ab Add PurpleAccount::error property and remove "account-error-changed" and "account-status-changing" signals.
Gary Kramlich <grim@reaperworld.com>
parents: 41893
diff changeset
963 * 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
964 * 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
965 * made.
16d2e16bd24f Export Account::error
Gary Kramlich <grim@reaperworld.com>
parents: 42047
diff changeset
966 *
16d2e16bd24f Export Account::error
Gary Kramlich <grim@reaperworld.com>
parents: 42047
diff changeset
967 * 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
968 * 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
969 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
970 * 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
971 */
92fb22f0f0ab Add PurpleAccount::error property and remove "account-error-changed" and "account-status-changing" signals.
Gary Kramlich <grim@reaperworld.com>
parents: 41893
diff changeset
972 properties[PROP_ERROR] = g_param_spec_boxed(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
973 "error", NULL, NULL,
43008
d46e90e0757a Remove Purple.ConnectionErrorInfo
Gary Kramlich <grim@reaperworld.com>
parents: 43004
diff changeset
974 G_TYPE_ERROR,
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
975 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
976
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
977 /**
42268
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
978 * PurpleAccount:connected:
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
979 *
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
980 * 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
981 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
982 * 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
983 */
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
984 properties[PROP_CONNECTED] = g_param_spec_boolean(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
985 "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
986 FALSE,
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
987 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
988
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
989 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
990
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
991 /**
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
992 * 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
993 * @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
994 * @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
995 *
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
996 * 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
997 * changed.
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 * 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
1000 * 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
1001 * 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
1002 * 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
1003 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1004 * 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
1005 */
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1006 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
1007 "setting-changed",
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1008 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
1009 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
1010 NULL,
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1011 NULL,
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1012 NULL,
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1013 NULL,
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1014 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
1015 1,
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1016 G_TYPE_STRING);
42212
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1017
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1018 /**
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1019 * PurpleAccount::connected:
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1020 * @account: The account instance.
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1021 *
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1022 * 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
1023 * [property@Connection:state] has changed to
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1024 * %PURPLE_CONNECTION_STATE_CONNECTED.
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1025 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1026 * Since: 3.0
42212
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1027 */
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1028 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
1029 "connected",
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1030 G_OBJECT_CLASS_TYPE(klass),
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1031 G_SIGNAL_RUN_LAST,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1032 NULL,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1033 NULL,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1034 NULL,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1035 NULL,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1036 G_TYPE_NONE,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1037 0);
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1038
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1039 /**
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1040 * PurpleAccount::disconnected:
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1041 * @account: The account instance.
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1042 *
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1043 * 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
1044 * [property@Connection:state] has changed to
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1045 * %PURPLE_CONNECTION_STATE_DISCONNECTED.
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1046 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1047 * Since: 3.0
42212
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1048 */
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1049 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
1050 "disconnected",
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1051 G_OBJECT_CLASS_TYPE(klass),
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1052 G_SIGNAL_RUN_LAST,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1053 NULL,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1054 NULL,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1055 NULL,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1056 NULL,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1057 G_TYPE_NONE,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1058 0);
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1059 }
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1060
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1061 /******************************************************************************
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
1062 * 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
1063 *****************************************************************************/
5bc664b848a5 Work around an issue where accounts were attempting to connect when they were deserialized
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
1064
5bc664b848a5 Work around an issue where accounts were attempting to connect when they were deserialized
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
1065 /* 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
1066 * 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
1067 */
5bc664b848a5 Work around an issue where accounts were attempting to connect when they were deserialized
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
1068 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
1069 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
1070 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
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 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
1073 }
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 /******************************************************************************
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1076 * 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
1077 *****************************************************************************/
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
1078 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
1079 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
1080 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
1081
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
1082 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
1083 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
1084 }
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
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1086 PurpleAccount *
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
1087 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
1088 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
1089 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
1090
42047
72db1ae4ea4e Remove the account lookup on account new
Gary Kramlich <grim@reaperworld.com>
parents: 41984
diff changeset
1091 return g_object_new(
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1092 PURPLE_TYPE_ACCOUNT,
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1093 "username", username,
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1094 "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
1095 "enabled", FALSE,
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1096 NULL);
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6368
diff changeset
1097 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1098
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1099 const char *
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1100 purple_account_get_id(PurpleAccount *account) {
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1101 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1102
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1103 /* 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
1104 */
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1105 if(purple_strempty(account->id)) {
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1106 GChecksum *checksum = NULL;
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1107
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1108 checksum = g_checksum_new(G_CHECKSUM_SHA256);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1109
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1110 g_checksum_update(checksum, (const guchar *)account->protocol_id, -1);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1111 g_checksum_update(checksum, (const guchar *)account->username, -1);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1112
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1113 purple_account_set_id(account, g_checksum_get_string(checksum));
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 g_checksum_free(checksum);
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
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1118 return account->id;
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1119 }
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1120
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1121 const char *
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1122 purple_account_get_username(PurpleAccount *account) {
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1123 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
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->username;
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 void
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1129 purple_account_set_username(PurpleAccount *account, const char *username) {
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1130 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
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 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
1133 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
1134 }
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1135 }
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1136
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1137 PurpleContactInfo *
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1138 purple_account_get_contact_info(PurpleAccount *account) {
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1139 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1140
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1141 return account->contact_info;
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
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1144 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
1145 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
1146 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1147 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
1148
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1149 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
1150
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1151 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
1152
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1153 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
1154 purple_debug_info("account",
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1155 "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
1156 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
1157 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
1158 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1159
40804
5496016b3c00 Port libpurple from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents: 40803
diff changeset
1160 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
1161 if(protocol == NULL) {
42831
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1162 PurpleNotification *notification = NULL;
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1163 PurpleNotificationManager *manager = NULL;
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1164 char *value = NULL;
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1165
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1166 value = g_strdup_printf(_("Failed to load account '%s'"),
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1167 account->username);
42988
c2357ee36551 Replace Purple.Notification.new_generic with Purple.Notification.new
Gary Kramlich <grim@reaperworld.com>
parents: 42987
diff changeset
1168 notification = purple_notification_new(NULL, value);
42831
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1169 g_free(value);
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1170
42931
9e8b9ee3cfbb Update libpurple for the Purple.Notification deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42855
diff changeset
1171 purple_notification_set_account(notification, account);
9e8b9ee3cfbb Update libpurple for the Purple.Notification deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42855
diff changeset
1172
42831
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1173 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
1174 account->protocol_id);
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1175 purple_notification_set_subtitle(notification, value);
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
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1178 manager = purple_notification_manager_get_default();
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1179 purple_notification_manager_add(manager, notification);
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1180 g_clear_object(&notification);
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1181
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1182 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
1183 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1184
42646
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
1185 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
1186 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
1187 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1188
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1190 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
1191 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
1192
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1193 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1194 g_return_if_fail(!purple_account_is_disconnecting(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1195 g_return_if_fail(!purple_account_is_disconnected(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1196
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1197 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
1198 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
1199
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
1200 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
1201 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
1202
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1203 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
1204 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
1205 account->username,
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1206 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
1207 (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
1208 g_clear_error(&error);
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1209 }
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1210
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1211 purple_account_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
1212 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
1213 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
1214 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1215
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1216 void
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1217 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
1218 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
1219 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
1220
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1221 purple_account_disconnect(account);
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1222 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
1223 }
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1224
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1225 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
1226 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
1227 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
1228
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
1229 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
1230 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1231
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 void
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41500
diff changeset
1233 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
1234 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
1235
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1236 g_return_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
1237
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41500
diff changeset
1238 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
1239 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
1240 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1241
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1243 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
1244 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
1245 {
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
1246 char *primary;
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
1247 const char *username;
42127
18acb99a0fa6 Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42049
diff changeset
1248 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
1249 PurpleRequestField *field;
42128
118067ca0367 Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42127
diff changeset
1250 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
1251
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 /* 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
1253 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
1254
43074
0ff905ef6259 Fix uses of PurpleAccount as a PurpleContactInfo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43063
diff changeset
1255 username = purple_account_get_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
1256 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
1257 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
1258
42128
118067ca0367 Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42127
diff changeset
1259 page = purple_request_page_new();
42127
18acb99a0fa6 Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42049
diff changeset
1260 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
1261 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
1262
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1263 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
1264 NULL, FALSE);
42135
1a89a067a0d5 Add a PurpleRequestFieldString subclass
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42128
diff changeset
1265 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
1266 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
1267 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
1268 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
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_bool_new("remember", _("Save password"),
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1271 FALSE);
42127
18acb99a0fa6 Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42049
diff changeset
1272 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
1273
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1274 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
1275 _("Cancel"), cancel_cb,
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1276 purple_request_cpar_from_account(account),
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1277 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
1278 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
1279 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1280
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1281 void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1282 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
1283 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
1284
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1285 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
1286 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
1287 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
1288
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1289 purple_accounts_schedule_save();
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1290 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1291 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1292
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1293 void
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1294 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
1295 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
1296
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1297 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
1298 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
1299 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
1300
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1301 purple_accounts_schedule_save();
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1302 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1303 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1304
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1305 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
1306 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
1307 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1308 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
1309 g_return_if_fail(protocol_id != NULL);
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1310 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
1311
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1312 if(g_set_str(&account->protocol_id, protocol_id)) {
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1313 GObject *obj = G_OBJECT(account);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1314
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1315 /* Setting this directly clears any cached protocol. */
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1316 g_clear_object(&account->protocol);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1317
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1318 g_object_freeze_notify(obj);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1319 g_object_notify_by_pspec(obj, properties[PROP_PROTOCOL_ID]);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1320 g_object_notify_by_pspec(obj, properties[PROP_PROTOCOL]);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1321 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
1322
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1323 purple_accounts_schedule_save();
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1324 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1325 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1326
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1327 void
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1328 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
1329 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
1330
42212
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1331 /* If we got the same pointer, bail. */
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1332 if(account->gc == gc) {
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1333 return;
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1334 }
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1335
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1336 /* Remove our old signal handler. */
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1337 if(PURPLE_IS_CONNECTION(account->gc)) {
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1338 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
1339 purple_account_connection_state_cb,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1340 account);
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
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1343 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
1344 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
1345
42212
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1346 if(PURPLE_IS_CONNECTION(account->gc)) {
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1347 g_signal_connect(account->gc, "notify::state",
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1348 G_CALLBACK(purple_account_connection_state_cb),
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1349 account);
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1350 }
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1351
42268
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
1352 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
1353 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
1354 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
1355 g_object_thaw_notify(obj);
42212
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1356 } else {
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1357 /* 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
1358 if(PURPLE_IS_CONNECTION(account->gc)) {
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1359 g_signal_connect(account->gc, "notify::state",
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1360 G_CALLBACK(purple_account_connection_state_cb),
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1361 account);
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1362 }
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1363 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1364 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1365
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1366 void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1367 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
1368 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
1369
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
1370 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
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 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
1373 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
1374
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1375 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
1376 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1377
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1378 void
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1379 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
1380 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
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 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
1383
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
1384 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
1385 account->enabled = value;
41891
a45d6db4f857 Propagate the PurpleAccount::notify signal via PurpleAccountManager::account-changed
Gary Kramlich <grim@reaperworld.com>
parents: 41869
diff changeset
1386 if(was_enabled != value) {
a45d6db4f857 Propagate the PurpleAccount::notify signal via PurpleAccountManager::account-changed
Gary Kramlich <grim@reaperworld.com>
parents: 41869
diff changeset
1387 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
1388 }
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1389
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1390 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
1391 purple_account_connect(account);
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1392 } 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
1393 purple_account_disconnect(account);
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1394 }
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1395
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1396 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
1397 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1398
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1399 void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1400 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
1401 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
1402
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
1403 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
1404 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
1405 properties[PROP_PROXY_INFO]);
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1406
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1407 purple_accounts_schedule_save();
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1408 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1409 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1410
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1411 void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1412 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
1413 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
1414
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1415 g_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
1416 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
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 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
1419
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1420 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
1421 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
1422
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
1423 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
1424
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1425 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
1426
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1428 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1429
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1430 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
1431 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
1432 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
1433 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
1437 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
1438
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1439 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
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 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
1442 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
1443
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
1444 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
1445
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1446 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
1447
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1448 purple_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
1449 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1450
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1451 void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1452 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
1453 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
1454 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1456
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1457 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1458 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
1459
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1460 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
1461
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1462 g_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
1463 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
1464
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
1465 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
1466
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1467 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
1468
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1469 purple_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
1470 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1471
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1472 gboolean
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1473 purple_account_is_connected(PurpleAccount *account) {
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1474 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
1475
41812
c3cd920261b6 Fix the namespace of the PurpleConnectionState enum constants
Gary Kramlich <grim@reaperworld.com>
parents: 41798
diff changeset
1476 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
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_connecting(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_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
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_disconnected(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_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
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 const char *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1494 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
1495 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
1496
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
1497 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
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_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
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->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
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_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
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->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
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
40803
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1514 PurpleProtocol *
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1515 purple_account_get_protocol(PurpleAccount *account) {
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1516 PurpleProtocolManager *manager = NULL;
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1517
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1518 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
1519
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1520 if(!PURPLE_IS_PROTOCOL(account->protocol)) {
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1521 manager = purple_protocol_manager_get_default();
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1522 if(manager != NULL) {
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1523 PurpleProtocol *protocol = NULL;
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1524
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1525 protocol = purple_protocol_manager_find(manager,
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1526 account->protocol_id);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1527
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1528 purple_account_set_protocol(account, protocol);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1529 }
42853
051b8f911409 Remove the test ui from the account manager tests
Gary Kramlich <grim@reaperworld.com>
parents: 42841
diff changeset
1530 }
40803
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1531
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1532 return account->protocol;
40803
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1533 }
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1534
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
1535 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
1536 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
1537 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
1538 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
1539
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
1540 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
1541 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
1542 }
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
1543
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
1544 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
1545 }
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
1546
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 PurpleConnection *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1548 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
1549 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
1550
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
1551 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
1552 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1553
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1554 gboolean
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1555 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
1556 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
1557
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
1558 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
1559 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1560
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1561 gboolean
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1562 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
1563 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
1564
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
1565 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
1566 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1567
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1568 PurpleProxyInfo *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1569 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
1570 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
1571
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
1572 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
1573 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1574
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1575 PurplePresence *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1576 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
1577 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
1578
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
1579 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
1580 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1581
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1582 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
1583 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
1584 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
1585 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1586 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
1587
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1588 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
1589 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
1590
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
1591 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
1592
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1593 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
1594 return default_value;
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1595 }
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1596
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1597 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
1598
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1599 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
1600 }
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1601
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1602 const char *
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1603 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
1604 const char *default_value)
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1605 {
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1606 PurpleAccountSetting *setting;
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1607
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1608 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
1609 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
1610
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1611 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
1612
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1613 if(setting == NULL) {
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1614 return default_value;
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1615 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1617 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
1618
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1619 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
1620 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1621
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1622 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
1623 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
1624 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
1625 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1626 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
1627
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1628 g_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
1629 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
1630
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
1631 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
1632
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1633 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
1634 return default_value;
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1635 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1636
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1637 g_return_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
1638
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1639 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 void
42992
402dbf6669b3 Remove Purple.ProtocolServer
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
1643 purple_account_change_password(PurpleAccount *account,
402dbf6669b3 Remove Purple.ProtocolServer
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
1644 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
1645 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
1646 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1647 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
1648
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1649 /* 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
1650 * implement the change password stuff.
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1651 */
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1652 manager = purple_credential_manager_get_default();
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1653 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
1654 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
1655 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1656
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1657 GError *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1658 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
1659 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
1660
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1661 return account->error;
43001
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
1662 }
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
1663
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 void
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1665 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
1666 PurpleNotificationManager *manager = NULL;
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1667
43001
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
1668 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
1669
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1670 if(account->error == error) {
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1671 return;
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1672 }
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1673
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1674 /* Set the new error. */
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1675 g_clear_error(&account->error);
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1676 account->error = error;
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1677
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1678 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
1679
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1680 /* 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
1681 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
1682 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
1683 purple_notification_manager_remove(manager,
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1684 account->error_notification);
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1685 }
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1686
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1687 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
1688 }
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1689
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1690 /* 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
1691 if(error != NULL) {
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1692 PurpleNotification *notification = NULL;
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1693
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1694 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
1695
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1696 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
1697 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
1698 }
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1699
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1700 account->error_notification = notification;
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
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1703 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
1704
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1705 purple_accounts_schedule_save();
43001
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
1706 }
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
1707
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
1708 void
41773
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1709 purple_account_set_require_password(PurpleAccount *account,
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1710 gboolean require_password)
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1711 {
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1712 gboolean old = FALSE;
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1713
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1714 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
1715
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1716 old = account->require_password;
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1717 account->require_password = require_password;
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1718
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1719 if(old != require_password) {
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1720 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
1721 properties[PROP_REQUIRE_PASSWORD]);
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1722 }
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1723 }
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1724
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1725 gboolean
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1726 purple_account_get_require_password(PurpleAccount *account) {
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1727 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
1728
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1729 return account->require_password;
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1730 }
41920
29ebd938c592 Add a contact property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41914
diff changeset
1731
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1732 void
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1733 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
1734 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
1735
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1736 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
1737 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
1738 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
1739 }
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1740
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1741 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
1742
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1743 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
1744 }
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1745
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1746 void
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1747 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
1748 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
1749
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1750 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
1751
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1752 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
1753 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
1754 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
1755
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1756 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
1757 "(%s) when not frozen",
43074
0ff905ef6259 Fix uses of PurpleAccount as a PurpleContactInfo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43063
diff changeset
1758 purple_account_get_username(account),
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1759 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
1760
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1761 return;
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1762 }
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 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
1765 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
1766 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
1767
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1768 return;
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
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1771 /* 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
1772 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
1773 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
1774 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
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_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
1777 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
1778
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1779 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
1780 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
1781 }
41949
8733057a54f0 Fix an invalid free in the account setting thaw function
Gary Kramlich <grim@reaperworld.com>
parents: 41946
diff changeset
1782 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
1783
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1784 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
1785
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1786 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
1787 }
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1788
43091
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1789 int
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1790 purple_account_compare(PurpleAccount *a, PurpleAccount *b) {
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1791 if (a != NULL && b == NULL) {
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1792 return -1;
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1793 }
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1794 if (a == NULL && b != NULL) {
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1795 return 1;
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1796 }
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1797 if (a == NULL && b == NULL) {
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1798 return 0;
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1799 }
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1800
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1801 return g_strcmp0(a->id, b->id);
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1802 }
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1803
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1804 gboolean
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1805 purple_account_equal(PurpleAccount *a, PurpleAccount *b) {
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1806 return purple_account_compare(a, b) == 0;
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1807 }

mercurial