libpurple/purpleaccount.c

Tue, 22 Apr 2025 00:09:40 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Tue, 22 Apr 2025 00:09:40 -0500
changeset 43237
c641f6bea7dd
parent 43160
a9cc7d8325ba
child 43239
065835cee689
permissions
-rw-r--r--

Move the connection-state implementation to Purple.Account

This removes the connection-state implementation from Purple.Connection to
Purple.Account.

Testing Done:
Connected a demo and ircv3 account without issues.

Bugs closed: PIDGIN-17988

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

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;
43160
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
57 char *name;
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
58 char *username;
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
59 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
60
41773
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
61 gboolean require_password;
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
62 char *user_info;
35470
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
63
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
64 char *buddy_icon_path;
35470
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
65
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
66 gboolean enabled;
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
67 gboolean remember_pass;
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
68
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
69 char *protocol_id;
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
70 PurpleProtocol *protocol;
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
71
43237
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
72 PurpleConnectionState connection_state;
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
73 PurpleConnection *gc;
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
74 gboolean disconnecting;
35470
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
75
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
76 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
77 PurpleAccountSettingFreezeQueue *freeze_queue;
35470
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35458
diff changeset
78
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
79 PurpleProxyInfo *proxy_info;
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
80
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
81 PurplePresence *presence;
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents: 34196
diff changeset
82
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
83 GError *error;
41438
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41432
diff changeset
84 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
85 } PurpleAccountPrivate;
c4971408eae8 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
86
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
87 typedef struct {
5777
2b4e8214a7cd [gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents: 5742
diff changeset
88 char *ui;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
89 GValue value;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
90 } PurpleAccountSetting;
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
91
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
92 enum {
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
93 PROP_0,
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
94 PROP_ID,
43160
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
95 PROP_NAME,
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
96 PROP_USERNAME,
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
97 PROP_CONTACT_INFO,
41773
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
98 PROP_REQUIRE_PASSWORD,
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
99 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
100 PROP_CONNECTION_STATE,
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
101 PROP_CONNECTION,
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
102 PROP_PROTOCOL,
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
103 PROP_PROTOCOL_ID,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
104 PROP_USER_INFO,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
105 PROP_BUDDY_ICON_PATH,
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
106 PROP_REMEMBER_PASSWORD,
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
107 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
108 PROP_ERROR,
42268
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
109 PROP_CONNECTED,
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
110 N_PROPERTIES,
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
111 };
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
112 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
113
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
114 enum {
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
115 SIG_SETTING_CHANGED,
42212
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
116 SIG_CONNECTED,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
117 SIG_DISCONNECTED,
42584
687260353985 Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42576
diff changeset
118 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
119 };
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
120 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
121
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
122 /******************************************************************************
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
123 * 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
124 *****************************************************************************/
30740
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30708
diff changeset
125 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
126 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
127 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
128 {
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_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
130
43237
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
131 if(account->connection_state != connection_state) {
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
132 /* We set the property and notify right away so that the signal
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
133 * handlers below will see the correct state.
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
134 */
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
135 account->connection_state = connection_state;
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
136 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
137 properties[PROP_CONNECTION_STATE]);
43237
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
138
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
139 if(connection_state == PURPLE_CONNECTION_STATE_CONNECTED) {
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
140 GDateTime *timestamp = NULL;
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
141
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
142 /* Set the time the account came online */
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
143 timestamp = g_date_time_new_now_utc();
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
144 purple_presence_set_login_time(account->presence, timestamp);
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
145 g_date_time_unref(timestamp);
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
146
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
147 g_signal_emit(account, signals[SIG_CONNECTED], 0);
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
148 } else if(connection_state == PURPLE_CONNECTION_STATE_DISCONNECTED) {
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
149 /* The user is no longer online, so clear their login time. */
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
150 purple_presence_set_login_time(account->presence, NULL);
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
151
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
152 g_signal_emit(account, signals[SIG_DISCONNECTED], 0);
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
153 }
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
154 }
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
155 }
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
156
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
157 static void
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
158 purple_account_set_id(PurpleAccount *account, const char *id) {
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
159 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
160
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
161 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
162 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
163 }
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
164 }
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
165
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
166 static void
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
167 purple_account_set_protocol(PurpleAccount *account, PurpleProtocol *protocol) {
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
168 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
169
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
170 if(g_set_object(&account->protocol, protocol)) {
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
171 GObject *obj = G_OBJECT(account);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
172 const char *protocol_id = NULL;
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
173
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
174 if(PURPLE_IS_PROTOCOL(protocol)) {
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
175 protocol_id = purple_protocol_get_id(protocol);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
176 }
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
177
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
178 g_set_str(&account->protocol_id, protocol_id);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
179
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
180 g_object_freeze_notify(obj);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
181 g_object_notify_by_pspec(obj, properties[PROP_PROTOCOL]);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
182 g_object_notify_by_pspec(obj, properties[PROP_PROTOCOL_ID]);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
183 g_object_thaw_notify(obj);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
184 }
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
185 }
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
186
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
187 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
188 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
189 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
190
41961
0da91f053305 Make PurpleAccount subclass PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41960
diff changeset
191 if(account->freeze_queue != NULL) {
0da91f053305 Make PurpleAccount subclass PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41960
diff changeset
192 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
193
41961
0da91f053305 Make PurpleAccount subclass PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41960
diff changeset
194 g_slice_free(PurpleAccountSettingFreezeQueue, account->freeze_queue);
0da91f053305 Make PurpleAccount subclass PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41960
diff changeset
195 account->freeze_queue = NULL;
0da91f053305 Make PurpleAccount subclass PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41960
diff changeset
196 }
41946
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 static void
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
200 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
201 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
202 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
203
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
204 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
205
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
206 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
207 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
208
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
209 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
210 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
211 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
212 }
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
213 } else {
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
214 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
215 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
216 }
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
217
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
218 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
219 }
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
220
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
221 static void
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
222 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
223 PurpleConnection *connection = NULL;
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
224 PurpleProtocol *protocol = NULL;
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
225 GError *error = NULL;
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
226
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
227 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
228
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
229 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
230 &error);
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
231 if(error != NULL) {
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
232 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
233
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
234 return;
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
235 }
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
236
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
237 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
238
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
239 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
240 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
241
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
242 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
243 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
244 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
245 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
246 PURPLE_CONNECTION_STATE_DISCONNECTED);
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
247 }
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
248
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
249 /* 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
250 g_object_unref(connection);
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
251 }
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
252
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
253 static void
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
254 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
255 PurpleCredentialManager *manager = PURPLE_CREDENTIAL_MANAGER(obj);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
256 PurpleAccount *account = PURPLE_ACCOUNT(data);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
257 GError *error = NULL;
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
258 char *password = NULL;
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
259
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
260 /* 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
261 * 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
262 * 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
263 */
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
264 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
265 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
266
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
267 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
268 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
269 /* 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
270 * 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
271 */
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
272 purple_debug_info("account",
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
273 "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
274 purple_account_get_username(account),
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
275 error != NULL ? error->message : "unknown error");
42182
3fc2d2b7b7a8 Fix leaked errors
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42136
diff changeset
276 g_clear_error(&error);
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
277 }
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
278
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
279 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
280
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
281 g_free(password);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
282 }
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 static void
42128
118067ca0367 Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42127
diff changeset
285 request_password_ok_cb(PurpleAccount *account, PurpleRequestPage *page) {
11042
d1ccf8d8a187 [gaim-migrate @ 12954]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11033
diff changeset
286 const char *entry;
d1ccf8d8a187 [gaim-migrate @ 12954]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11033
diff changeset
287 gboolean remember;
11985
d4a210fb43e9 [gaim-migrate @ 14278]
Mark Doliner <markdoliner@pidgin.im>
parents: 11982
diff changeset
288
42128
118067ca0367 Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42127
diff changeset
289 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
290 remember = purple_request_page_get_bool(page, "remember");
11985
d4a210fb43e9 [gaim-migrate @ 14278]
Mark Doliner <markdoliner@pidgin.im>
parents: 11982
diff changeset
291
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
292 if(purple_strempty(entry)) {
42831
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
293 g_warning(_("Password is required to sign on for '%s'."),
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
294 account->username);
10740
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
295 return;
a1cb6b819a21 [gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
296 }
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
297
33996
ca5e901a5311 Implemented a password caching system to limit problems linked to the
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33995
diff changeset
298 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
299
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
300 if(remember) {
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
301 PurpleCredentialManager *manager = NULL;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
302
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
303 manager = purple_credential_manager_get_default();
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
304
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
305 /* 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
306 * 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
307 * duplicate it for that callback.
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
308 */
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
309 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
310 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
311 NULL,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
312 request_password_write_cb,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
313 account);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
314 } else {
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
315 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
316 }
6581
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
317 }
dd89eb44f0ee [gaim-migrate @ 7103]
Nathan Walp <nwalp@pidgin.im>
parents: 6564
diff changeset
318
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
319 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
320 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
321 G_GNUC_UNUSED PurpleRequestPage *page)
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
322 {
30708
535bec1e66fb Standardize on "cancelled".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30456
diff changeset
323 /* 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
324 purple_account_set_enabled(account, FALSE);
20093
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
325 }
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
326
04f3c1dcd2cf applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c
Richard Laager <rlaager@pidgin.im>
parents: 19897
diff changeset
327
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
328 static void
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
329 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
330 gpointer data)
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
331 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
332 PurpleCredentialManager *manager = PURPLE_CREDENTIAL_MANAGER(obj);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
333 PurpleAccount *account = PURPLE_ACCOUNT(data);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
334 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
335 PurpleProtocolOptions options;
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
336 GError *error = NULL;
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
337 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
338 gboolean require_password = TRUE;
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
339
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
340 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
341 &error);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
342
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
343 if(error != NULL) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
344 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
345 error->message);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
346
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
347 g_error_free(error);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
348 }
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
349
40804
5496016b3c00 Port libpurple from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents: 40803
diff changeset
350 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
351 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
352 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
353 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
354 } 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
355 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
356 }
86a6b955379c Prompt for a optional password when the user has said it's required
Gary Kramlich <grim@reaperworld.com>
parents: 41773
diff changeset
357
86a6b955379c Prompt for a optional password when the user has said it's required
Gary Kramlich <grim@reaperworld.com>
parents: 41773
diff changeset
358 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
359 purple_account_request_password(account,
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
360 G_CALLBACK(request_password_ok_cb),
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
361 G_CALLBACK(request_password_cancel_cb),
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
362 account);
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
363 } else {
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
364 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
365 }
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
366
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
367 g_free(password);
34057
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
368 }
3b2c52789769 Clean up account.c changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34056
diff changeset
369
43127
eae3279e871c Use g_timeout_add_once where possible
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43091
diff changeset
370 static void
41786
0d71a8bef4c3 Work around a timing issues with accounts that have no passwords.
Gary Kramlich <grim@reaperworld.com>
parents: 41782
diff changeset
371 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
372 PurpleAccount *account = data;
0d71a8bef4c3 Work around a timing issues with accounts that have no passwords.
Gary Kramlich <grim@reaperworld.com>
parents: 41782
diff changeset
373
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
374 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
375 }
0d71a8bef4c3 Work around a timing issues with accounts that have no passwords.
Gary Kramlich <grim@reaperworld.com>
parents: 41782
diff changeset
376
7067
c57295414efa [gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents: 7063
diff changeset
377 static void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
378 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
379 PurpleAccountSetting *setting = (PurpleAccountSetting *)data;
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
380
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
381 g_free(setting->ui);
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
382 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
383
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
384 g_free(setting);
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
385 }
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
386
42646
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
387 static void
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
388 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
389 gpointer data)
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
390 {
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
391 PurpleAccount *account = data;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
392 PurpleProtocol *protocol = PURPLE_PROTOCOL(source);
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
393 PurpleProtocolOptions options;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
394 GError *error = NULL;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
395 gboolean can_connect = FALSE;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
396 gboolean require_password = TRUE;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
397
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
398 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
399 if(error != NULL) {
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
400 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
401
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
402 return;
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
403 }
42646
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
404
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
405 if(!can_connect) {
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
406 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
407 _("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
408
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
409 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
410
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
411 return;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
412 }
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
413
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
414 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
415 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
416 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
417 } 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
418 require_password = FALSE;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
419 }
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
420
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
421 if(require_password) {
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
422 PurpleCredentialManager *manager = NULL;
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 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
425 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
426 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
427 account);
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
428 } else {
43127
eae3279e871c Use g_timeout_add_once where possible
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43091
diff changeset
429 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
430 }
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
431 }
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
432
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
433 /******************************************************************************
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
434 * 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
435 *****************************************************************************/
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
436 static PurpleXmlNode *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
437 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
438 PurpleXmlNode *node, *child;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
439 PurpleProxyType proxy_type;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
440 const char *value;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
441 int int_value;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
442 char buf[21];
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
443
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
444 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
445
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
446 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
447
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
448 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
449 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
450 (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
451 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
452 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
453 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
454 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
455 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
456 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
457
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
458 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
459 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
460 purple_xmlnode_insert_data(child, value, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
461 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
462
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
463 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
464 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
465 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
466 purple_xmlnode_insert_data(child, buf, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
467 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
468
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
469 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
470 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
471 purple_xmlnode_insert_data(child, value, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
472 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
473
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
474 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
475 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
476 purple_xmlnode_insert_data(child, value, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
477 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
478
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
479 return node;
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
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
482 static PurpleXmlNode *
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
483 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
484 PurpleXmlNode *node = NULL;
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
485 PurpleXmlNode *child = NULL;
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
486 char *value = NULL;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
487
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
488 node = purple_xmlnode_new("current_error");
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
489
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
490 if(error == NULL) {
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
491 return node;
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
492 }
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
493
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
494 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
495 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
496
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
497 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
498 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
499 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
500 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
501
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
502 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
503 purple_xmlnode_insert_data(child, error->message, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
504
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
505 return node;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
506 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
507
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
508 static void
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
509 setting_to_xmlnode(gpointer key, gpointer value, gpointer user_data)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
510 {
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
511 const char *name;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
512 PurpleAccountSetting *setting;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
513 PurpleXmlNode *node, *child;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
514 char buf[21];
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
515
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
516 name = (const char *)key;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
517 setting = (PurpleAccountSetting *)value;
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
518 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
519
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
520 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
521 purple_xmlnode_set_attrib(child, "name", name);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
522
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
523 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
524 purple_xmlnode_set_attrib(child, "type", "int");
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
525 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
526 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
527 } 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
528 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
529 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
530 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
531 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
532 -1);
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
533 } 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
534 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
535 g_snprintf(buf, sizeof(buf), "%d",
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
536 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
537 purple_xmlnode_insert_data(child, buf, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
538 }
6368
ab9f99269dfe [gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents: 6367
diff changeset
539 }
ab9f99269dfe [gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents: 6367
diff changeset
540
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
541 PurpleXmlNode *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
542 _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
543 PurpleXmlNode *node, *child;
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
544 char *data = NULL;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
545 const char *tmp;
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
546 PurpleProxyInfo *proxy_info;
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
547
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
548 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
549
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
550 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
551 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
552 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
553 }
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
554
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
555 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
556 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
557 -1);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
558
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
559 child = purple_xmlnode_new_child(node, "name");
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
560 purple_xmlnode_insert_data(child, account->username, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
561
41773
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
562 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
563 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
564 purple_xmlnode_insert_data(child, data, -1);
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
565 g_clear_pointer(&data, g_free);
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
566
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
567 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
568 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
569 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
570 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
571
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
572 tmp = purple_contact_info_get_alias(account->contact_info);
41961
0da91f053305 Make PurpleAccount subclass PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41960
diff changeset
573 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
574 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
575 purple_xmlnode_insert_data(child, tmp, -1);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
576 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
577
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
578 if((tmp = purple_account_get_user_info(account)) != NULL) {
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
579 /* 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
580 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
581 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
582 }
34c1a17a91d7 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18190
diff changeset
583
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
584 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
585 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
586 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
587 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
588
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
589 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
590 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
591 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
592 }
34c1a17a91d7 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18190
diff changeset
593
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
594 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
595 purple_xmlnode_insert_child(node, child);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
596
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
597 return node;
5710
3c2bf5725bb0 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5707
diff changeset
598 }
3c2bf5725bb0 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5707
diff changeset
599
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
600 /******************************************************************************
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
601 * 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
602 *****************************************************************************/
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
603 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
604
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
605 static void
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
606 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
607 GParamSpec *pspec)
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
608 {
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
609 PurpleAccount *account = PURPLE_ACCOUNT(obj);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
610
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
611 switch(param_id) {
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
612 case PROP_ID:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
613 purple_account_set_id(account, g_value_get_string(value));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
614 break;
43160
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
615 case PROP_NAME:
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
616 purple_account_set_name(account, g_value_get_string(value));
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
617 break;
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
618 case PROP_USERNAME:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
619 purple_account_set_username(account, g_value_get_string(value));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
620 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
621 case PROP_REQUIRE_PASSWORD:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
622 purple_account_set_require_password(account,
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
623 g_value_get_boolean(value));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
624 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
625 case PROP_ENABLED:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
626 purple_account_set_enabled(account, g_value_get_boolean(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_CONNECTION:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
629 purple_account_set_connection(account, g_value_get_object(value));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
630 break;
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
631 case PROP_PROTOCOL:
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
632 purple_account_set_protocol(account, g_value_get_object(value));
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
633 break;
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
634 case PROP_PROTOCOL_ID:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
635 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
636 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
637 case PROP_USER_INFO:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
638 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
639 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
640 case PROP_BUDDY_ICON_PATH:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
641 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
642 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
643 case PROP_REMEMBER_PASSWORD:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
644 purple_account_set_remember_password(account,
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
645 g_value_get_boolean(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_PROXY_INFO:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
648 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
649 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
650 case PROP_ERROR:
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
651 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
652 break;
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
653 default:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
654 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
655 break;
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
656 }
5710
3c2bf5725bb0 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5707
diff changeset
657 }
3c2bf5725bb0 [gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents: 5707
diff changeset
658
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
659 static void
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
660 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
661 GParamSpec *pspec)
5580
a5a3e6dfb409 [gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents: 5574
diff changeset
662 {
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
663 PurpleAccount *account = PURPLE_ACCOUNT(obj);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
664
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
665 switch(param_id) {
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
666 case PROP_ID:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
667 g_value_set_string(value, purple_account_get_id(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
668 break;
43160
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
669 case PROP_NAME:
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
670 g_value_set_string(value, purple_account_get_name(account));
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
671 break;
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
672 case PROP_USERNAME:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
673 g_value_set_string(value, purple_account_get_username(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
674 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
675 case PROP_CONTACT_INFO:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
676 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
677 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
678 case PROP_REQUIRE_PASSWORD:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
679 g_value_set_boolean(value,
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
680 purple_account_get_require_password(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_ENABLED:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
683 g_value_set_boolean(value, purple_account_get_enabled(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
684 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
685 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
686 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
687 break;
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
688 case PROP_CONNECTION:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
689 g_value_set_object(value, purple_account_get_connection(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
690 break;
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
691 case PROP_PROTOCOL:
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
692 g_value_set_object(value, purple_account_get_protocol(account));
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
693 break;
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
694 case PROP_PROTOCOL_ID:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
695 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
696 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
697 case PROP_USER_INFO:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
698 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
699 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
700 case PROP_BUDDY_ICON_PATH:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
701 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
702 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
703 case PROP_REMEMBER_PASSWORD:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
704 g_value_set_boolean(value,
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
705 purple_account_get_remember_password(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_PROXY_INFO:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
708 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
709 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
710 case PROP_ERROR:
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
711 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
712 break;
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
713 case PROP_CONNECTED:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
714 g_value_set_boolean(value, purple_account_is_connected(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
715 break;
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
716 default:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
717 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
718 break;
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
719 }
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
720 }
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
721
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
722 static void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
723 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
724 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
725 delete_setting);
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
726 account->contact_info = purple_contact_info_new(NULL);
42696
ef2f771d8242 Remove PurpleAccountPresense (finally)
Gary Kramlich <grim@reaperworld.com>
parents: 42646
diff changeset
727 account->presence = purple_presence_new();
5580
a5a3e6dfb409 [gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents: 5574
diff changeset
728 }
5573
633880e3f137 [gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents: 5565
diff changeset
729
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
730 static void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
731 purple_account_dispose(GObject *object) {
35512
8d6f1349b57a Fix crash on wrong password (backout 0f0d6ae2fb77)
Ankit Vani <a@nevitus.org>
parents: 35499
diff changeset
732 PurpleAccount *account = PURPLE_ACCOUNT(object);
8d6f1349b57a Fix crash on wrong password (backout 0f0d6ae2fb77)
Ankit Vani <a@nevitus.org>
parents: 35499
diff changeset
733
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
734 if(!purple_account_is_disconnected(account)) {
35512
8d6f1349b57a Fix crash on wrong password (backout 0f0d6ae2fb77)
Ankit Vani <a@nevitus.org>
parents: 35499
diff changeset
735 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
736 }
894c29e33300 Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
737
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
738 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
739 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
740 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
741
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
742 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
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
894c29e33300 Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
745 static void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
746 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
747 PurpleAccount *account = PURPLE_ACCOUNT(object);
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
748
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
749 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
750
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
751 g_clear_pointer(&account->id, g_free);
43160
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
752 g_clear_pointer(&account->name, g_free);
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
753 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
754 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
755
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
756 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
757
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
758 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
759
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
760 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
761 g_free(account->buddy_icon_path);
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
762
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
763 g_free(account->protocol_id);
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
764 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
765
03bec8eb9b36 PurpleAccount is a final type so stop using a private struct for its data
Gary Kramlich <grim@reaperworld.com>
parents: 41685
diff changeset
766 g_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
767
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
768 G_OBJECT_CLASS(purple_account_parent_class)->finalize(object);
5563
d5a7852aa0cb [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
769 }
5874
5e19273d3c6f [gaim-migrate @ 6306]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
770
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
771 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
772 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
773 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
774
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
775 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
776 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
777 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
778 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
779
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
780 /**
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
781 * PurpleAccount:id:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
782 *
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
783 * The unique identifier for the account.
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
784 *
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
785 * Since: 3.0
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
786 */
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
787 properties[PROP_ID] = g_param_spec_string(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
788 "id", NULL, NULL,
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
789 NULL,
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
790 G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
791
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
792 /**
43160
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
793 * PurpleAccount:name:
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
794 *
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
795 * The user supplied name of the account.
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
796 *
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
797 * This is used by user interfaces to help the user determine which account
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
798 * is which.
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
799 *
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
800 * Since: 3.0
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
801 */
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
802 properties[PROP_NAME] = g_param_spec_string(
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
803 "name", NULL, NULL,
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
804 NULL,
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
805 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
806
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
807 /**
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
808 * PurpleAccount:username:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
809 *
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
810 * The username for the account.
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 * Since: 3.0
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
813 */
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
814 properties[PROP_USERNAME] = g_param_spec_string(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
815 "username", NULL, NULL,
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
816 NULL,
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
817 G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
818
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
819 /**
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
820 * PurpleAccount:contact-info:
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
821 *
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
822 * The [class@ContactInfo] for the account.
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
823 *
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
824 * 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
825 * 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
826 * 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
827 *
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
828 * Since: 3.0
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
829 */
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
830 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
831 "contact-info", NULL, NULL,
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
832 PURPLE_TYPE_CONTACT_INFO,
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
833 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
834
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
835 /**
41773
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
836 * PurpleAccount:require-password:
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
837 *
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
838 * 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
839 * 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
840 * passwords.
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
841 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
842 * Since: 3.0
41773
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
843 */
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
844 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
845 "require-password", NULL, NULL,
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
846 FALSE,
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
847 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
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 /**
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
850 * PurpleAccount:user-info:
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
851 *
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
852 * The user information or profile for the account.
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
853 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
854 * Since: 3.0
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
855 */
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
856 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
857 "user-info", NULL, NULL,
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
858 NULL,
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
859 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
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 /**
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
862 * PurpleAccount:buddy-icon-path:
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
863 *
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
864 * 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
865 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
866 * Since: 3.0
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
867 */
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
868 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
869 "buddy-icon-path", NULL, NULL,
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
870 NULL,
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
871 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
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 /**
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
874 * PurpleAccount:enabled:
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
875 *
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
876 * 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
877 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
878 * Since: 3.0
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
879 */
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
880 properties[PROP_ENABLED] = g_param_spec_boolean(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
881 "enabled", NULL, NULL,
41773
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
882 FALSE,
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
883 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
884
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
885 /**
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
886 * PurpleAccount:remember-password:
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
887 *
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
888 * 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
889 * configured [class@CredentialProvider].
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
890 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
891 * Since: 3.0
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
892 */
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
893 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
894 "remember-password", NULL, NULL,
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
895 FALSE,
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
896 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
897
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
898 /**
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
899 * 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
900 *
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
901 * 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
902 *
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
903 * 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
904 */
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
905 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
906 "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
907 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
908 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
909 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
910
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
911 /**
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
912 * PurpleAccount:connection:
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
913 *
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
914 * 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
915 * the account is offline.
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
916 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
917 * Since: 3.0
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
918 */
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
919 properties[PROP_CONNECTION] = g_param_spec_object(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
920 "connection", NULL, NULL,
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
921 PURPLE_TYPE_CONNECTION,
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
922 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
923
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
924 /**
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
925 * PurpleAccount:protocol:
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
926 *
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
927 * The protocol that this account is using.
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
928 *
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
929 * This will set [property@Account:protocol-id] to the
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
930 * [property@Protocol:id] of the new protocol.
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
931 *
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
932 * 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
933 * initialized by the first call to [method@Account.get_protocol].
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 * Since: 3.0
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
936 */
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
937 properties[PROP_PROTOCOL] = g_param_spec_object(
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
938 "protocol", NULL, NULL,
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
939 PURPLE_TYPE_PROTOCOL,
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
940 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
941
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
942 /**
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
943 * PurpleAccount:protocol-id:
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 * 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
946 *
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
947 * 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
948 * cleared.
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
949 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
950 * Since: 3.0
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
951 */
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
952 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
953 "protocol-id", NULL, NULL,
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
954 NULL,
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
955 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
956
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
957 /**
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
958 * PurpleAccount:proxy-info:
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
959 *
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
960 * The [class@ProxyInfo] for this account.
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
961 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
962 * Since: 3.0
42274
85b62e76b94d Add missing documentation for PurpleAccount properties
Gary Kramlich <grim@reaperworld.com>
parents: 42268
diff changeset
963 */
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
964 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
965 "proxy-info", NULL, NULL,
41318
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
966 PURPLE_TYPE_PROXY_INFO,
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
967 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
968
41894
92fb22f0f0ab Add PurpleAccount::error property and remove "account-error-changed" and "account-status-changing" signals.
Gary Kramlich <grim@reaperworld.com>
parents: 41893
diff changeset
969 /**
92fb22f0f0ab Add PurpleAccount::error property and remove "account-error-changed" and "account-status-changing" signals.
Gary Kramlich <grim@reaperworld.com>
parents: 41893
diff changeset
970 * 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
971 *
92fb22f0f0ab Add PurpleAccount::error property and remove "account-error-changed" and "account-status-changing" signals.
Gary Kramlich <grim@reaperworld.com>
parents: 41893
diff changeset
972 * 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
973 * 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
974 * made.
16d2e16bd24f Export Account::error
Gary Kramlich <grim@reaperworld.com>
parents: 42047
diff changeset
975 *
16d2e16bd24f Export Account::error
Gary Kramlich <grim@reaperworld.com>
parents: 42047
diff changeset
976 * 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
977 * 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
978 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
979 * 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
980 */
92fb22f0f0ab Add PurpleAccount::error property and remove "account-error-changed" and "account-status-changing" signals.
Gary Kramlich <grim@reaperworld.com>
parents: 41893
diff changeset
981 properties[PROP_ERROR] = g_param_spec_boxed(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
982 "error", NULL, NULL,
43008
d46e90e0757a Remove Purple.ConnectionErrorInfo
Gary Kramlich <grim@reaperworld.com>
parents: 43004
diff changeset
983 G_TYPE_ERROR,
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
984 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
985
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
986 /**
42268
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
987 * PurpleAccount:connected:
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
988 *
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
989 * 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
990 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
991 * 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
992 */
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
993 properties[PROP_CONNECTED] = g_param_spec_boolean(
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
994 "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
995 FALSE,
790189f5b6de Add a connected property to PurpleAccount so bindings can use it
Gary Kramlich <grim@reaperworld.com>
parents: 42259
diff changeset
996 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
997
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
998 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
999
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 * 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
1002 * @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
1003 * @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
1004 *
43237
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
1005 * This signal is emitted whenever an account setting is changed.
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1006 *
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1007 * 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
1008 * 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
1009 * 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
1010 * 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
1011 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1012 * 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
1013 */
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1014 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
1015 "setting-changed",
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1016 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
1017 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
1018 NULL,
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1019 NULL,
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1020 NULL,
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1021 NULL,
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1022 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
1023 1,
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1024 G_TYPE_STRING);
42212
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1025
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1026 /**
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1027 * PurpleAccount::connected:
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1028 * @account: The account instance.
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1029 *
43237
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
1030 * This signal is emitted when the [property@Account:connection-state] has
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
1031 * changed to %PURPLE_CONNECTION_STATE_CONNECTED.
42212
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1032 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1033 * Since: 3.0
42212
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1034 */
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1035 signals[SIG_CONNECTED] = g_signal_new_class_handler(
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1036 "connected",
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1037 G_OBJECT_CLASS_TYPE(klass),
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1038 G_SIGNAL_RUN_LAST,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1039 NULL,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1040 NULL,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1041 NULL,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1042 NULL,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1043 G_TYPE_NONE,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1044 0);
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1045
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1046 /**
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1047 * PurpleAccount::disconnected:
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1048 * @account: The account instance.
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1049 *
43237
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
1050 * This signal is emitted when the [property@Account:connection-state] has
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
1051 * changed to %PURPLE_CONNECTION_STATE_DISCONNECTED.
42212
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1052 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
1053 * Since: 3.0
42212
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1054 */
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1055 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
1056 "disconnected",
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1057 G_OBJECT_CLASS_TYPE(klass),
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1058 G_SIGNAL_RUN_LAST,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1059 NULL,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1060 NULL,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1061 NULL,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1062 NULL,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1063 G_TYPE_NONE,
a401fa6276ac Add PurpleAccount:connected and PurpleAccount:disconnected signals
Gary Kramlich <grim@reaperworld.com>
parents: 42182
diff changeset
1064 0);
34580
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1065 }
ab3f70aaaf17 Added GObject code to PurpleAccount. Changed PurpleAccountSetting to GValue.
Ankit Vani <a@nevitus.org>
parents: 34579
diff changeset
1066
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1067 /******************************************************************************
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
1068 * 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
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
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 /* 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
1072 * 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
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 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
1075 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
1076 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
1077
5bc664b848a5 Work around an issue where accounts were attempting to connect when they were deserialized
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
1078 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
1079 }
5bc664b848a5 Work around an issue where accounts were attempting to connect when they were deserialized
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
1080
5bc664b848a5 Work around an issue where accounts were attempting to connect when they were deserialized
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
1081 /******************************************************************************
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1082 * 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
1083 *****************************************************************************/
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
1084 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
1085 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
1086 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
1087
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1088 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
1089 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
1090 }
bdea968e70fe Purple: Add some new API to Purple.Account to migrate to the new Purple.Account:connection-state property
Gary Kramlich <grim@reaperworld.com>
parents: 43008
diff changeset
1091
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
1092 PurpleAccount *
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
1093 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
1094 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
1095 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
1096
42047
72db1ae4ea4e Remove the account lookup on account new
Gary Kramlich <grim@reaperworld.com>
parents: 41984
diff changeset
1097 return g_object_new(
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1098 PURPLE_TYPE_ACCOUNT,
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1099 "username", username,
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1100 "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
1101 "enabled", FALSE,
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
1102 NULL);
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6368
diff changeset
1103 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1104
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1105 const char *
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1106 purple_account_get_id(PurpleAccount *account) {
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1107 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1108
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1109 /* 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
1110 */
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1111 if(purple_strempty(account->id)) {
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1112 GChecksum *checksum = NULL;
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1113
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1114 checksum = g_checksum_new(G_CHECKSUM_SHA256);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1115
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1116 g_checksum_update(checksum, (const guchar *)account->protocol_id, -1);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1117 g_checksum_update(checksum, (const guchar *)account->username, -1);
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 purple_account_set_id(account, g_checksum_get_string(checksum));
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1120
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1121 g_checksum_free(checksum);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1122 }
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1123
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1124 return account->id;
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1125 }
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1126
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1127 const char *
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1128 purple_account_get_username(PurpleAccount *account) {
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1129 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1130
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1131 return account->username;
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1132 }
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1133
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1134 void
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1135 purple_account_set_username(PurpleAccount *account, const char *username) {
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1136 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1137
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1138 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
1139 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
1140 }
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1141 }
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1142
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1143 PurpleContactInfo *
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1144 purple_account_get_contact_info(PurpleAccount *account) {
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1145 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1146
42811
75b28985598a Reparent Purple.Account from Purple.ContactInfo to GLib.Object
Gary Kramlich <grim@reaperworld.com>
parents: 42767
diff changeset
1147 return account->contact_info;
42759
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1148 }
530549d9d6aa Prepare for reparenting PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42750
diff changeset
1149
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1151 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
1152 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1153 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
1154
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1155 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
1156
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1157 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
1158
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1159 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
1160 purple_debug_info("account",
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1161 "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
1162 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
1163 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
1164 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1165
40804
5496016b3c00 Port libpurple from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents: 40803
diff changeset
1166 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
1167 if(protocol == NULL) {
42831
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1168 PurpleNotification *notification = NULL;
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1169 PurpleNotificationManager *manager = NULL;
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1170 char *value = NULL;
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1171
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1172 value = g_strdup_printf(_("Failed to load account '%s'"),
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1173 account->username);
42988
c2357ee36551 Replace Purple.Notification.new_generic with Purple.Notification.new
Gary Kramlich <grim@reaperworld.com>
parents: 42987
diff changeset
1174 notification = purple_notification_new(NULL, value);
42831
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1175 g_free(value);
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1176
42931
9e8b9ee3cfbb Update libpurple for the Purple.Notification deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42855
diff changeset
1177 purple_notification_set_account(notification, account);
9e8b9ee3cfbb Update libpurple for the Purple.Notification deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 42855
diff changeset
1178
42831
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1179 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
1180 account->protocol_id);
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1181 purple_notification_set_subtitle(notification, value);
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1182 g_free(value);
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1183
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1184 manager = purple_notification_manager_get_default();
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1185 purple_notification_manager_add(manager, notification);
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1186 g_clear_object(&notification);
a4b028c0f605 Use PurpleNotification where appropriate
Gary Kramlich <grim@reaperworld.com>
parents: 42811
diff changeset
1187
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1188 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
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
42646
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42624
diff changeset
1191 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
1192 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
1193 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1196 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
1197 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
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 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
1200 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
1201 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
1202
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1203 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
1204 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
1205
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
1206 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
1207 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
1208
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1209 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
1210 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
1211 account->username,
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1212 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
1213 (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
1214 g_clear_error(&error);
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1215 }
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1216
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1218 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
1219 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
1220 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1221
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1222 void
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1223 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
1224 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
1225 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
1226
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1227 purple_account_disconnect(account);
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1228 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
1229 }
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1230
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1231 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
1232 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
1233 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
1234
43237
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
1235 return (account->connection_state == 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
1236 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 void
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41500
diff changeset
1239 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
1240 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
1241
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1242 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
1243
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41500
diff changeset
1244 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
1245 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
1246 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1247
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1248 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
1249 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
1250 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
1251 {
42841
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
1252 char *primary;
fbb5c5cb37f4 Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents: 42834
diff changeset
1253 const char *username;
42127
18acb99a0fa6 Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42049
diff changeset
1254 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
1255 PurpleRequestField *field;
42128
118067ca0367 Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42127
diff changeset
1256 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
1257
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1258 /* 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
1259 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
1260
43074
0ff905ef6259 Fix uses of PurpleAccount as a PurpleContactInfo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43063
diff changeset
1261 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
1262 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
1263 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
1264
42128
118067ca0367 Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42127
diff changeset
1265 page = purple_request_page_new();
42127
18acb99a0fa6 Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42049
diff changeset
1266 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
1267 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
1268
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1269 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
1270 NULL, FALSE);
42135
1a89a067a0d5 Add a PurpleRequestFieldString subclass
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42128
diff changeset
1271 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
1272 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
1273 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
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 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
1277 FALSE);
42127
18acb99a0fa6 Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42049
diff changeset
1278 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
1279
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1280 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
1281 _("Cancel"), cancel_cb,
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1282 purple_request_cpar_from_account(account),
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1283 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
1284 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
1285 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1286
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1287 void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1288 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
1289 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
1290
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1291 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
1292 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
1293 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
1294
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1295 purple_accounts_schedule_save();
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1296 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1299 void
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1300 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
1301 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
1302
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1303 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
1304 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
1305 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
1306
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1307 purple_accounts_schedule_save();
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1308 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1312 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
1313 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1314 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
1315 g_return_if_fail(protocol_id != NULL);
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1316 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
1317
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1318 if(g_set_str(&account->protocol_id, protocol_id)) {
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1319 GObject *obj = G_OBJECT(account);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1320
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1321 /* Setting this directly clears any cached protocol. */
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1322 g_clear_object(&account->protocol);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1323
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1324 g_object_freeze_notify(obj);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1325 g_object_notify_by_pspec(obj, properties[PROP_PROTOCOL_ID]);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1326 g_object_notify_by_pspec(obj, properties[PROP_PROTOCOL]);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1327 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
1328
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1329 purple_accounts_schedule_save();
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42759
diff changeset
1330 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1331 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1332
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1333 void
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1334 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
1335 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
1336
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1337 if(g_set_object(&account->gc, gc)) {
43237
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
1338 g_object_notify_by_pspec(G_OBJECT(account),
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
1339 properties[PROP_CONNECTION]);
41869
7bd5bff547b4 Change the way accounts connect while keeping backwards compatibility
Gary Kramlich <grim@reaperworld.com>
parents: 41831
diff changeset
1340 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1341 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1342
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1343 void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1344 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
1345 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
1346
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
1347 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
1348
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1349 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
1350 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
1351
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1352 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
1353 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1354
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1355 void
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1356 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
1357 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
1358
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1359 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
1360
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
1361 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
1362 account->enabled = value;
41891
a45d6db4f857 Propagate the PurpleAccount::notify signal via PurpleAccountManager::account-changed
Gary Kramlich <grim@reaperworld.com>
parents: 41869
diff changeset
1363 if(was_enabled != value) {
a45d6db4f857 Propagate the PurpleAccount::notify signal via PurpleAccountManager::account-changed
Gary Kramlich <grim@reaperworld.com>
parents: 41869
diff changeset
1364 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
1365 }
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1366
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1367 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
1368 purple_account_connect(account);
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1369 } 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
1370 purple_account_disconnect(account);
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1371 }
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1372
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1373 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
1374 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1375
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1377 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
1378 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
1379
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
1380 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
1381 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
1382 properties[PROP_PROXY_INFO]);
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1383
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1384 purple_accounts_schedule_save();
56092ffeae95 Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
1385 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1386 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1387
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1388 void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1389 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
1390 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
1391
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1392 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1393 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
1394
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1396
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1397 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
1398 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
1399
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
1400 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
1401
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1402 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
1403
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1405 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1406
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1407 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
1408 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
1409 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
1410 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1411 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
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 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
1414 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
1415
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1416 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
1417
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1418 g_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
1419 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
1420
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
1421 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
1422
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1423 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
1424
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1425 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
1426 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1427
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1428 void
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1429 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
1430 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
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 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
1433
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1434 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
1435 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
1436
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1437 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
1438
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1439 g_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
1440 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
1441
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
1442 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
1443
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1444 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
1445
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1446 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
1447 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1448
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1449 gboolean
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1450 purple_account_is_connected(PurpleAccount *account) {
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1451 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
1452
43237
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
1453 return (account->connection_state == 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
1454 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1455
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 gboolean
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1457 purple_account_is_connecting(PurpleAccount *account) {
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1458 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
1459
43237
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
1460 return (account->connection_state == 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
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
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 gboolean
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1464 purple_account_is_disconnected(PurpleAccount *account) {
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1465 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
1466
43237
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
1467 return (account->connection_state == 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
1468 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1469
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1470 const char *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1471 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
1472 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
1473
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
1474 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
1475 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1476
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1477 const char *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1478 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
1479 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
1480
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
1481 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
1482 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1483
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1484 const char *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1485 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
1486 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
1487
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
1488 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
1489 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1490
40803
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1491 PurpleProtocol *
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1492 purple_account_get_protocol(PurpleAccount *account) {
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1493 PurpleProtocolManager *manager = NULL;
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1494
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1495 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
1496
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1497 if(!PURPLE_IS_PROTOCOL(account->protocol)) {
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1498 manager = purple_protocol_manager_get_default();
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1499 if(manager != NULL) {
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1500 PurpleProtocol *protocol = NULL;
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1501
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1502 protocol = purple_protocol_manager_find(manager,
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1503 account->protocol_id);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1504
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1505 purple_account_set_protocol(account, protocol);
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1506 }
42853
051b8f911409 Remove the test ui from the account manager tests
Gary Kramlich <grim@reaperworld.com>
parents: 42841
diff changeset
1507 }
40803
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1508
43055
917386321169 Add Purple.Account:protocol
Gary Kramlich <grim@reaperworld.com>
parents: 43037
diff changeset
1509 return account->protocol;
40803
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1510 }
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40783
diff changeset
1511
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
1512 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
1513 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
1514 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
1515 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
1516
43237
c641f6bea7dd Move the connection-state implementation to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43160
diff changeset
1517 return account->connection_state;
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
1518 }
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
1519
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1520 PurpleConnection *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1521 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
1522 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
1523
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
1524 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
1525 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1526
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1527 gboolean
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1528 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
1529 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
1530
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
1531 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
1532 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1533
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1534 gboolean
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41318
diff changeset
1535 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
1536 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
1537
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
1538 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
1539 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1540
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1541 PurpleProxyInfo *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1542 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
1543 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
1544
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
1545 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
1546 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1547
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1548 PurplePresence *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1549 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
1550 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
1551
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
1552 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
1553 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1554
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1556 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
1557 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
1558 {
9c7715998bbc Cleanup account.[ch] and status.[ch] 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 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
1560
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1561 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
1562 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
1563
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
1564 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
1565
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1566 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
1567 return default_value;
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1568 }
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1569
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1570 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
1571
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1572 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
1573 }
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1574
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1575 const char *
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1576 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
1577 const char *default_value)
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1578 {
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1579 PurpleAccountSetting *setting;
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1580
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1581 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
1582 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
1583
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1584 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
1585
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1586 if(setting == NULL) {
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1587 return default_value;
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1588 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] 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(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
1591
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1592 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
1593 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1594
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1595 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
1596 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
1597 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
1598 {
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1599 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
1600
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1601 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
1602 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
1603
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
1604 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
1605
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1606 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
1607 return default_value;
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1608 }
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1609
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1610 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
1611
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1612 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
1613 }
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1614
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1615 void
42992
402dbf6669b3 Remove Purple.ProtocolServer
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
1616 purple_account_change_password(PurpleAccount *account,
402dbf6669b3 Remove Purple.ProtocolServer
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
1617 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
1618 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
1619 {
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1620 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
1621
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1622 /* 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
1623 * implement the change password stuff.
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1624 */
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1625 manager = purple_credential_manager_get_default();
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
1626 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
1627 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
1628 }
9c7715998bbc Cleanup account.[ch] and status.[ch] 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
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1630 GError *
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1631 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
1632 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
1633
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1634 return account->error;
43001
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
1635 }
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
1636
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39436
diff changeset
1637 void
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1638 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
1639 PurpleNotificationManager *manager = NULL;
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1640
43001
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
1641 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
1642
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1643 if(account->error == error) {
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1644 return;
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1645 }
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1646
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1647 /* Set the new error. */
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1648 g_clear_error(&account->error);
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1649 account->error = error;
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1650
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1651 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
1652
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1653 /* 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
1654 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
1655 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
1656 purple_notification_manager_remove(manager,
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1657 account->error_notification);
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1658 }
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1659
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1660 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
1661 }
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1662
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1663 /* 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
1664 if(error != NULL) {
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1665 PurpleNotification *notification = NULL;
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1666
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1667 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
1668
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1669 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
1670 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
1671 }
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1672
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1673 account->error_notification = notification;
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 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
1677
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
1678 purple_accounts_schedule_save();
43001
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
1679 }
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
1680
a4b2110b2908 Deprecate Purple.Account:error for Purple.Account:error-info
Gary Kramlich <grim@reaperworld.com>
parents: 42999
diff changeset
1681 void
41773
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1682 purple_account_set_require_password(PurpleAccount *account,
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1683 gboolean require_password)
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1684 {
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1685 gboolean old = FALSE;
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1686
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1687 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
1688
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1689 old = account->require_password;
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1690 account->require_password = require_password;
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1691
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1692 if(old != require_password) {
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1693 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
1694 properties[PROP_REQUIRE_PASSWORD]);
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1695 }
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1696 }
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1697
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1698 gboolean
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1699 purple_account_get_require_password(PurpleAccount *account) {
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1700 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
1701
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1702 return account->require_password;
c4acd02fdf73 Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41769
diff changeset
1703 }
41920
29ebd938c592 Add a contact property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 41914
diff changeset
1704
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1705 void
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1706 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
1707 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
1708
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1709 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
1710 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
1711 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
1712 }
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1713
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1714 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
1715
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1716 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
1717 }
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1718
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1719 void
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1720 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
1721 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
1722
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1723 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
1724
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1725 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
1726 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
1727 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
1728
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1729 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
1730 "(%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
1731 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
1732 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
1733
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1734 return;
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1735 }
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1736
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1737 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
1738 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
1739 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
1740
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1741 return;
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
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1744 /* 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
1745 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
1746 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
1747 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
1748
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1749 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
1750 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
1751
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1752 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
1753 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
1754 }
41949
8733057a54f0 Fix an invalid free in the account setting thaw function
Gary Kramlich <grim@reaperworld.com>
parents: 41946
diff changeset
1755 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
1756
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1757 purple_account_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
1758
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41924
diff changeset
1759 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
1760 }
42334
fedf46917e15 Clean up a bunch of stuff in accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42318
diff changeset
1761
43091
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1762 int
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1763 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
1764 if (a != NULL && b == NULL) {
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1765 return -1;
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1766 }
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1767 if (a == NULL && b != NULL) {
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1768 return 1;
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1769 }
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1770 if (a == NULL && b == NULL) {
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1771 return 0;
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1772 }
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1773
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1774 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
1775 }
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1776
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1777 gboolean
f77300d83505 Add Purple.Account.compare and Purple.Account.equal methods
Markus Fischer <ivanhoe@fiscari.de>
parents: 43074
diff changeset
1778 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
1779 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
1780 }
43160
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
1781
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
1782 const char *
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
1783 purple_account_get_name(PurpleAccount *account) {
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
1784 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
1785
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
1786 return account->name;
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
1787 }
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
1788
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
1789 void
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
1790 purple_account_set_name(PurpleAccount *account, const char *name) {
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
1791 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
1792 g_return_if_fail(!purple_strempty(name));
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
1793
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
1794 if(g_set_str(&account->name, name)) {
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
1795 g_object_notify_by_pspec(G_OBJECT(account), properties[PROP_NAME]);
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
1796 }
a9cc7d8325ba Add a name property to Purple.Account
Gary Kramlich <grim@reaperworld.com>
parents: 43130
diff changeset
1797 }

mercurial