libpurple/accounts.c

Sun, 13 Mar 2022 21:59:38 -0500

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Sun, 13 Mar 2022 21:59:38 -0500
changeset 41287
dd84ced2309c
parent 41240
943ba4838efc
child 41314
0dc72eacd8bf
permissions
-rw-r--r--

Remove weird use of dup functions to allocate new structs

34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
1 /* purple
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
2 *
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
3 * Purple is the legal property of its developers, whose names are too numerous
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
4 * to list here. Please refer to the COPYRIGHT file distributed with this
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
5 * source distribution.
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
6 *
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
10 * (at your option) any later version.
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
11 *
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
15 * GNU General Public License for more details.
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
16 *
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
20 */
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
21
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 #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
23
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
24 #include "internal.h"
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
25 #include "accounts.h"
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
26 #include "core.h"
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
27 #include "debug.h"
34582
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
28 #include "network.h"
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
29 #include "purpleaccountmanager.h"
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
30 #include "purpleconversationmanager.h"
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40570
diff changeset
31 #include "purplecredentialmanager.h"
41007
90d2dee9b3dc Fix the includes for the purpleenums rename
Gary Kramlich <grim@reaperworld.com>
parents: 40992
diff changeset
32 #include "purpleenums.h"
40439
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40332
diff changeset
33 #include "purpleprivate.h"
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
34
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
35 static PurpleAccountUiOps *account_ui_ops = NULL;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
36
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
37 static guint save_timer = 0;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
38 static gboolean accounts_loaded = FALSE;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
39
40505
e2c4be9e3aa6 fix some issues that were identified while working on a flatpak build
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
40 static void
e2c4be9e3aa6 fix some issues that were identified while working on a flatpak build
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
41 purple_accounts_network_changed_cb(GNetworkMonitor *m, gboolean available,
e2c4be9e3aa6 fix some issues that were identified while working on a flatpak build
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
42 gpointer data)
e2c4be9e3aa6 fix some issues that were identified while working on a flatpak build
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
43 {
e2c4be9e3aa6 fix some issues that were identified while working on a flatpak build
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
44 if(available) {
e2c4be9e3aa6 fix some issues that were identified while working on a flatpak build
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
45 purple_accounts_restore_current_statuses();
e2c4be9e3aa6 fix some issues that were identified while working on a flatpak build
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
46 }
e2c4be9e3aa6 fix some issues that were identified while working on a flatpak build
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
47 }
e2c4be9e3aa6 fix some issues that were identified while working on a flatpak build
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
48
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
49 /*********************************************************************
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
50 * Writing to disk *
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
51 *********************************************************************/
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
52 static void
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
53 accounts_to_xmlnode_helper(PurpleAccount *account, gpointer data) {
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
54 PurpleXmlNode *node = data, *child = NULL;
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
55
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
56 child = _purple_account_to_xmlnode(account);
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
57 purple_xmlnode_insert_child(node, child);
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
58 }
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
59
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
60 static PurpleXmlNode *
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
61 accounts_to_xmlnode(void)
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
62 {
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
63 PurpleAccountManager *manager = purple_account_manager_get_default();
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
64 PurpleXmlNode *node = NULL;
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
65
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
66 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
67 purple_xmlnode_set_attrib(node, "version", "1.0");
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
68
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
69 purple_account_manager_foreach(manager, accounts_to_xmlnode_helper, node);
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
70
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
71 return node;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
72 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
73
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
74 static void
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
75 sync_accounts(void)
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
76 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
77 PurpleXmlNode *node;
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
78 char *data;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
79
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
80 if (!accounts_loaded)
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
81 {
35176
b0659f31989d Update debug categories for new filenames
Ankit Vani <a@nevitus.org>
parents: 35091
diff changeset
82 purple_debug_error("accounts", "Attempted to save accounts before "
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
83 "they were read!\n");
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
84 return;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
85 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
86
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
87 node = accounts_to_xmlnode();
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
88 data = purple_xmlnode_to_formatted_str(node, NULL);
39438
e85334959b23 Move more libpurple files to ~/.config.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39352
diff changeset
89 purple_util_write_data_to_config_file("accounts.xml", data, -1);
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
90 g_free(data);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
91 purple_xmlnode_free(node);
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
92 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
93
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
94 static gboolean
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
95 save_cb(gpointer data)
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
96 {
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
97 sync_accounts();
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
98 save_timer = 0;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
99 return FALSE;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
100 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
101
34582
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
102 void
67a520874aa9 Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents: 34581
diff changeset
103 purple_accounts_schedule_save(void)
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
104 {
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
105 if (save_timer == 0)
38433
361c801c4536 Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents: 37679
diff changeset
106 save_timer = g_timeout_add_seconds(5, save_cb, NULL);
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
107 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
108
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
109 static void
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
110 migrate_xmpp_encryption(PurpleAccount *account)
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
111 {
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
112 /* When this is removed, nuke the "old_ssl" and "require_tls" settings */
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
113 if (g_str_equal(purple_account_get_protocol_id(account), "prpl-jabber")) {
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
114 const char *sec = purple_account_get_string(account, "connection_security", "");
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
115
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
116 if (g_str_equal("", sec)) {
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
117 const char *val = "require_tls";
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
118 if (purple_account_get_bool(account, "old_ssl", FALSE))
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
119 val = "old_ssl";
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
120 else if (!purple_account_get_bool(account, "require_tls", TRUE))
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
121 val = "opportunistic_tls";
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
122
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
123 purple_account_set_string(account, "connection_security", val);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
124 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
125 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
126 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
127
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
128 static void
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
129 parse_settings(PurpleXmlNode *node, PurpleAccount *account)
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
130 {
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
131 const char *ui;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
132 PurpleXmlNode *child;
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
133
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
134 /* Get the UI string, if these are UI settings */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
135 ui = purple_xmlnode_get_attrib(node, "ui");
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
136
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
137 /* Read settings, one by one */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
138 for (child = purple_xmlnode_get_child(node, "setting"); child != NULL;
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
139 child = purple_xmlnode_get_next_twin(child))
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
140 {
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
141 const char *name, *str_type;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
142 PurplePrefType type;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
143 char *data;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
144
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
145 name = purple_xmlnode_get_attrib(child, "name");
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
146 if (name == NULL)
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
147 /* Ignore this setting */
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
148 continue;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
149
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
150 str_type = purple_xmlnode_get_attrib(child, "type");
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
151 if (str_type == NULL)
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
152 /* Ignore this setting */
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
153 continue;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
154
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
155 if (purple_strequal(str_type, "string"))
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
156 type = PURPLE_PREF_STRING;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
157 else if (purple_strequal(str_type, "int"))
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
158 type = PURPLE_PREF_INT;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
159 else if (purple_strequal(str_type, "bool"))
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
160 type = PURPLE_PREF_BOOLEAN;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
161 else
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
162 /* Ignore this setting */
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
163 continue;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
164
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
165 data = purple_xmlnode_get_data(child);
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
166 if (data == NULL)
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
167 /* Ignore this setting */
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
168 continue;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
169
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
170 if (ui == NULL)
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
171 {
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
172 if (type == PURPLE_PREF_STRING)
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
173 purple_account_set_string(account, name, data);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
174 else if (type == PURPLE_PREF_INT)
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
175 purple_account_set_int(account, name, atoi(data));
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
176 else if (type == PURPLE_PREF_BOOLEAN)
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
177 purple_account_set_bool(account, name,
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
178 (*data == '0' ? FALSE : TRUE));
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
179 } else {
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
180 if (type == PURPLE_PREF_STRING)
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
181 purple_account_set_ui_string(account, ui, name, data);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
182 else if (type == PURPLE_PREF_INT)
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
183 purple_account_set_ui_int(account, ui, name, atoi(data));
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
184 else if (type == PURPLE_PREF_BOOLEAN)
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
185 purple_account_set_ui_bool(account, ui, name,
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
186 (*data == '0' ? FALSE : TRUE));
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
187 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
188
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
189 g_free(data);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
190 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
191
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
192 /* we do this here because we need to do it before the user views the
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
193 * Edit Account dialog. */
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
194 migrate_xmpp_encryption(account);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
195 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
196
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
197 static void
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
198 parse_proxy_info(PurpleXmlNode *node, PurpleAccount *account)
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
199 {
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
200 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
201 PurpleXmlNode *child;
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
202 char *data;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
203
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
204 proxy_info = purple_proxy_info_new();
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
205
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
206 /* Use the global proxy settings, by default */
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
207 purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_USE_GLOBAL);
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
208
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
209 /* Read proxy type */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
210 child = purple_xmlnode_get_child(node, "type");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
211 if ((child != NULL) && ((data = purple_xmlnode_get_data(child)) != NULL))
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
212 {
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
213 if (purple_strequal(data, "global"))
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
214 purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_USE_GLOBAL);
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
215 else if (purple_strequal(data, "none"))
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
216 purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_NONE);
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
217 else if (purple_strequal(data, "http"))
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
218 purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_HTTP);
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
219 else if (purple_strequal(data, "socks4"))
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
220 purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_SOCKS4);
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
221 else if (purple_strequal(data, "socks5"))
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
222 purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_SOCKS5);
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
223 else if (purple_strequal(data, "tor"))
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
224 purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_TOR);
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
225 else if (purple_strequal(data, "envvar"))
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
226 purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_USE_ENVVAR);
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
227 else
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
228 {
35176
b0659f31989d Update debug categories for new filenames
Ankit Vani <a@nevitus.org>
parents: 35091
diff changeset
229 purple_debug_error("accounts", "Invalid proxy type found when "
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
230 "loading account information for %s\n",
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
231 purple_account_get_username(account));
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
232 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
233 g_free(data);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
234 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
235
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
236 /* Read proxy host */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
237 child = purple_xmlnode_get_child(node, "host");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
238 if ((child != NULL) && ((data = purple_xmlnode_get_data(child)) != NULL))
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
239 {
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
240 purple_proxy_info_set_host(proxy_info, data);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
241 g_free(data);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
242 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
243
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
244 /* Read proxy port */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
245 child = purple_xmlnode_get_child(node, "port");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
246 if ((child != NULL) && ((data = purple_xmlnode_get_data(child)) != NULL))
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
247 {
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
248 purple_proxy_info_set_port(proxy_info, atoi(data));
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
249 g_free(data);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
250 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
251
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
252 /* Read proxy username */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
253 child = purple_xmlnode_get_child(node, "username");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
254 if ((child != NULL) && ((data = purple_xmlnode_get_data(child)) != NULL))
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
255 {
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
256 purple_proxy_info_set_username(proxy_info, data);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
257 g_free(data);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
258 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
259
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
260 /* Read proxy password */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
261 child = purple_xmlnode_get_child(node, "password");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
262 if ((child != NULL) && ((data = purple_xmlnode_get_data(child)) != NULL))
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
263 {
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
264 purple_proxy_info_set_password(proxy_info, data);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
265 g_free(data);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
266 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
267
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
268 /* If there are no values set then proxy_info NULL */
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
269 if ((purple_proxy_info_get_proxy_type(proxy_info) == PURPLE_PROXY_USE_GLOBAL) &&
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
270 (purple_proxy_info_get_host(proxy_info) == NULL) &&
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
271 (purple_proxy_info_get_port(proxy_info) == 0) &&
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
272 (purple_proxy_info_get_username(proxy_info) == NULL) &&
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
273 (purple_proxy_info_get_password(proxy_info) == NULL))
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
274 {
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
275 purple_proxy_info_destroy(proxy_info);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
276 return;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
277 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
278
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
279 purple_account_set_proxy_info(account, proxy_info);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
280 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
281
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
282 static void
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
283 parse_current_error(PurpleXmlNode *node, PurpleAccount *account)
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
284 {
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
285 guint type;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
286 char *type_str = NULL, *description = NULL;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
287 PurpleXmlNode *child;
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
288 PurpleConnectionErrorInfo *current_error = NULL;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
289
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
290 child = purple_xmlnode_get_child(node, "type");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
291 if (child == NULL || (type_str = purple_xmlnode_get_data(child)) == NULL)
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
292 return;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
293 type = atoi(type_str);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
294 g_free(type_str);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
295
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
296 if (type > PURPLE_CONNECTION_ERROR_OTHER_ERROR)
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
297 {
35176
b0659f31989d Update debug categories for new filenames
Ankit Vani <a@nevitus.org>
parents: 35091
diff changeset
298 purple_debug_error("accounts",
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
299 "Invalid PurpleConnectionError value %d found when "
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
300 "loading account information for %s\n",
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
301 type, purple_account_get_username(account));
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
302 type = PURPLE_CONNECTION_ERROR_OTHER_ERROR;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
303 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
304
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
305 child = purple_xmlnode_get_child(node, "description");
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
306 if (child)
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
307 description = purple_xmlnode_get_data(child);
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
308 if (description == NULL)
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
309 description = g_strdup("");
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
310
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
311 current_error = g_new0(PurpleConnectionErrorInfo, 1);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
312 current_error->type = type;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
313 current_error->description = description;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
314
34767
38a5613c3e26 Prepended functions private to a subsystem but used over multiple files by underscore
Ankit Vani <a@nevitus.org>
parents: 34765
diff changeset
315 _purple_account_set_current_error(account, current_error);
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
316 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
317
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
318 static PurpleAccount *
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
319 parse_account(PurpleXmlNode *node)
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
320 {
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
321 PurpleAccount *ret;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
322 PurpleXmlNode *child;
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
323 gchar *id = NULL;
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
324 char *protocol_id = NULL;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
325 char *name = NULL;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
326 char *data;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
327
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
328 child = purple_xmlnode_get_child(node, "id");
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
329 if(child != NULL) {
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
330 id = purple_xmlnode_get_data(child);
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
331 }
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
332
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
333 child = purple_xmlnode_get_child(node, "protocol");
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
334 if (child != NULL)
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
335 protocol_id = purple_xmlnode_get_data(child);
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
336
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
337 child = purple_xmlnode_get_child(node, "name");
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
338 if (child != NULL)
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
339 name = purple_xmlnode_get_data(child);
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
340 if (name == NULL)
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
341 {
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
342 /* Do we really need to do this? */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
343 child = purple_xmlnode_get_child(node, "username");
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
344 if (child != NULL)
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
345 name = purple_xmlnode_get_data(child);
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
346 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
347
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
348 if ((protocol_id == NULL) || (name == NULL))
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
349 {
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
350 g_free(id);
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
351 g_free(protocol_id);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
352 g_free(name);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
353 return NULL;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
354 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
355
41204
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
356 /* Manually create the account as the id parameter is construct only and we
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
357 * don't want people messing with it.
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
358 */
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
359 ret = g_object_new(PURPLE_TYPE_ACCOUNT,
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
360 "id", id,
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
361 "username", name,
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
362 "protocol-id", protocol_id,
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
363 NULL);
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
364
c38a5a2a8d43 Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents: 41181
diff changeset
365 g_free(id);
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
366 g_free(name);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
367 g_free(protocol_id);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
368
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
369 /* Read the alias */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
370 child = purple_xmlnode_get_child(node, "alias");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
371 if ((child != NULL) && ((data = purple_xmlnode_get_data(child)) != NULL))
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
372 {
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
373 if (*data != '\0')
34589
428e92c79631 Renamed purple_account_[get,set]_alias to purple_account[get,set]_private_alias.
Ankit Vani <a@nevitus.org>
parents: 34588
diff changeset
374 purple_account_set_private_alias(ret, data);
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
375 g_free(data);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
376 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
377
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
378 /* Read the userinfo */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
379 child = purple_xmlnode_get_child(node, "userinfo");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
380 if ((child != NULL) && ((data = purple_xmlnode_get_data(child)) != NULL))
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
381 {
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
382 purple_account_set_user_info(ret, data);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
383 g_free(data);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
384 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
385
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
386 /* Read an old buddyicon */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
387 child = purple_xmlnode_get_child(node, "buddyicon");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
388 if ((child != NULL) && ((data = purple_xmlnode_get_data(child)) != NULL))
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
389 {
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
390 const char *dirname = purple_buddy_icons_get_cache_dir();
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
391 char *filename = g_build_filename(dirname, data, NULL);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
392 gchar *contents;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
393 gsize len;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
394
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
395 if (g_file_get_contents(filename, &contents, &len, NULL))
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
396 {
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
397 purple_buddy_icons_set_account_icon(ret, (guchar *)contents, len);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
398 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
399
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
400 g_free(filename);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
401 g_free(data);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
402 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
403
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
404 /* Read settings (both core and UI) */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
405 for (child = purple_xmlnode_get_child(node, "settings"); child != NULL;
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
406 child = purple_xmlnode_get_next_twin(child))
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
407 {
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
408 parse_settings(child, ret);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
409 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
410
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
411 /* Read proxy */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
412 child = purple_xmlnode_get_child(node, "proxy");
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
413 if (child != NULL)
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
414 {
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
415 parse_proxy_info(child, ret);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
416 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
417
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
418 /* Read current error */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
419 child = purple_xmlnode_get_child(node, "current_error");
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
420 if (child != NULL)
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
421 {
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
422 parse_current_error(child, ret);
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
423 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
424
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
425 return ret;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
426 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
427
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
428 static void
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
429 load_accounts(void) {
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
430 PurpleAccountManager *manager = NULL;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
431 PurpleXmlNode *node, *child;
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
432
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
433 accounts_loaded = TRUE;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
434
39438
e85334959b23 Move more libpurple files to ~/.config.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39352
diff changeset
435 node = purple_util_read_xml_from_config_file("accounts.xml", _("accounts"));
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
436
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
437 if(node == NULL) {
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
438 return;
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
439 }
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
440
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
441 manager = purple_account_manager_get_default();
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
442
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
443 for(child = purple_xmlnode_get_child(node, "account"); child != NULL;
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
444 child = purple_xmlnode_get_next_twin(child))
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
445 {
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
446 PurpleAccount *new_acct;
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
447 new_acct = parse_account(child);
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
448
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
449 purple_account_manager_add(manager, new_acct);
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
450 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
451
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
452 purple_xmlnode_free(node);
34579
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
453
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
454 _purple_buddy_icons_account_loaded_cb();
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
455 }
e718d0eea155 Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents: 34574
diff changeset
456
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
457 static void
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40570
diff changeset
458 purple_accounts_delete_set(GObject *obj, GAsyncResult *res, gpointer d) {
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40570
diff changeset
459 PurpleCredentialManager *manager = PURPLE_CREDENTIAL_MANAGER(obj);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40570
diff changeset
460 PurpleAccount *account = PURPLE_ACCOUNT(d);
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40683
diff changeset
461 GError *error = NULL;
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40570
diff changeset
462 gboolean r = FALSE;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40570
diff changeset
463
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40683
diff changeset
464 r = purple_credential_manager_clear_password_finish(manager, res, &error);
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40570
diff changeset
465 if(r != TRUE) {
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40570
diff changeset
466 purple_debug_warning("accounts",
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40683
diff changeset
467 "Failed to remove password for account %s: %s",
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40683
diff changeset
468 purple_account_get_name_for_display(account),
41031
2918459dbd63 Don't error out when trying to remove a password that isn't stored.
Gary Kramlich <grim@reaperworld.com>
parents: 41007
diff changeset
469 (error != NULL) ? error->message : "Unknown error");
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40683
diff changeset
470
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40683
diff changeset
471 g_clear_error(&error);
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40570
diff changeset
472 }
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40570
diff changeset
473
34588
1379416703af Removed purple_account_destroy function declaration, use g_object_unref() instead.
Ankit Vani <a@nevitus.org>
parents: 34582
diff changeset
474 g_object_unref(G_OBJECT(account));
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
475 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
476
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
477 void
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
478 purple_accounts_delete(PurpleAccount *account)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
479 {
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
480 PurpleAccountManager *manager = NULL;
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
481 PurpleBlistNode *gnode = NULL, *cnode = NULL, *bnode = NULL;
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
482 PurpleConversationManager *conv_manager = NULL;
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
483 PurpleCredentialManager *cred_manager = NULL;
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
484 GList *iter = NULL;
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
485
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
486 g_return_if_fail(account != NULL);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
487
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
488 /*
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
489 * Disable the account before blowing it out of the water.
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
490 * Conceptually it probably makes more sense to disable the
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
491 * account for all UIs rather than the just the current UI,
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
492 * but it doesn't really matter.
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
493 */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
494 purple_account_set_enabled(account, purple_core_get_ui(), FALSE);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
495
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
496 purple_notify_close_with_handle(account);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
497 purple_request_close_with_handle(account);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
498
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
499 manager = purple_account_manager_get_default();
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
500 purple_account_manager_remove(manager, account);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
501
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
502 /* Remove this account's buddies */
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
503 for(gnode = purple_blist_get_default_root(); gnode != NULL;
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
504 gnode = purple_blist_node_get_sibling_next(gnode))
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
505 {
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
506 if(!PURPLE_IS_GROUP(gnode)) {
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
507 continue;
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
508 }
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
509
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
510 cnode = purple_blist_node_get_first_child(gnode);
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
511 while(cnode) {
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34812
diff changeset
512 PurpleBlistNode *cnode_next = purple_blist_node_get_sibling_next(cnode);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
513
34696
6e0d13978666 Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
514 if(PURPLE_IS_CONTACT(cnode)) {
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
515 bnode = purple_blist_node_get_first_child(cnode);
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
516 while(bnode) {
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34812
diff changeset
517 PurpleBlistNode *bnode_next = purple_blist_node_get_sibling_next(bnode);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
518
34696
6e0d13978666 Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
519 if (PURPLE_IS_BUDDY(bnode)) {
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
520 PurpleBuddy *b = (PurpleBuddy *)bnode;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
521
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
522 if(purple_buddy_get_account(b) == account) {
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
523 purple_blist_remove_buddy(b);
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
524 }
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
525 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
526 bnode = bnode_next;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
527 }
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
528 } else if(PURPLE_IS_CHAT(cnode)) {
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
529 PurpleChat *c = (PurpleChat *)cnode;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
530
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
531 if(purple_chat_get_account(c) == account) {
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
532 purple_blist_remove_chat(c);
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
533 }
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
534 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
535 cnode = cnode_next;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
536 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
537 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
538
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
539 /* Remove any open conversation for this account */
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
540 conv_manager = purple_conversation_manager_get_default();
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
541 iter = purple_conversation_manager_get_all(conv_manager);
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
542 while(iter != NULL) {
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
543 PurpleConversation *conv = iter->data;
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
544
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
545 if(purple_conversation_get_account(conv) == account) {
34645
a04c721bebf1 Refactored accounts, blist, cmds and connection to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
546 g_object_unref(conv);
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
547 }
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
548
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
549 iter = g_list_delete_link(iter, iter);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
550 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
551
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
552 /* This will cause the deletion of an old buddy icon. */
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
553 purple_buddy_icons_set_account_icon(account, NULL, 0);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
554
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
555 /* This is async because we do not want the
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
556 * account being overwritten before we are done.
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
557 */
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
558 cred_manager = purple_credential_manager_get_default();
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40863
diff changeset
559 purple_credential_manager_clear_password_async(cred_manager, account, NULL,
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40570
diff changeset
560 purple_accounts_delete_set,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40570
diff changeset
561 NULL);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
562 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
563
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
564 static void
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
565 purple_accounts_restore_current_status(PurpleAccount *account,
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
566 G_GNUC_UNUSED gpointer data) {
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
567 gboolean enabled = FALSE, online = FALSE;
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
568
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
569 enabled = purple_account_get_enabled(account, purple_core_get_ui());
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
570 online = purple_presence_is_online(purple_account_get_presence(account));
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
571
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
572 if(enabled && online) {
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
573 purple_account_connect(account);
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
574 }
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
575 }
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
576
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
577 void
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
578 purple_accounts_restore_current_statuses() {
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
579 PurpleAccountManager *manager = NULL;
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
580
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
581 /* If we're not connected to the Internet right now, we bail on this */
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
582 if (!purple_network_is_available()) {
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
583 g_warning("Network not connected; skipping reconnect");
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
584
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
585 return;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
586 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
587
41181
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
588 manager = purple_account_manager_get_default();
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
589 purple_account_manager_foreach(manager,
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
590 purple_accounts_restore_current_status,
e859c41d8996 Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
591 NULL);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
592 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
593
35572
5c4846317f2f Box the *UiOps structures
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
594 static PurpleAccountUiOps *
5c4846317f2f Box the *UiOps structures
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
595 purple_account_ui_ops_copy(PurpleAccountUiOps *ops)
5c4846317f2f Box the *UiOps structures
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
596 {
5c4846317f2f Box the *UiOps structures
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
597 PurpleAccountUiOps *ops_new;
5c4846317f2f Box the *UiOps structures
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
598
5c4846317f2f Box the *UiOps structures
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
599 g_return_val_if_fail(ops != NULL, NULL);
5c4846317f2f Box the *UiOps structures
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
600
5c4846317f2f Box the *UiOps structures
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
601 ops_new = g_new(PurpleAccountUiOps, 1);
5c4846317f2f Box the *UiOps structures
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
602 *ops_new = *ops;
5c4846317f2f Box the *UiOps structures
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
603
5c4846317f2f Box the *UiOps structures
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
604 return ops_new;
5c4846317f2f Box the *UiOps structures
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
605 }
5c4846317f2f Box the *UiOps structures
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
606
5c4846317f2f Box the *UiOps structures
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
607 GType
5c4846317f2f Box the *UiOps structures
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
608 purple_account_ui_ops_get_type(void)
5c4846317f2f Box the *UiOps structures
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
609 {
5c4846317f2f Box the *UiOps structures
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
610 static GType type = 0;
5c4846317f2f Box the *UiOps structures
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
611
5c4846317f2f Box the *UiOps structures
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
612 if (type == 0) {
5c4846317f2f Box the *UiOps structures
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
613 type = g_boxed_type_register_static("PurpleAccountUiOps",
5c4846317f2f Box the *UiOps structures
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
614 (GBoxedCopyFunc)purple_account_ui_ops_copy,
35597
7fcfcf147b99 Use g_free as UiOps structures GBoxed free function
Ankit Vani <a@nevitus.org>
parents: 35572
diff changeset
615 (GBoxedFreeFunc)g_free);
35572
5c4846317f2f Box the *UiOps structures
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
616 }
5c4846317f2f Box the *UiOps structures
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
617
5c4846317f2f Box the *UiOps structures
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
618 return type;
5c4846317f2f Box the *UiOps structures
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
619 }
5c4846317f2f Box the *UiOps structures
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
620
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
621 void
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
622 purple_accounts_set_ui_ops(PurpleAccountUiOps *ops)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
623 {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
624 account_ui_ops = ops;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
625 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
626
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
627 PurpleAccountUiOps *
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
628 purple_accounts_get_ui_ops(void)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
629 {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
630 return account_ui_ops;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
631 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
632
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
633 void *
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
634 purple_accounts_get_handle(void)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
635 {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
636 static int handle;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
637
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
638 return &handle;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
639 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
640
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
641 static void
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
642 signed_on_cb(PurpleConnection *gc,
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
643 gpointer unused)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
644 {
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
645 PurpleAccount *account = purple_connection_get_account(gc);
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
646 purple_account_clear_current_error(account);
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
647
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
648 purple_signal_emit(purple_accounts_get_handle(), "account-signed-on",
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
649 account);
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
650 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
651
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
652 static void
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
653 signed_off_cb(PurpleConnection *gc,
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
654 gpointer unused)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
655 {
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
656 PurpleAccount *account = purple_connection_get_account(gc);
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
657
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
658 purple_signal_emit(purple_accounts_get_handle(), "account-signed-off",
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
659 account);
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
660 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
661
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
662 static void
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
663 connection_error_cb(PurpleConnection *gc,
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
664 PurpleConnectionError type,
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
665 const gchar *description,
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
666 gpointer unused)
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
667 {
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
668 PurpleAccount *account;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
669 PurpleConnectionErrorInfo *err;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
670
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
671 account = purple_connection_get_account(gc);
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
672
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
673 g_return_if_fail(account != NULL);
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
674
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
675 err = g_new0(PurpleConnectionErrorInfo, 1);
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
676
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
677 err->type = type;
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
678 err->description = g_strdup(description);
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
679
34767
38a5613c3e26 Prepended functions private to a subsystem but used over multiple files by underscore
Ankit Vani <a@nevitus.org>
parents: 34765
diff changeset
680 _purple_account_set_current_error(account, err);
34581
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
681
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
682 purple_signal_emit(purple_accounts_get_handle(), "account-connection-error",
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
683 account, type, description);
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
684 }
b4e0236019e6 Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents: 34580
diff changeset
685
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
686 void
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
687 purple_accounts_init(void)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
688 {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
689 void *handle = purple_accounts_get_handle();
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
690 void *conn_handle = purple_connections_get_handle();
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
691
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
692 purple_signal_register(handle, "account-connecting",
34812
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
693 purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
694 PURPLE_TYPE_ACCOUNT);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
695
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
696 purple_signal_register(handle, "account-disabled",
34812
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
697 purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
698 PURPLE_TYPE_ACCOUNT);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
699
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
700 purple_signal_register(handle, "account-enabled",
34812
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
701 purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
702 PURPLE_TYPE_ACCOUNT);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
703
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
704 purple_signal_register(handle, "account-setting-info",
34812
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
705 purple_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2,
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
706 PURPLE_TYPE_ACCOUNT, G_TYPE_STRING);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
707
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
708 purple_signal_register(handle, "account-set-info",
34812
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
709 purple_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2,
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
710 PURPLE_TYPE_ACCOUNT, G_TYPE_STRING);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
711
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
712 purple_signal_register(handle, "account-created",
34812
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
713 purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
714 PURPLE_TYPE_ACCOUNT);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
715
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
716 purple_signal_register(handle, "account-destroying",
34812
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
717 purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
718 PURPLE_TYPE_ACCOUNT);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
719
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
720 purple_signal_register(handle, "account-added",
34812
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
721 purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
722 PURPLE_TYPE_ACCOUNT);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
723
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
724 purple_signal_register(handle, "account-removed",
34812
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
725 purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
726 PURPLE_TYPE_ACCOUNT);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
727
37679
6ff708c38c04 Add "account-status-changing" signal from instantbird
Florian Quèze <florian@instantbird.org>
parents: 37195
diff changeset
728 purple_signal_register(handle, "account-status-changing",
6ff708c38c04 Add "account-status-changing" signal from instantbird
Florian Quèze <florian@instantbird.org>
parents: 37195
diff changeset
729 purple_marshal_VOID__POINTER_POINTER_POINTER,
6ff708c38c04 Add "account-status-changing" signal from instantbird
Florian Quèze <florian@instantbird.org>
parents: 37195
diff changeset
730 G_TYPE_NONE, 3, PURPLE_TYPE_ACCOUNT,
6ff708c38c04 Add "account-status-changing" signal from instantbird
Florian Quèze <florian@instantbird.org>
parents: 37195
diff changeset
731 PURPLE_TYPE_STATUS, PURPLE_TYPE_STATUS);
6ff708c38c04 Add "account-status-changing" signal from instantbird
Florian Quèze <florian@instantbird.org>
parents: 37195
diff changeset
732
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
733 purple_signal_register(handle, "account-status-changed",
34812
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
734 purple_marshal_VOID__POINTER_POINTER_POINTER,
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
735 G_TYPE_NONE, 3, PURPLE_TYPE_ACCOUNT,
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
736 PURPLE_TYPE_STATUS, PURPLE_TYPE_STATUS);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
737
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
738 purple_signal_register(handle, "account-actions-changed",
34812
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
739 purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
740 PURPLE_TYPE_ACCOUNT);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
741
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
742 purple_signal_register(handle, "account-alias-changed",
34812
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
743 purple_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2,
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
744 PURPLE_TYPE_ACCOUNT, G_TYPE_STRING);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
745
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
746 purple_signal_register(handle, "account-authorization-requested",
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
747 purple_marshal_INT__POINTER_POINTER_POINTER,
34812
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
748 G_TYPE_INT, 4, PURPLE_TYPE_ACCOUNT, G_TYPE_STRING,
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
749 G_TYPE_STRING, G_TYPE_STRING);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
750
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
751 purple_signal_register(handle, "account-authorization-denied",
34812
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
752 purple_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 3,
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
753 PURPLE_TYPE_ACCOUNT, G_TYPE_STRING, G_TYPE_STRING);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
754
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
755 purple_signal_register(handle, "account-authorization-granted",
34812
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
756 purple_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 3,
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
757 PURPLE_TYPE_ACCOUNT, G_TYPE_STRING, G_TYPE_STRING);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
758
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
759 purple_signal_register(handle, "account-error-changed",
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
760 purple_marshal_VOID__POINTER_POINTER_POINTER,
34812
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
761 G_TYPE_NONE, 3, PURPLE_TYPE_ACCOUNT,
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
762 PURPLE_TYPE_CONNECTION_ERROR_INFO,
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
763 PURPLE_TYPE_CONNECTION_ERROR_INFO);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
764
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
765 purple_signal_register(handle, "account-signed-on",
34812
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
766 purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
767 PURPLE_TYPE_ACCOUNT);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
768
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
769 purple_signal_register(handle, "account-signed-off",
34812
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
770 purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
771 PURPLE_TYPE_ACCOUNT);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
772
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
773 purple_signal_register(handle, "account-connection-error",
34812
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
774 purple_marshal_VOID__POINTER_INT_POINTER,
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
775 G_TYPE_NONE, 3, PURPLE_TYPE_ACCOUNT,
3d6f7d9dc21d Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents: 34767
diff changeset
776 PURPLE_TYPE_CONNECTION_ERROR, G_TYPE_STRING);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
777
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
778 purple_signal_connect(conn_handle, "signed-on", handle,
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
779 PURPLE_CALLBACK(signed_on_cb), NULL);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
780 purple_signal_connect(conn_handle, "signed-off", handle,
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
781 PURPLE_CALLBACK(signed_off_cb), NULL);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
782 purple_signal_connect(conn_handle, "connection-error", handle,
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
783 PURPLE_CALLBACK(connection_error_cb), NULL);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
784
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
785 load_accounts();
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
786
40505
e2c4be9e3aa6 fix some issues that were identified while working on a flatpak build
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
787 g_signal_connect(G_OBJECT(g_network_monitor_get_default()),
e2c4be9e3aa6 fix some issues that were identified while working on a flatpak build
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
788 "network-changed",
40512
05663def7b82 Fix some easy compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 40505
diff changeset
789 G_CALLBACK(purple_accounts_network_changed_cb), NULL);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
790 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
791
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
792 void
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
793 purple_accounts_uninit(void)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
794 {
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
795 gpointer handle = purple_accounts_get_handle();
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
796 if (save_timer != 0)
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
797 {
38433
361c801c4536 Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents: 37679
diff changeset
798 g_source_remove(save_timer);
34574
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
799 save_timer = 0;
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
800 sync_accounts();
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
801 }
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
802
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
803 purple_signals_disconnect_by_handle(handle);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
804 purple_signals_unregister_by_instance(handle);
19850cd1b2de Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
805 }

mercurial