libpurple/purpleaccount.c

Fri, 03 Jan 2025 00:38:29 -0600

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Fri, 03 Jan 2025 00:38:29 -0600
changeset 43127
eae3279e871c
parent 43091
f77300d83505
child 43130
ad73c9be8cb1
permissions
-rw-r--r--

Use g_timeout_add_once where possible

In cases where `G_SOURCE_REMOVE` is always returned and no destroy func is needed, then we can use these simplifying functions instead.

Also, for callbacks, use `G_SOURCE_CONTINUE`/`G_SOURCE_REMOVE` instead of `TRUE`/`FALSE`.

These were mostly added in GLib 2.74, except `g_timeout_add_seconds_once` is from 2.78.

Testing Done:
Ran `ninja turtles`.

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

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
41717
ce790d508898 Minor cleanup to account cleanup and connection error handling
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41712
diff changeset
756 purple_debug_info("account", "Destroying account %p", account);
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
757
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
758 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
759
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
760 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
761 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
762 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
763
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
764 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
765
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
766 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
767
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
768 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
769 g_free(account->buddy_icon_path);
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
770
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 g_free(account->protocol_id);
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
772 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
773
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
774 g_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
775
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
776 G_OBJECT_CLASS(purple_account_parent_class)->finalize(object);
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
777 }
5874
5e19273d3c6f [gaim-migrate @ 6306]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
778
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
779 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
780 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
781 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
782
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
783 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
784 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
785 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
786 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
787
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
788 /**
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
789 * PurpleAccount:id:
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 * The unique identifier for the account.
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 * Since: 3.0
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
794 */
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
795 properties[PROP_ID] = g_param_spec_string(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
796 "id", NULL, NULL,
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
797 NULL,
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
798 G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
799
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
800 /**
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
801 * PurpleAccount:username:
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 * The username for the account.
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 * Since: 3.0
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
806 */
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
807 properties[PROP_USERNAME] = g_param_spec_string(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
808 "username", NULL, NULL,
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
809 NULL,
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
810 G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
811
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
812 /**
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
813 * PurpleAccount:contact-info:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
814 *
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
815 * The [class@ContactInfo] for the account.
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
816 *
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
817 * 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
818 * 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
819 * 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
820 *
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
821 * Since: 3.0
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
822 */
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
823 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
824 "contact-info", NULL, NULL,
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
825 PURPLE_TYPE_CONTACT_INFO,
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
826 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
827
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
828 /**
41773
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
829 * PurpleAccount:require-password:
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
830 *
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
831 * 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
832 * 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
833 * passwords.
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
834 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
835 * Since: 3.0
41773
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
836 */
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
837 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
838 "require-password", NULL, NULL,
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
839 FALSE,
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
840 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
841
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 * PurpleAccount:user-info:
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
844 *
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
845 * The user information or profile for the account.
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
846 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
847 * Since: 3.0
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
848 */
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
849 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
850 "user-info", NULL, NULL,
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
851 NULL,
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
852 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
853
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
854 /**
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
855 * PurpleAccount:buddy-icon-path:
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
856 *
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
857 * 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
858 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
859 * Since: 3.0
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
860 */
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
861 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
862 "buddy-icon-path", NULL, NULL,
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
863 NULL,
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
864 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
865
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
866 /**
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
867 * PurpleAccount:enabled:
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
868 *
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
869 * 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
870 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
871 * Since: 3.0
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
872 */
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
873 properties[PROP_ENABLED] = g_param_spec_boolean(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
874 "enabled", NULL, NULL,
41773
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
875 FALSE,
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
876 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
877
42274
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 * PurpleAccount:remember-password:
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
880 *
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
881 * 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
882 * configured [class@CredentialProvider].
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
883 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
884 * Since: 3.0
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
885 */
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
886 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
887 "remember-password", NULL, NULL,
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
888 FALSE,
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
889 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
890
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
891 /**
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
892 * 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
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 * 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
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 * 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
897 */
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 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
899 "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
900 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
901 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
902 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
903
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
904 /**
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
905 * PurpleAccount:connection:
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
906 *
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
907 * 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
908 * the account is offline.
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
909 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
910 * Since: 3.0
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
911 */
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
912 properties[PROP_CONNECTION] = g_param_spec_object(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
913 "connection", NULL, NULL,
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
914 PURPLE_TYPE_CONNECTION,
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
915 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
916
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
917 /**
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
918 * PurpleAccount:protocol:
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 * The protocol that this account is using.
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
921 *
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
922 * This will set [property@Account:protocol-id] to the
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
923 * [property@Protocol:id] of the new protocol.
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
924 *
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
925 * 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
926 * initialized by the first call to [method@Account.get_protocol].
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 * Since: 3.0
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
929 */
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
930 properties[PROP_PROTOCOL] = g_param_spec_object(
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
931 "protocol", NULL, NULL,
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
932 PURPLE_TYPE_PROTOCOL,
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
933 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
934
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
935 /**
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
936 * PurpleAccount:protocol-id:
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
937 *
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
938 * 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
939 *
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
940 * 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
941 * cleared.
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
942 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
943 * Since: 3.0
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
944 */
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
945 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
946 "protocol-id", NULL, NULL,
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
947 NULL,
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
948 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
949
42274
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 * PurpleAccount:proxy-info:
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
952 *
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
953 * The [class@ProxyInfo] for this account.
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
954 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
955 * Since: 3.0
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
956 */
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
957 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
958 "proxy-info", NULL, NULL,
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
959 PURPLE_TYPE_PROXY_INFO,
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
960 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
961
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
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 * 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
964 *
92fb22f0f0ab Add PurpleAccount::error property and remove "account-error-changed" and "account-status-changing" signals.
Gary Kramlich <grim@reaperworld.com>
parents: 41893
diff changeset
965 * 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
966 * 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
967 * made.
16d2e16bd24f Export Account::error
Gary Kramlich <grim@reaperworld.com>
parents: 42047
diff changeset
968 *
16d2e16bd24f Export Account::error
Gary Kramlich <grim@reaperworld.com>
parents: 42047
diff changeset
969 * 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
970 * 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
971 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
972 * 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
973 */
92fb22f0f0ab Add PurpleAccount::error property and remove "account-error-changed" and "account-status-changing" signals.
Gary Kramlich <grim@reaperworld.com>
parents: 41893
diff changeset
974 properties[PROP_ERROR] = g_param_spec_boxed(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
975 "error", NULL, NULL,
43008
d46e90e0757a Remove Purple.ConnectionErrorInfo
Gary Kramlich <grim@reaperworld.com>
parents: 43004
diff changeset
976 G_TYPE_ERROR,
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
977 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
978
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
979 /**
42268
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
980 * PurpleAccount:connected:
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
981 *
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
982 * 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
983 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
984 * 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
985 */
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
986 properties[PROP_CONNECTED] = g_param_spec_boolean(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
987 "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
988 FALSE,
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
989 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
990
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
991 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
992
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
993 /**
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
994 * 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
995 * @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
996 * @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
997 *
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
998 * 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
999 * changed.
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1000 *
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1001 * 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
1002 * 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
1003 * 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
1004 * 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
1005 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1006 * 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
1007 */
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1008 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
1009 "setting-changed",
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1010 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
1011 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
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 NULL,
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1015 NULL,
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_NONE,
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1017 1,
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1018 G_TYPE_STRING);
42212
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1019
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1020 /**
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1021 * PurpleAccount::connected:
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1022 * @account: The account instance.
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1023 *
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1024 * 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
1025 * [property@Connection:state] has changed to
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1026 * %PURPLE_CONNECTION_STATE_CONNECTED.
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1027 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1028 * Since: 3.0
42212
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1029 */
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1030 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
1031 "connected",
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1032 G_OBJECT_CLASS_TYPE(klass),
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1033 G_SIGNAL_RUN_LAST,
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 NULL,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1037 NULL,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1038 G_TYPE_NONE,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1039 0);
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1040
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1041 /**
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1042 * PurpleAccount::disconnected:
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1043 * @account: The account instance.
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1044 *
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1045 * 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
1046 * [property@Connection:state] has changed to
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1047 * %PURPLE_CONNECTION_STATE_DISCONNECTED.
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1048 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1049 * Since: 3.0
42212
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1050 */
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1051 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
1052 "disconnected",
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1053 G_OBJECT_CLASS_TYPE(klass),
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1054 G_SIGNAL_RUN_LAST,
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 NULL,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1058 NULL,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1059 G_TYPE_NONE,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1060 0);
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1061 }
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1062
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1063 /******************************************************************************
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
1064 * 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
1065 *****************************************************************************/
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
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 /* 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
1068 * 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
1069 */
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 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
1071 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
1072 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
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 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
1075 }
5bc664b848a5 Work around an issue where accounts were attempting to connect when they were deserialized
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
1076
5bc664b848a5 Work around an issue where accounts were attempting to connect when they were deserialized
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
1077 /******************************************************************************
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1078 * 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
1079 *****************************************************************************/
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
1080 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
1081 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
1082 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
1083
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 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
1085 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
1086 }
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1087
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1088 PurpleAccount *
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
1089 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
1090 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
1091 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
1092
42047
72db1ae4ea4e Remove the account lookup on account new
Gary Kramlich <grim@reaperworld.com>
parents: 41984
diff changeset
1093 return g_object_new(
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1094 PURPLE_TYPE_ACCOUNT,
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1095 "username", username,
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1096 "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
1097 "enabled", FALSE,
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1098 NULL);
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6368
diff changeset
1099 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1100
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1101 const char *
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1102 purple_account_get_id(PurpleAccount *account) {
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1103 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1104
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1105 /* 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
1106 */
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1107 if(purple_strempty(account->id)) {
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1108 GChecksum *checksum = NULL;
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 checksum = g_checksum_new(G_CHECKSUM_SHA256);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1111
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1112 g_checksum_update(checksum, (const guchar *)account->protocol_id, -1);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1113 g_checksum_update(checksum, (const guchar *)account->username, -1);
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 purple_account_set_id(account, g_checksum_get_string(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 g_checksum_free(checksum);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1118 }
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1119
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1120 return account->id;
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1121 }
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1122
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1123 const char *
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1124 purple_account_get_username(PurpleAccount *account) {
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1125 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1126
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1127 return account->username;
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1128 }
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1129
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1130 void
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1131 purple_account_set_username(PurpleAccount *account, const char *username) {
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1132 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1133
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1134 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
1135 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
1136 }
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1137 }
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1138
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1139 PurpleContactInfo *
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1140 purple_account_get_contact_info(PurpleAccount *account) {
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1141 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1142
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1143 return account->contact_info;
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1144 }
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1145
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1147 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
1148 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1149 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
1150
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1151 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
1152
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1153 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
1154
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1155 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
1156 purple_debug_info("account",
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1157 "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
1158 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
1159 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
1160 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1161
40804
5496016b3c00 Port libpurple from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents: 40803
diff changeset
1162 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
1163 if(protocol == NULL) {
42831
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1164 PurpleNotification *notification = NULL;
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1165 PurpleNotificationManager *manager = NULL;
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1166 char *value = NULL;
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1167
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1168 value = g_strdup_printf(_("Failed to load account '%s'"),
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1169 account->username);
42988
c2357ee36551 Replace Purple.Notification.new_generic with Purple.Notification.new
Gary Kramlich <grim@reaperworld.com>
parents: 42987
diff changeset
1170 notification = purple_notification_new(NULL, value);
42831
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1171 g_free(value);
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1172
42931
9e8b9ee3cfbb Update libpurple for the Purple.Notification deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42855
diff changeset
1173 purple_notification_set_account(notification, account);
9e8b9ee3cfbb Update libpurple for the Purple.Notification deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42855
diff changeset
1174
42831
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1175 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
1176 account->protocol_id);
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1177 purple_notification_set_subtitle(notification, value);
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1178 g_free(value);
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1179
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1180 manager = purple_notification_manager_get_default();
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1181 purple_notification_manager_add(manager, notification);
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1182 g_clear_object(&notification);
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1183
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1185 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1186
42646
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
1187 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
1188 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
1189 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1190
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1191 void
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
1192 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
1193 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
1194
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1195 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1196 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
1197 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
1198
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1199 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
1200 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
1201
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
1202 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
1203 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
1204
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1205 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
1206 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
1207 account->username,
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1208 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
1209 (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
1210 g_clear_error(&error);
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1211 }
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1212
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1213 purple_account_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
1214 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
1215 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
1216 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1217
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1218 void
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1219 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
1220 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
1221 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
1222
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1223 purple_account_disconnect(account);
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1224 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
1225 }
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1226
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1228 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
1229 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
1230
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
1231 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
1232 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1233
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1234 void
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41500
diff changeset
1235 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
1236 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
1237
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1238 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
1239
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41500
diff changeset
1240 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
1241 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
1242 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1243
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1244 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
1245 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
1246 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
1247 {
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
1248 char *primary;
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
1249 const char *username;
42127
18acb99a0fa6 Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42049
diff changeset
1250 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
1251 PurpleRequestField *field;
42128
118067ca0367 Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42127
diff changeset
1252 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
1253
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1254 /* 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
1255 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
1256
43074
0ff905ef6259 Fix uses of PurpleAccount as a PurpleContactInfo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43063
diff changeset
1257 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
1258 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
1259 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
1260
42128
118067ca0367 Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42127
diff changeset
1261 page = purple_request_page_new();
42127
18acb99a0fa6 Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42049
diff changeset
1262 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
1263 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
1264
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1265 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
1266 NULL, FALSE);
42135
1a89a067a0d5 Add a PurpleRequestFieldString subclass
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42128
diff changeset
1267 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
1268 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
1269 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
1270 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
1271
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1272 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
1273 FALSE);
42127
18acb99a0fa6 Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42049
diff changeset
1274 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
1275
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1276 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
1277 _("Cancel"), cancel_cb,
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1278 purple_request_cpar_from_account(account),
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1279 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
1280 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
1281 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1282
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1284 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
1285 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
1286
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1287 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
1288 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
1289 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
1290
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1291 purple_accounts_schedule_save();
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1292 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1293 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1294
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1295 void
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1296 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
1297 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1298
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1299 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
1300 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
1301 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
1302
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1303 purple_accounts_schedule_save();
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1304 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1308 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
1309 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1310 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
1311 g_return_if_fail(protocol_id != NULL);
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1312 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
1313
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1314 if(g_set_str(&account->protocol_id, protocol_id)) {
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1315 GObject *obj = G_OBJECT(account);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1316
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1317 /* Setting this directly clears any cached protocol. */
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1318 g_clear_object(&account->protocol);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1319
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1320 g_object_freeze_notify(obj);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1321 g_object_notify_by_pspec(obj, properties[PROP_PROTOCOL_ID]);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1322 g_object_notify_by_pspec(obj, properties[PROP_PROTOCOL]);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1323 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
1324
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1325 purple_accounts_schedule_save();
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1326 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1327 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1328
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1329 void
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1330 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
1331 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
1332
42212
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1333 /* If we got the same pointer, bail. */
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1334 if(account->gc == gc) {
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1335 return;
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1336 }
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1337
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1338 /* Remove our old signal handler. */
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1339 if(PURPLE_IS_CONNECTION(account->gc)) {
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1340 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
1341 purple_account_connection_state_cb,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1342 account);
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1343 }
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1344
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1345 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
1346 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
1347
42212
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1348 if(PURPLE_IS_CONNECTION(account->gc)) {
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1349 g_signal_connect(account->gc, "notify::state",
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1350 G_CALLBACK(purple_account_connection_state_cb),
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1351 account);
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1352 }
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1353
42268
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
1354 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
1355 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
1356 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
1357 g_object_thaw_notify(obj);
42212
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1358 } else {
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1359 /* 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
1360 if(PURPLE_IS_CONNECTION(account->gc)) {
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1361 g_signal_connect(account->gc, "notify::state",
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1362 G_CALLBACK(purple_account_connection_state_cb),
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1363 account);
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1364 }
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1365 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1366 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1367
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1369 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
1370 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
1371
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
1372 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
1373
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1374 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
1375 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
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 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
1378 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1379
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 void
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1381 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
1382 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
1383
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1384 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
1385
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
1386 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
1387 account->enabled = value;
41891
a45d6db4f857 Propagate the PurpleAccount::notify signal via PurpleAccountManager::account-changed
Gary Kramlich <grim@reaperworld.com>
parents: 41869
diff changeset
1388 if(was_enabled != value) {
a45d6db4f857 Propagate the PurpleAccount::notify signal via PurpleAccountManager::account-changed
Gary Kramlich <grim@reaperworld.com>
parents: 41869
diff changeset
1389 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
1390 }
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1391
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1392 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
1393 purple_account_connect(account);
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1394 } 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
1395 purple_account_disconnect(account);
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1396 }
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1397
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1398 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
1399 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1400
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1402 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
1403 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
1404
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
1405 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
1406 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
1407 properties[PROP_PROXY_INFO]);
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1408
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1409 purple_accounts_schedule_save();
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1410 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1412
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1413 void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1414 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
1415 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
1416
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1417 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
1418 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
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 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
1421
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1422 g_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
1423 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
1424
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
1425 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
1426
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1427 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
1428
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1429 purple_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
1430 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1431
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1432 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
1433 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
1434 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
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 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
1437
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1438 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
1439 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
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 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
1442
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1443 g_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
1444 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
1445
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
1446 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
1447
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1448 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
1449
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1451 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1452
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1453 void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1454 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
1455 gboolean value)
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1456 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1458
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1459 g_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
1460 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
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 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
1463
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1464 g_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
1465 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
1466
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
1467 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
1468
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1469 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
1470
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1471 purple_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
1472 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1473
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1474 gboolean
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1475 purple_account_is_connected(PurpleAccount *account) {
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1476 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
1477
41812
c3cd920261b6 Fix the namespace of the PurpleConnectionState enum constants
Gary Kramlich <grim@reaperworld.com>
parents: 41798
diff changeset
1478 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
1479 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1480
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1481 gboolean
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1482 purple_account_is_connecting(PurpleAccount *account) {
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1483 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
1484
41812
c3cd920261b6 Fix the namespace of the PurpleConnectionState enum constants
Gary Kramlich <grim@reaperworld.com>
parents: 41798
diff changeset
1485 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
1486 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1487
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1488 gboolean
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1489 purple_account_is_disconnected(PurpleAccount *account) {
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1490 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
1491
41812
c3cd920261b6 Fix the namespace of the PurpleConnectionState enum constants
Gary Kramlich <grim@reaperworld.com>
parents: 41798
diff changeset
1492 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
1493 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1494
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 const char *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1496 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
1497 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
1498
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
1499 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
1500 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1501
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1502 const char *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1503 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
1504 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
1505
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
1506 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
1507 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1508
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 const char *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1510 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
1511 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
1512
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
1513 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
1514 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1515
40803
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1516 PurpleProtocol *
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1517 purple_account_get_protocol(PurpleAccount *account) {
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1518 PurpleProtocolManager *manager = NULL;
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1519
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1520 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
1521
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1522 if(!PURPLE_IS_PROTOCOL(account->protocol)) {
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1523 manager = purple_protocol_manager_get_default();
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1524 if(manager != NULL) {
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1525 PurpleProtocol *protocol = NULL;
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1526
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1527 protocol = purple_protocol_manager_find(manager,
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1528 account->protocol_id);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1529
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1530 purple_account_set_protocol(account, protocol);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1531 }
42853
051b8f911409 Remove the test ui from the account manager tests
Gary Kramlich <grim@reaperworld.com>
parents: 42841
diff changeset
1532 }
40803
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1533
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1534 return account->protocol;
40803
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1535 }
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1536
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
1537 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
1538 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
1539 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
1540 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
1541
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 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
1543 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
1544 }
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 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
1547 }
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
1548
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 PurpleConnection *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1550 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
1551 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
1552
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
1553 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
1554 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1555
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 gboolean
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1557 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
1558 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
1559
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
1560 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
1561 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1562
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1563 gboolean
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1564 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
1565 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
1566
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
1567 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
1568 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1569
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1570 PurpleProxyInfo *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1571 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
1572 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
1573
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
1574 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
1575 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1576
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 PurplePresence *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1578 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
1579 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
1580
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
1581 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
1582 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1583
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1584 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
1585 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
1586 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
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 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
1589
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1591 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
1592
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
1593 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
1594
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1595 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
1596 return default_value;
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1597 }
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 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
1600
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1601 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
1602 }
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1603
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1604 const char *
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1605 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
1606 const char *default_value)
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 PurpleAccountSetting *setting;
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1609
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1610 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
1611 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
1612
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1613 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
1614
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1615 if(setting == NULL) {
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1616 return default_value;
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1617 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
1622 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1623
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1624 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
1625 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
1626 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
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 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
1629
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1631 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
1632
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
1633 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
1634
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1635 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
1636 return default_value;
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1637 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
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 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
1642 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1643
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1644 void
42992
402dbf6669b3 Remove Purple.ProtocolServer
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
1645 purple_account_change_password(PurpleAccount *account,
402dbf6669b3 Remove Purple.ProtocolServer
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
1646 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
1647 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
1648 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1649 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
1650
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1651 /* 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
1652 * implement the change password stuff.
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1653 */
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1654 manager = purple_credential_manager_get_default();
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1655 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
1656 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
1657 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1658
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1659 GError *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1660 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
1661 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
1662
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1663 return account->error;
43001
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
1664 }
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
1665
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1666 void
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1667 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
1668 PurpleNotificationManager *manager = NULL;
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1669
43001
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
1670 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
1671
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1672 if(account->error == error) {
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1673 return;
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1674 }
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1675
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1676 /* Set the new error. */
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1677 g_clear_error(&account->error);
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1678 account->error = error;
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 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
1681
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1682 /* 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
1683 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
1684 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
1685 purple_notification_manager_remove(manager,
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1686 account->error_notification);
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1687 }
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 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
1690 }
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1691
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1692 /* 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
1693 if(error != NULL) {
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1694 PurpleNotification *notification = NULL;
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 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
1697
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1698 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
1699 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
1700 }
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 account->error_notification = notification;
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1703 }
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1704
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1705 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
1706
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1707 purple_accounts_schedule_save();
43001
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
1708 }
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
1709
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
1710 void
41773
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1711 purple_account_set_require_password(PurpleAccount *account,
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1712 gboolean require_password)
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 gboolean old = FALSE;
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 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
1717
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1718 old = account->require_password;
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1719 account->require_password = require_password;
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1720
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1721 if(old != require_password) {
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1722 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
1723 properties[PROP_REQUIRE_PASSWORD]);
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 }
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1726
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1727 gboolean
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1728 purple_account_get_require_password(PurpleAccount *account) {
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1729 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
1730
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1731 return account->require_password;
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1732 }
41920
29ebd938c592 Add a contact property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41914
diff changeset
1733
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1734 void
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1735 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
1736 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
1737
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1738 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
1739 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
1740 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
1741 }
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 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
1744
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1745 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
1746 }
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1747
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1748 void
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1749 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
1750 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
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_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
1753
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1754 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
1755 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
1756 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
1757
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1758 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
1759 "(%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
1760 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
1761 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
1762
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1763 return;
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1764 }
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1765
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1766 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
1767 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
1768 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
1769
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1770 return;
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1771 }
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1772
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1773 /* 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
1774 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
1775 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
1776 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
1777
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1778 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
1779 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
1780
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1781 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
1782 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
1783 }
41949
8733057a54f0 Fix an invalid free in the account setting thaw function
Gary Kramlich <grim@reaperworld.com>
parents: 41946
diff changeset
1784 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
1785
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1786 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
1787
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1788 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
1789 }
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1790
43091
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1791 int
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1792 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
1793 if (a != NULL && b == NULL) {
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1794 return -1;
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1795 }
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1796 if (a == NULL && b != NULL) {
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1797 return 1;
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1798 }
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1799 if (a == NULL && b == NULL) {
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1800 return 0;
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1801 }
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 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
1804 }
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1805
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1806 gboolean
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1807 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
1808 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
1809 }

mercurial