libpurple/purpleaccount.c

Fri, 04 Oct 2024 01:09:26 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Fri, 04 Oct 2024 01:09:26 -0500
changeset 42999
5a506dee26d2
parent 42998
9fae31173eb3
child 43001
a4b2110b2908
permissions
-rw-r--r--

Remove the Purple.Signals API

This was a long time coming but we've finally replaced it all!

Testing Done:
Connected a demo and irc accounts without issues. Also called in the turtles.

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

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

mercurial